duongcongtoai commented on code in PR #10429:
URL: https://github.com/apache/datafusion/pull/10429#discussion_r1608935540


##########
datafusion/expr/src/expr_schema.rs:
##########
@@ -123,7 +123,8 @@ impl ExprSchemable for Expr {
                         Ok(field.data_type().clone())
                     }
                     DataType::Struct(_) => {
-                        not_impl_err!("unnest() does not support struct yet")
+                        // TODO: this is not correct, because unnest(struct) 
wll result into multiple data_type

Review Comment:
   if we returns error here, the error will stop the query plan from continue.
   Initially unnest comes into projection step as an Expr here: 
https://github.com/apache/datafusion/blob/d58bae487329b7a7078429f083bffc611f42c8c7/datafusion/expr/src/utils.rs#L734,
 where it check data types of each expr, then later on we call
   
[try_process_unnest](https://github.com/apache/datafusion/blob/ae4b3a0f8366ab18be5ef5cfa2b3cc3aca12baf1/datafusion/sql/src/select.rs#L226)
 to do the transformation from unnest(struct) -> struct.field1, struct.field 2 
...
   
   I think unnest is the only expr so far that represent a set of fields 
instead of singular value here, so i'm thinking of adding an extra check at 
this function 
https://github.com/apache/datafusion/blob/d58bae487329b7a7078429f083bffc611f42c8c7/datafusion/expr/src/utils.rs#L734



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