You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Alexander Paschenko (JIRA)" <ji...@apache.org> on 2017/07/25 10:21:00 UTC

[jira] [Commented] (IGNITE-5818) SQL: query with condition on affinity column works incorrect in some cases.

    [ https://issues.apache.org/jira/browse/IGNITE-5818?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16099828#comment-16099828 ] 

Alexander Paschenko commented on IGNITE-5818:
---------------------------------------------

In fact, it *does* work correctly.

Things go like this in this case:

1. {{new BigDecimal(8.3)}}, {{new BigDecimal("8.3")}} and {{new BigDecimal("8.30")}} are *all* different objects (i.e. have different hash codes and thus obviously are not "equal" in Java terms) - see [1], [2].

2. Ignite's affinity machinery relies on hash codes.

3. H2's {{BigDecimal}} comparison relies on {{compareTo}}, not on {{equals}}, therefore objects that are not equal from Java objects' standpoint *may* be equal from the point of {{BigDecimal}}'s inner representation - that's why your check passes when {{ID}} column is compared, as in this case no partitions prediction is done because {{_key}} column is not involved, and all nodes (or, as in your test, the only node) receive data request.

Per p. 1 and 2, the test fails absolutely right, *it should not pass* because the objects are *different*. To avoid confusion here, the best is just to avoid messing with {{_key}} column.

Probably we should make that partitions detection optimization optional and turnable off. I'd like to hear [~vozerov] on this.

> SQL: query with condition on affinity column works incorrect in some cases.
> ---------------------------------------------------------------------------
>
>                 Key: IGNITE-5818
>                 URL: https://issues.apache.org/jira/browse/IGNITE-5818
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 2.1
>            Reporter: Andrew Mashenkov
>             Fix For: 2.2
>
>         Attachments: DecimalKeyTest.java
>
>
> Looks like query optimization IGNITE-4509 [1] makes some kind of keys to be compared incorrectly.
> E.g. Decimal key. PFA repro.
> [1] https://issues.apache.org/jira/browse/IGNITE-4509



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)