aalexandrov commented on code in PR #11456:
URL: https://github.com/apache/datafusion/pull/11456#discussion_r1677170472
##########
datafusion/sql/src/relation/mod.rs:
##########
@@ -143,4 +147,45 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
Ok(plan)
}
}
+
+ pub(crate) fn create_relation_subquery(
+ &self,
+ subquery: TableFactor,
+ planner_context: &mut PlannerContext,
+ ) -> Result<LogicalPlan> {
+ // At this point for a syntacitally valid query the outer_from_schema
is
+ // guaranteed to be set, so the `.unwrap()` call will never panic. This
+ // is the case because we only call this method for lateral table
+ // factors, and those can never be the first factor in a FROM list.
This
+ // means we arrived here through the `for` loop in `plan_from_tables`
or
+ // the `for` loop in `plan_table_with_joins`.
+ let old_from_schema =
planner_context.set_outer_from_schema(None).unwrap();
+ let new_query_schema = match planner_context.outer_query_schema() {
+ Some(lhs) => Some(Arc::new(lhs.join(&old_from_schema)?)),
Review Comment:
I added a second commit to the PR that fixes the issue mentioned above (see
the commit message for details).
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]