kosiew commented on PR #25165: URL: https://github.com/apache/datafusion/pull/25165#issuecomment-5927441190
@adriangb Yes. Please merge https://github.com/pydantic/datafusion/pull/81, keeping its three commits separate; I’ll re-review the combined diff. The current planner chooses the branch and `TimeUnit` from `expr.get_type(schema)` before coercion. Thus `CASE WHEN f THEN naive_s ELSE aware_frac END AT TIME ZONE 'UTC'` selects seconds and loses the fraction, whereas `main`'s unconditional nanosecond cast preserves it. #81 moves that decision to `timezone`'s `return_field_from_args` and `invoke_with_args`, after coercion and at execution. Its tests cover CASE, CTEs, UNION, views, and PREPARE. Please also: 1. Replace the PR description's known limitation with #81's post-coercion behavior and enumerate: public `timezone(zone, expression)`, changed default column name, changed (unreleased) `ExprPlanner::plan_at_time_zone` arguments, no-planner failure instead of `main`'s CAST fallback, and `timezone(...)` plans. 2. File/link a follow-up for preserving `output_ordering` for `naive AT TIME ZONE 'UTC'` and fixed offsets. The UDF currently loses that property; this is acceptable here. Link #25095 too, since the no-longer-CAST plan changes its comparison rewrite. 3. Get one other maintainer's agreement on exposing `timezone` publicly. PostgreSQL and DuckDB use this name, and it does not conflict with existing DataFusion or Spark functions. -- 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]
