MCPcopy Create free account
hub / github.com/apache/datafusion / pre_visit_statement

Method pre_visit_statement

datafusion/sql/src/resolve.rs:121–159  ·  view source on GitHub ↗
(&mut self, statement: &Statement)

Source from the content-addressed store, hash-verified

119 }
120
121 fn pre_visit_statement(&mut self, statement: &Statement) -> ControlFlow<Self::Break> {
122 if let Statement::ShowCreate {
123 obj_type: ShowCreateObject::Table | ShowCreateObject::View,
124 obj_name,
125 } = statement
126 {
127 self.insert_relation(obj_name)?;
128 }
129
130 // SHOW statements will later be rewritten into a SELECT from the information_schema
131 let requires_information_schema = matches!(
132 statement,
133 Statement::ShowFunctions { .. }
134 | Statement::ShowVariable { .. }
135 | Statement::ShowStatus { .. }
136 | Statement::ShowVariables { .. }
137 | Statement::ShowCreate { .. }
138 | Statement::ShowColumns { .. }
139 | Statement::ShowTables { .. }
140 | Statement::ShowCollation { .. }
141 );
142 if requires_information_schema {
143 for s in INFORMATION_SCHEMA_TABLES {
144 // Information schema references are synthesized here, so convert directly.
145 let obj = ObjectName::from(vec![
146 Ident::new(INFORMATION_SCHEMA),
147 Ident::new(*s),
148 ]);
149 match object_name_to_table_reference(obj, self.enable_ident_normalization)
150 {
151 Ok(tbl_ref) => {
152 self.relations.insert(tbl_ref);
153 }
154 Err(e) => return ControlFlow::Break(e),
155 }
156 }
157 }
158 ControlFlow::Continue(())
159 }
160}
161
162fn control_flow_to_result(flow: ControlFlow<DataFusionError>) -> Result<()> {

Callers

nothing calls this directly

Calls 3

insert_relationMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected