Shuo Cheng created CALCITE-3519:
-----------------------------------

             Summary: `inheritPath` of `RelHint` represented by 
`ImmutableBitSet` may be incomplete.
                 Key: CALCITE-3519
                 URL: https://issues.apache.org/jira/browse/CALCITE-3519
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.21.0
            Reporter: Shuo Cheng
             Fix For: 1.22.0


Taking the following SQL with hint for example: (Copying from 
`org.apache.calcite.test.SqlHintsConverterTest.testQueryHint `)

 
{code:java}
select /*+ properties(k1='v1', k2='v2'), index(ename), no_hash_join */
from emp e1 
inner join dept d1 on e1.deptno = d1.deptno
inner join emp e2 on e1.ename = e2.job{code}
 

rel plan with hints should be following according to the hint design doc:
{code:java}
LogicalProject(EMPNO=[$0],...)([PROPERTIES inheritPath:[] options:{K1=v1, 
K2=v2}],[INDEX inheritPath:[] options:[ENAME]],[NO_HASH_JOIN inheritPath:[]])
  LogicalJoin(condition=[=($1, $20)], joinType=[inner]) ([NO_HASH_JOIN 
inheritPath:[0]])
    LogicalJoin(condition=[=($7, $9)], joinType=[inner]) (NO_HASH_JOIN 
inheritPath:[0, 0]])
      LogicalTableScan(table=[[CATALOG, SALES, EMP]]) ([PROPERTIES 
inheritPath:[0, 0, 0] options:{K1=v1, K2=v2}], [INDEX inheritPath:[0, 0, 0] 
options:[ENAME]])
      LogicalTableScan(table=[[CATALOG, SALES, DEPT]]) ([PROPERTIES 
inheritPath:[0, 0, 1] options:{K1=v1, K2=v2}], [INDEX inheritPath:[1, 0, 0] 
options:[ENAME]])
    LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3],...)
      LogicalTableScan(table=[[CATALOG, SALES, EMP]]) ([PROPERTIES 
inheritPath:[0, 1, 0] options:{K1=v1, K2=v2}], [INDEX inheritPath:[0, 1, 0] 
options:[ENAME]]){code}
 

But the expected result of  `SqlHintsConverterTest.testQueryHint` violates  the 
intention of Hint design doc.

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to