You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "getChan (via GitHub)" <gi...@apache.org> on 2026/07/22 16:56:05 UTC
Re: [PR] Allow expression to report whether they keep the same ordering of the input (`a.cmp(b) == f(a).cmp(f(b))`) opening up for more optimization [datafusion]
getChan commented on code in PR #23807:
URL: https://github.com/apache/datafusion/pull/23807#discussion_r3632161143
##########
datafusion/physical-expr/src/expressions/cast.rs:
##########
@@ -214,8 +214,18 @@ pub(crate) fn cast_expr_properties(
target_type: &DataType,
) -> Result<ExprProperties> {
let unbounded = Interval::make_unbounded(target_type)?;
- if is_order_preserving_cast_family(&child.range.data_type(), target_type) {
- Ok(child.clone().with_range(unbounded))
+ let source_type = child.range.data_type();
+ // A widening cast is additionally one-to-one, so it is strictly
Review Comment:
I may not have full context, so please feel free to ignore this if it's a misunderstanding.
`CastExpr::check_bigger_cast` includes `Int32 -> Float32` and `Int64 -> Float64`. Due to float mantissa limits, large integers
lose precision and can collapse to the same float value (e.g. `16_777_216_i32 as f32 == 16_777_217_i32 as f32`), so they are not strictly 1-to-1
--
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-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org