Skip to content
This repository was archived by the owner on Jan 7, 2025. It is now read-only.

fix(bridge): handle information schema #245

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

skyzh
Copy link
Member

@skyzh skyzh commented Nov 23, 2024

The information schema is not in datafusion's catalog. It is handled differently as in the upstream source code:

https://github.com/apache/datafusion/blob/c0ca4b4e449e07c3bcd6f3593fa31dd31ed5e0c5/datafusion/core/src/execution/session_state.rs#L301-L311

Therefore, we added this special case in the df-bridge.

Signed-off-by: Alex Chi <iskyzh@gmail.com>
Comment on lines +64 to +81
let (schema, table) = if let Some((schema, table)) = name.split_once('.') {
(schema, table)
} else {
("public", name)
};
let schema = if schema == "information_schema" {
// This is `INFORMATION_SCHEMA` but datafusion didn't expose this constant.
// Also, note that we didn't check `session_state.is_information_schema_enabled()` so this schema is always
// available.
Arc::new(InformationSchemaProvider::new(Arc::clone(&self.catalog)))
} else if let Some(schema) = catalog.schema(schema) {
schema
} else {
panic!("schema not found in datafusion catalog: {}", schema)
};
let Some(table) = futures_lite::future::block_on(schema.table(table.as_ref())) else {
panic!("table not found in datafusion catalog: {}", name);
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants