aalexandrov commented on code in PR #11456:
URL: https://github.com/apache/datafusion/pull/11456#discussion_r1680650635
##########
datafusion/sql/src/relation/mod.rs:
##########
@@ -143,4 +147,49 @@ 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();
Review Comment:
Somehow I was thinking that `LATERAL` is not valid / accepted by the parser
for the first element in a `SELECT` list. I fixed the issue and added a
regression test in `sql_integration.rs`.
--
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]