[
https://issues.apache.org/jira/browse/IGNITE-13443?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Isaac Zhu updated IGNITE-13443:
-------------------------------
Component/s: sql
> distributed left joins errored with "java.lang.ClassCastException"
> ------------------------------------------------------------------
>
> Key: IGNITE-13443
> URL: https://issues.apache.org/jira/browse/IGNITE-13443
> Project: Ignite
> Issue Type: Bug
> Components: h2-limitation, sql
> Affects Versions: 2.8.1
> Reporter: Isaac Zhu
> Priority: Blocker
> Attachments: JoinBatch.java
>
>
> This is actually an H2 1.4.197 Bug
> When using *distributed joins*, SQL like this (table A and table B are not
> collocated, so distributed join is used here):
> select * from table A left join table B on A.id = B.id left join table C
> on B.id = C.id where ...
> has chance to error out at the second left join with a
> "java.lang.ClassCastException" when the first left join had an EmptyCursor
>
> This is because, for distributed join, H2 JoinBatch is used - it seems
> JoinBatch is not used for collocated join.
> In JoinBatch line 292:
> [https://github.com/h2database/h2database/blob/c8a861bb1a3f04967ec40cb5e3336535c43af5fb/h2/src/main/org/h2/table/JoinBatch.java#L292]
> It increases the filter ID to let the next fetchCurrent call resolve the
> "EMPTY_CURSOR" to a NullRow when a "JoinFilter.find" is not called.
> Then, in the "find" call, the resolved NullRow will be updated to some cursor
> from the future - because only EmptyCursor is skipped in the find(), a
> NullRow will be updated again and the bitwise state goes wrong
> This then causes the exception in "fetchCurrent" line: 358
> [https://github.com/h2database/h2database/blob/c8a861bb1a3f04967ec40cb5e3336535c43af5fb/h2/src/main/org/h2/table/JoinBatch.java#L358]
> The "x" is a Future, so it can't be cast to a Cursor - the state is wrong,
> the "isFuture" returns false while it is a Future.
>
> I did a local fix in our server as a workaround in org.h2.table.JoinBatch,
> the changed code is attached.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)