Description
given a sql:
select id,first_name,vs.specialty_id from vets join vet_specialties vs on vets.id = vs.vet_id and vet_id>1 order by id desc limit 100
the final plan is:
EnumerableCalc(expr#0..3=[{inputs}], proj#0..1=[{exprs}], specialty_id=[$t3]) EnumerableLimit(fetch=[100]) EnumerableMergeJoin(condition=[=($0, $2)], joinType=[inner]) EnumerableSort(sort0=[$0], dir0=[DESC]) EnumerableCalc(expr#0..2=[{inputs}], proj#0..1=[{exprs}]) JdbcToEnumerableConverter JdbcFilter(condition=[>($0, 1)]) JdbcTableScan(table=[[default, vets]]) EnumerableSort(sort0=[$0], dir0=[DESC]) JdbcToEnumerableConverter JdbcFilter(condition=[>($0, 1)]) JdbcTableScan(table=[[default, vet_specialties]])
The inputs of EnumerableMergeJoin is sorted in descending order,
but the MergeJoinEnumerator just supports inputs sorted in ascending order,
the result is wrong.
I think the MergeJoin should not assume inputs sorted in ascending order,
it should know the inputs sorted order .
Attachments
Issue Links
- duplicates
-
CALCITE-4010 Revise codegen for EnumerableMergeJoin to accept any sort order
- Open