Calcite engine do not return expected results in some cases
- Dominant language
- Java
- Stars
- 5.1k
- Forks
- 1.9k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
I've tried to migrate from H2 to Calcite as SqlEngine on ignite 2.17.0
Some queries we do (either through jdbc or SqlFieldQuery) are returning empty result set when using Calcite.
This seem to happen when there are joins on key fields, and a where clause on the joined entity key field. It also seem to happen when the key types on the FROM and JOIN entity do not have the same field number.
You can find a small reproducer on this gist:
https://gist.github.com/bgaraude/db96718b24eae56e764452163be67018
As you can see in the above gist, when the where clause is B.id = ?, it returns nothing. But rewriting the where clause as "B.id = concat(?)" or "B.id like ?", then it works (the bound parameter is the string "a" in the example).
Is this a known issue? Am I doing something wrong?
Contributor guide
Research direction
Use the linked gist as the reproducer and exercise both JDBC and SqlFieldQuery with Calcite on Ignite 2.17.0, comparing B.id = ? with the working rewrites. Trace the join and WHERE handling for differing key-field counts; done means the direct bound-parameter form returns the same expected rows.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100