wiedld commented on issue #12105:
URL: https://github.com/apache/datafusion/issues/12105#issuecomment-2305951679

   Thank you @jonahgao . Agreed that the change was needed.
   
   I was hoping for an update to the docs on how to handle the change (if the 
user needs to) when using the `union()` API. Such as adding an explanation & 
the example code snippet in the method docs.
   
   If the user needs the exact same logical plan as before the change, then 
this is roughly how we did it:
   ```
   let union_schema = coerce_union_schema(vec![prev, next])?;
   let prev = coerce_plan_expr_for_schema(prev, &union_schema)?;
   let next = coerce_plan_expr_for_schema(next, &union_schema)?;
   union(prev, next)
   ```
   
   If the user is ok with added CAST nodes (including timezone cast), then they 
could use the analyzers:
   ```
   let mut plan = union(prev, next)?;
   let wildcard_rewriter = ExpandWildcardRule::new();
   plan = wildcard_rewriter.analyze(plan, 
context.inner().copied_config().options())?;
   let type_rewriter = TypeCoercion::new();
   type_rewriter.analyze(plan, context.inner().copied_config().options())
   ```
   
   @alamb -- we have [passing InfluxQL 
e2es](https://github.com/influxdata/influxdb_iox/pull/11969) with the second 
(analyzer) approach, diffing a lot of added CAST nodes. I'm not sure about the 
use case for other users whom build their own logical plans.
   
    


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

Reply via email to