From 44a8fcd0f443928cd3e8fab0a53fe340c7cd3cf1 Mon Sep 17 00:00:00 2001 From: Vamshi Surabhi <0x777@users.noreply.github.com> Date: Wed, 26 Jun 2024 05:10:16 +0530 Subject: [PATCH] do not replace tablescans for information_schema (#764) We shouldn't be replacing 'TableScan's for `information_schema` and `hasura` schemas. Previously, we only had a check for `hasura` schema, this PR now includes a check for `information_schema`. Queries on `information_schema` will now work. V3_GIT_ORIGIN_REV_ID: b25276556027b52ff940ddd3d094ea20f6fc7538 --- v3/crates/sql/src/execute/analyzer.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/v3/crates/sql/src/execute/analyzer.rs b/v3/crates/sql/src/execute/analyzer.rs index 7ca7b7639d7..a9c61464135 100644 --- a/v3/crates/sql/src/execute/analyzer.rs +++ b/v3/crates/sql/src/execute/analyzer.rs @@ -36,7 +36,7 @@ use metadata_resolve::{self as resolved}; use open_dds::identifier::Identifier; use open_dds::types::FieldName; -use crate::plan::NDCQuery; +use crate::{catalog::introspection::HASURA_METADATA_SCHEMA, plan::NDCQuery}; /// Analyzed rule that inlines TableScan that provide a [`LogicalPlan`] /// (DataFrame / ViewTable) @@ -92,7 +92,9 @@ fn analyze_internal( projected_schema, filters: _, fetch: _, - }) if table_name.schema() != Some("hasura") => { + }) if table_name.schema() != Some(HASURA_METADATA_SCHEMA) + && table_name.schema() != Some("information_schema") => + { let table = catalog.get(default_schema, &table_name).ok_or_else(|| { DataFusionError::Internal(format!( "table provider not found for replace_table_scan: {table_name}"