marton-bod opened a new pull request #1742:
URL: https://github.com/apache/iceberg/pull/1742


   Proposing a fix for the issue: https://github.com/apache/iceberg/issues/1699 
- 
   In summary, the problem is that for a predicate literal you cannot use a 
decimal type which has a different scale than the column’s type you compare it 
against. 
   
   To resolve this, I’ve considered three options:
   1. Keeping the status quo: This would entail that we keep the current logic 
as is, and provide clear documentation that when using decimals in predicate 
literals, the same scale needs to be used as the type you compare it against. 
This may go against user expectations (e.g. this is not how it works in Hive at 
the moment).
   2. Change the literal’s scale to match that of the type definition in 
`DecimalLiteral.to()`. This would involve rounding if the literal’s scale was 
the higher one. This introduces the problem that, for example, if we have 
100.22 and 100.23 in our table, then running `SELECT * FROM tbl WHERE val >= 
100.225` could give unexpected results for users due to rounding. 
   3. We ignore the scale differences during conversion (`DecimalLiteral.to()`) 
to other decimal types, since decimals with different scales can still be 
compared in predicates. This avoids any information loss. 
   
   I’ve decided to go with option 3 considering the pros and cons. What do you 
think @rdblue?


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

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