[
https://issues.apache.org/jira/browse/IGNITE-29306?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kirill Tkalenko updated IGNITE-29306:
-------------------------------------
Description:
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.
was:
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.
> 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
> Priority: Major
> Labels: calcite, ignite-2, sql
> Attachments: DecimalHashJoinScaleIntegrationTest.java
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> 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)