wangzhigang1999 opened a new issue, #10316:
URL: https://github.com/apache/paimon/issues/10316

   ### Paimon version
   
   `master` at `d3393ebf1` (2026-09-29), after #10119 merged.
   
   ### Compute Engine
   
   PyPaimon with PyArrow 19.0.1. The underlying Arrow behavior is tracked by 
[apache/arrow#41011](https://github.com/apache/arrow/issues/41011).
   
   ### Minimal reproduce step
   
   ```python
   from decimal import Decimal
   
   import pyarrow as pa
   import pyarrow.dataset as ds
   
   from pypaimon.common.predicate import Predicate
   
   table = pa.table({
       'value': pa.array(
           [Decimal('1.00'), Decimal('1.01'), Decimal('2.00')],
           type=pa.decimal128(15, 2),
       ),
   })
   for bound in (Decimal('2'), Decimal('1.001')):
       expr = Predicate('lessThan', 0, 'value', [bound]).to_arrow()
       actual = ds.Scanner.from_batches(table.to_reader(), 
filter=expr).to_table()
       print(bound, actual.column('value').to_pylist())
   ```
   
   On PyArrow 19.0.1, this prints `2 []` and `1.001 [1.00, 1.01, 2.00]`. The 
expected results are `[1.00, 1.01]` and `[1.00]`, respectively. The same Arrow 
expression is used by PyPaimon's read filtering. On current `master`, a real 
table read with `WHERE price < 50.001` over `DECIMAL(10,2)` values `50.00` and 
`99.99` returns both rows instead of only `50.00`.
   
   ### What doesn't meet your expectations?
   
   DECIMAL comparison must preserve the literal's exact value when its scale 
differs from the column's scale. A range bound between representable column 
values must select the correct side of that bound; it must not be rounded into 
an incorrect filter.
   
   ### Anything else?
   
   [PR #10119](https://github.com/apache/paimon/pull/10119) has merged and 
fixes the SQL-like `WHERE` entry point's DECIMAL literal parsing. It does not 
change Arrow expression generation, so finer-scale range bounds are still 
incorrect. Programmatic `PredicateBuilder` calls also reproduce this issue 
independently. The proposed fix passes the physical Arrow schema into 
expression generation and builds exact bounds at the DECIMAL column's scale.
   


-- 
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]

Reply via email to