DaltonModlin commented on code in PR #3209:
URL: https://github.com/apache/arrow-datafusion/pull/3209#discussion_r950496351


##########
datafusion/sql/src/planner.rs:
##########
@@ -189,8 +191,14 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
                 query,
                 with_options,
                 ..
-            } if columns.is_empty() && with_options.is_empty() => {
-                let plan = self.query_to_plan(*query, &mut HashMap::new())?;
+            } if with_options.is_empty() => {
+                let columns = if columns.is_empty() {
+                    None
+                } else {
+                    Some(columns)
+                };
+                let plan =
+                    self.query_to_plan(*query, &mut HashMap::new(), 
columns.as_ref())?;

Review Comment:
   > I'm not sure I understand why we don't have the projection logic here 
since this is specific to views, rather than passing the columns down into 
`query_to_plan`.
   
   I could move the logic I added to the `query_to_plan_with_alias` method to 
be done after the `query_to_plan` call on line 201 if that's what you're 
thinking. My thought was simply that the plan should be fully formed on return 
from `query_to_plan`



-- 
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