andygrove opened a new pull request, #7236: URL: https://github.com/apache/datafusion-comet/pull/7236
## Which issue does this PR close? Part of #6979. ## Rationale for this change The third item in #6979 moves the `create_expr` arms onto the expression registry, and the issue names two first steps: extract `literal_to_scalar` as a free function, and add a `query_context_for` helper. The `Literal` arm is a large nested match that does not use planner state, and the Cast, CheckOverflow and binary-expression paths each repeat the same query-context lookup. Taking both out of `planner.rs` also shrinks the file that is the most frequent source of merge conflicts in the native code. ## What changes are included in this PR? Two commits: 1. `literal_to_scalar` moves into a new `planner/literal.rs`. The body is the old `Literal` arm, dedented and returning a `Result<ScalarValue>`; the arm in `create_expr` is now three lines. `literal_to_array_ref` stays in `planner.rs` because it has its own tests there. 2. `PhysicalPlanner::query_context_for(expr_id)` replaces the three copies of the registry lookup. There is no behavior change. ## How are these changes tested? - Clippy and `cargo fmt --check` are clean. - The `datafusion-comet` lib tests pass, apart from five `parquet::objectstore::http_metrics` tests that cannot bind a loopback socket in my sandbox. - Three new unit tests cover `literal_to_scalar`: a typed null, an `IntVal` read as `Date32`, and an `IntVal` for a mismatched type. - The JVM suites exercise literals and casts through `create_expr`; I am applying `run-spark-4.1-tests` so CI runs the Spark suite. -- 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]
