Kirill Tkalenko created IGNITE-29306:
----------------------------------------

             Summary: SQL Calcite: Hash join misses equal DECIMAL keys with 
different scales
                 Key: IGNITE-29306
                 URL: https://issues.apache.org/jira/browse/IGNITE-29306
             Project: Ignite
          Issue Type: Bug
          Components: sql
    Affects Versions: 2.18
            Reporter: Kirill Tkalenko
            Assignee: Kirill Tkalenko
         Attachments: DecimalHashJoinScaleIntegrationTest.java

An inner join can return an empty result when matching DECIMAL values have 
different scales, even though the values are numerically equal.

For example, {{BigDecimal("11845600")}} (scale 0) and 
{{BigDecimal("1.18456E+7")}} (scale −2) should match:

 

{{SELECT l.k, r.k FROM LEFT_ROWS l JOIN RIGHT_ROWS r ON l.k = r.k WHERE l.k = 
11845600;}}

 

*Expected:* one matching row.
*Actual:* no rows when the optimizer chooses Hash Join. Nested Loop Join 
returns the expected row.

Hash join key equality and hashing are scale-sensitive for BigDecimal values.

See {{DecimalHashJoinScaleIntegrationTest}} for the complete reproducer.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to