apache / apache/arrow

[C++] Expression::SimplifyWithGuarantee does not work for different integral types

Open
#39,828 0 comments 0 reactions 0 assignees View on GitHub
Component: C++ Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the bug, including details regarding any error messages, version, and platform.

Dataset has field1 of uint64
I have filtering expression of
`
cp::and_({
cp::greater_equal(cp::field_ref("field1"), cp::literal(1535)),
cp::less_equal(cp::field_ref("field1"), cp::literal(2046)),
})
`

Then in reader I construct guaranteed true expression with row-group metadata min/max values and try to call SimplifyWithGuarantee. Result is
`
((cast(field1, {to_type=int64, allow_int_overflow=false, allow_time_truncate=false, allow_time_overflow=false, allow_decimal_truncate=false, allow_float_truncate=false, allow_invalid_utf8=false}) >= 1535) and (cast(field1, {to_type=int64, allow_int_overflow=false, allow_time_truncate=false, allow_time_overflow=false, allow_decimal_truncate=false, allow_float_truncate=false, allow_invalid_utf8=false}) <= 2046))
`
I expected to have return of "false" in that way and when i change 1535 -> 1535u, 2046 -> 2046u everything works fine

I think that this problem can also occur in many other scenarios like when people pass filters to ScanNode

### Component(s)

C++

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.