Skip to content

Commit affca3e

Browse files
adriangbclaude
andcommitted
Drop the get_preimage volatile fix: tracked in apache#26910
The invariant test lists it as a known failure. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 84cba1c commit affca3e

2 files changed

Lines changed: 0 additions & 21 deletions

File tree

‎datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,12 +2132,6 @@ fn get_preimage(
21322132
if func.signature().volatility != Volatility::Immutable {
21332133
return Ok(PreimageResult::None);
21342134
}
2135-
// The rewrite can reference the argument more than one time, for example
2136-
// `floor(x) = 3` becomes `x >= 3 AND x < 4`. A volatile argument such as
2137-
// `random() * 10` must not be evaluated twice.
2138-
if args.iter().any(Expr::is_volatile) {
2139-
return Ok(PreimageResult::None);
2140-
}
21412135
func.preimage(args, right_expr, info)
21422136
}
21432137

‎datafusion/sqllogictest/test_files/floor_preimage.slt‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -147,21 +147,6 @@ logical_plan
147147
01)Filter: test_data.float_val >= Float64(5) AND test_data.float_val < Float64(6)
148148
02)--TableScan: test_data projection=[id, float_val, int_val, decimal_val]
149149

150-
# A volatile argument is not rewritten: the rewrite would evaluate it twice
151-
query TT
152-
EXPLAIN SELECT id FROM test_data WHERE floor(random() * 10) = arrow_cast(3, 'Float64');
153-
----
154-
logical_plan
155-
01)Filter: floor(random() * Float64(10)) = Float64(3)
156-
02)--TableScan: test_data projection=[id]
157-
158-
query TT
159-
EXPLAIN SELECT id FROM test_data WHERE floor(random() * 10) IN (arrow_cast(3, 'Float64'), arrow_cast(4, 'Float64'));
160-
----
161-
logical_plan
162-
01)Filter: floor(random() * Float64(10)) IN ([Float64(3), Float64(4)])
163-
02)--TableScan: test_data projection=[id]
164-
165150
# 5. IS NOT DISTINCT FROM - adds IS NOT NULL
166151
query TT
167152
EXPLAIN SELECT * FROM test_data WHERE floor(float_val) IS NOT DISTINCT FROM arrow_cast(5, 'Float64');

0 commit comments

Comments
 (0)