joroKr21 commented on PR #14749:
URL: https://github.com/apache/datafusion/pull/14749#issuecomment-2682651670

   The strange part is that the plan before this PR looks like this:
   ```
   plan Projection: 
__unnest_placeholder(make_array(Int64(1),Int64(2),Int64(3)),depth=1) AS 
UNNEST(make_array(Int64(1),Int64(2),Int64(3))) AS c1
     Unnest: 
lists[__unnest_placeholder(make_array(Int64(1),Int64(2),Int64(3)))|depth=1] 
structs[]
       Projection: make_array(Int64(1), Int64(2), Int64(3)) AS 
__unnest_placeholder(make_array(Int64(1),Int64(2),Int64(3)))
         EmptyRelation
   ```
   
   and `plan_to_sql` relies on this double alias to detect the unnest. I think 
here:
   ```rust
       fn check_unnest_placeholder_with_outer_ref(expr: &Expr) -> 
Option<UnnestInputType> {
           if let Expr::Alias(Alias { expr, .. }) = expr {
               if let Expr::Column(Column { name, .. }) = expr.as_ref() {
                   if let Some(prefix) = name.strip_prefix(UNNEST_PLACEHOLDER) {
                       if prefix.starts_with(&format!("({}(", 
OUTER_REFERENCE_COLUMN_PREFIX))
                       {
                           return Some(UnnestInputType::OuterReference);
                       }
                       return Some(UnnestInputType::Scalar);
                   }
               }
           }
           None
       }
   ```


-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to