tustvold commented on code in PR #4607:
URL: https://github.com/apache/arrow-datafusion/pull/4607#discussion_r1061021957


##########
datafusion/core/src/execution/context.rs:
##########
@@ -1642,10 +1642,37 @@ impl SessionState {
 
         match &statement {
             DFStatement::Statement(s) => {
-                visit_relations(s.as_ref(), |relation| {
-                    relations.get_or_insert_with(relation, |_| 
relation.clone());
-                    ControlFlow::<(), ()>::Continue(())
-                });
+                struct RelationVisitor<'a>(&'a mut 
hashbrown::HashSet<ObjectName>);
+
+                impl<'a> Visitor for RelationVisitor<'a> {
+                    type Break = ();
+
+                    fn pre_visit_relation(
+                        &mut self,
+                        relation: &ObjectName,
+                    ) -> ControlFlow<()> {
+                        self.0.get_or_insert_with(relation, |_| 
relation.clone());
+                        ControlFlow::Continue(())
+                    }
+
+                    fn pre_visit_statement(
+                        &mut self,
+                        statement: &Statement,
+                    ) -> ControlFlow<()> {
+                        match statement {

Review Comment:
   This is a bit gross, but I hope to split apart the query planning from the 
other types of query, that will clean this up.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to