rich7420 commented on code in PR #7456:
URL: https://github.com/apache/datafusion-comet/pull/7456#discussion_r4511391194
##########
native/core/src/execution/planner.rs:
##########
@@ -1541,23 +1523,36 @@ impl PhysicalPlanner {
None,
eval_mode,
)?;
- let scalar_expr = Arc::new(ScalarFunctionExpr::new(
- op_str,
- fun_expr,
- vec![left, right],
- Arc::new(Field::new(op_str, data_type, true)),
- Arc::new(ConfigOptions::default()),
- ));
-
- if query_context.is_some() {
- Ok(Arc::new(CheckedBinaryExpr::new(scalar_expr,
query_context)))
- } else {
- Ok(scalar_expr)
- }
+ (
+ Arc::new(ScalarFunctionExpr::new(
+ op_str,
+ fun_expr,
+ vec![left, right],
+ Arc::new(Field::new(op_str, data_type, true)),
+ Arc::new(ConfigOptions::default()),
+ )),
+ true,
+ )
} else {
- Ok(Arc::new(BinaryExpr::new(left, op, right)))
+ (Arc::new(BinaryExpr::new(left, op, right)), false)
}
}
+ };
+ let expr = if options.null_short_circuit {
+ // Spark evaluates the divisor of a division first
+ let order: &[usize] = if op == DataFusionOperator::Divide {
+ &[1, 0]
+ } else {
+ &[0, 1]
+ };
+ NullShortCircuit::wrap_in_order(expr, order, &input_schema)?
Review Comment:
`a DIV b` over ints, and `d + a` with an int `a`, get wrapped even in LEGACY
because `Cast::is_infallible` excludes exact casts such as `CAST(a AS
DECIMAL(19, 0))`. Could integer-to-decimal casts with enough digits count as
infallible?
--
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]