You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/12/11 11:31:09 UTC

[GitHub] [calcite] cshuo commented on a change in pull request #1643: [CALCITE-3584] Support SQL hints propagation for decorrelation

cshuo commented on a change in pull request #1643: [CALCITE-3584] Support SQL hints propagation for decorrelation
URL: https://github.com/apache/calcite/pull/1643#discussion_r356545537
 
 

 ##########
 File path: core/src/test/resources/org/apache/calcite/test/SqlHintsConverterTest.xml
 ##########
 @@ -55,6 +55,56 @@ select /*+ resource(cpu='2') */ avg(e2.sal) from emp e2 where e2.deptno = d1.dep
         </Resource>
         <Resource name="hints">
             <![CDATA[
+Project:[[RESOURCE inheritPath:[] options:{PARALLELISM=3}]]
+Project:[[RESOURCE inheritPath:[0] options:{PARALLELISM=3}]]
+Project:[[RESOURCE inheritPath:[] options:{CPU=2}], [RESOURCE inheritPath:[0, 0, 1, 0] options:{PARALLELISM=3}]]
+]]>
+        </Resource>
+    </TestCase>
+    <TestCase name="testHintsInSubQueryWithDecorrelation2">
+        <Resource name="sql">
+            <![CDATA[select /*+ properties(k1='v1', k2='v2'), index(ename), no_hash_join */
+sum(e1.empno) from emp e1, dept d1
+where e1.deptno = d1.deptno
+and e1.sal> (
+select /*+ properties(k1='v1', k2='v2'), index(ename), no_hash_join */
+  avg(e2.sal)
+  from emp e2
+  where e2.deptno = d1.deptno)]]>
+        </Resource>
+        <Resource name="hints">
+            <![CDATA[
+Project:[[PROPERTIES inheritPath:[] options:{K1=v1, K2=v2}], [INDEX inheritPath:[] options:[ENAME]], [NO_HASH_JOIN inheritPath:[]]]
 
 Review comment:
   The following is rel plan of the testing sql. I noticed the size of hints for `Project 2` is 0. I'm wondering whether there is something wrong with hint propagation in decorrelation part.
   ```
   LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])
     1> LogicalProject(EMPNO=[$0])
       2> LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10], DEPTNO1=[CAST($11):INTEGER], EXPR$0=[CAST($12):INTEGER])
         LogicalJoin(condition=[AND(=($9, $11), >($5, $12))], joinType=[inner])
           LogicalJoin(condition=[=($7, $9)], joinType=[inner])
             LogicalTableScan(table=[[CATALOG, SALES, EMP]])
             LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
           LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])
             3> LogicalProject(DEPTNO=[$7], SAL=[$5])
               LogicalTableScan(table=[[CATALOG, SALES, EMP]])
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services