Fokko commented on PR #4371:
URL: https://github.com/apache/iceberg-python/pull/4371#issuecomment-6873674177

   Thanks for picking this up! I think the scientific notation part should 
follow ANSI SQL. In ANSI, `<mantissa>E<exponent>` is an approximate numeric 
literal (so a double), while only digits with an optional decimal point are 
exact numeric (decimal). Spark 3+, Trino and DuckDB all parse `1e-3` as a 
double.
   
   Parsing it as a `DecimalLiteral` also causes a binding problem: 
`Decimal("1e3")` is `1E+3` with scale -3, so `dec_col = 1e3` cannot bind to any 
decimal column, and `price > 1e-3` only binds when `price` has exactly scale 3. 
The tests don't catch this because `Decimal("2E+2") == Decimal("200")`.
   
   Could we emit a `DoubleLiteral` for the exponent forms instead? That would 
need a `DoubleLiteral.to(LongType)` conversion so `long_col = 1e3` keeps 
working. It would also be great to add a few tests that bind against a schema 
with decimal, long and double columns.
   
   The mixed integer/decimal `IN` list change looks good to me and is in line 
with ANSI.
   


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

Reply via email to