jonahgao commented on code in PR #9592:
URL: https://github.com/apache/arrow-datafusion/pull/9592#discussion_r1523179714
##########
datafusion/sql/src/select.rs:
##########
@@ -276,33 +277,59 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
Ok(plan)
}
- // Try converting Expr::Unnest to LogicalPlan::Unnest if possible,
otherwise do the final projection
+ /// Try converting Expr(Unnest(Expr)) to Projection/Unnest/Projection
pub(super) fn try_process_unnest(
&self,
input: LogicalPlan,
select_exprs: Vec<Expr>,
) -> Result<LogicalPlan> {
let mut unnest_columns = vec![];
- // Map unnest expressions to their argument
- let projection_exprs = select_exprs
+ let mut inner_projection_exprs = vec![];
+
+ let outer_projection_exprs = select_exprs
.into_iter()
.map(|expr| {
- if let Expr::Unnest(Unnest { ref exprs }) = expr {
+ let Transformed {
+ data: transformed_expr,
+ transformed,
+ tnr: _,
+ } = expr.transform_up_mut(&mut |expr: Expr| {
let column_name = expr.display_name()?;
Review Comment:
This can be moved inside the if statement, because it is not used in the
else statement.
--
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]