You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "iwanttobepowerful (via GitHub)" <gi...@apache.org> on 2025/10/27 05:42:39 UTC

[PR] Add test case for CALCITE-7239 [calcite]

iwanttobepowerful opened a new pull request, #4603:
URL: https://github.com/apache/calcite/pull/4603

   (no comment)


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add test case for CALCITE-7239 [calcite]

Posted by "iwanttobepowerful (via GitHub)" <gi...@apache.org>.
iwanttobepowerful commented on code in PR #4603:
URL: https://github.com/apache/calcite/pull/4603#discussion_r2464553672


##########
core/src/test/java/org/apache/calcite/tools/PlannerTest.java:
##########
@@ -1558,6 +1558,32 @@ private void assertValidPlan(String sql, RelDataTypeSystem typeSystem,
     assertThat(toString(root.rel), planMatcher);
   }
 
+  @Test void test7239() throws Exception {
+    final String sql = "SELECT e1.*, d.deptno\n"
+        + "FROM emp e1 LEFT JOIN dept d\n"
+        + "ON e1.deptno = d.deptno\n"
+        + "AND d.deptno IN (\n"
+        + " SELECT e3.deptno FROM emp e3 WHERE d.deptno > e3.comm)\n"
+        + "ORDER BY e1.empno";
+    assertValidPlan2(sql, new VaryingTypeSystem(DelegatingTypeSystem.DEFAULT));
+  }
+
+  /** Asserts that a Planner generates the correct plan using the
+   * provided type system. */
+  private void assertValidPlan2(String sql, RelDataTypeSystem typeSystem)
+      throws SqlParseException, ValidationException, RelConversionException {
+    final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
+    final FrameworkConfig config = Frameworks.newConfigBuilder()
+        .defaultSchema(
+            CalciteAssert.addSchema(rootSchema, CalciteAssert.SchemaSpec.SCOTT))
+        .typeSystem(typeSystem).build();
+    final Planner planner = Frameworks.getPlanner(config);
+    SqlNode parse = planner.parse(sql);
+    final SqlNode validate = planner.validate(parse);
+    final RelRoot root = planner.relWithSubQueryRemoved(validate);
+    System.out.println(toString(root.rel));

Review Comment:
   I just print the wrong plan here, without check yet



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add test case for CALCITE-7239 [calcite]

Posted by "iwanttobepowerful (via GitHub)" <gi...@apache.org>.
iwanttobepowerful commented on code in PR #4603:
URL: https://github.com/apache/calcite/pull/4603#discussion_r2464553672


##########
core/src/test/java/org/apache/calcite/tools/PlannerTest.java:
##########
@@ -1558,6 +1558,32 @@ private void assertValidPlan(String sql, RelDataTypeSystem typeSystem,
     assertThat(toString(root.rel), planMatcher);
   }
 
+  @Test void test7239() throws Exception {
+    final String sql = "SELECT e1.*, d.deptno\n"
+        + "FROM emp e1 LEFT JOIN dept d\n"
+        + "ON e1.deptno = d.deptno\n"
+        + "AND d.deptno IN (\n"
+        + " SELECT e3.deptno FROM emp e3 WHERE d.deptno > e3.comm)\n"
+        + "ORDER BY e1.empno";
+    assertValidPlan2(sql, new VaryingTypeSystem(DelegatingTypeSystem.DEFAULT));
+  }
+
+  /** Asserts that a Planner generates the correct plan using the
+   * provided type system. */
+  private void assertValidPlan2(String sql, RelDataTypeSystem typeSystem)
+      throws SqlParseException, ValidationException, RelConversionException {
+    final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
+    final FrameworkConfig config = Frameworks.newConfigBuilder()
+        .defaultSchema(
+            CalciteAssert.addSchema(rootSchema, CalciteAssert.SchemaSpec.SCOTT))
+        .typeSystem(typeSystem).build();
+    final Planner planner = Frameworks.getPlanner(config);
+    SqlNode parse = planner.parse(sql);
+    final SqlNode validate = planner.validate(parse);
+    final RelRoot root = planner.relWithSubQueryRemoved(validate);
+    System.out.println(toString(root.rel));

Review Comment:
   I print the wrong plan here, add  check.
   
   ```
       // type mismatch:
       // ref:
       // TINYINT NOT NULL
       // input:
       // VARCHAR(14)
       // java.lang.AssertionError: type mismatch:
       // ref:
       // TINYINT NOT NULL
       // input:
       // VARCHAR(14)
   ```



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add test case for CALCITE-7239 [calcite]

Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on PR #4603:
URL: https://github.com/apache/calcite/pull/4603#issuecomment-3452125451

   Once this is ready for review please add me as a reviewer.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add test case for CALCITE-7239 [calcite]

Posted by "iwanttobepowerful (via GitHub)" <gi...@apache.org>.
iwanttobepowerful commented on PR #4603:
URL: https://github.com/apache/calcite/pull/4603#issuecomment-3452295904

   @mihaibudiu ok, I will. I've just found a way to reproduce the issue, but haven't started researching how to fix it yet.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7239] For the HepPlanner used to execute the SubQueryRemoveRule, its noDag property should be set to true [calcite]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #4603:
URL: https://github.com/apache/calcite/pull/4603#issuecomment-3456204975

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4603) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [2 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4603&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4603&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=4603&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4603&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4603&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4603)
   
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7239] For the HepPlanner used to execute the SubQueryRemoveRule, its noDag property should be set to true [calcite]

Posted by "iwanttobepowerful (via GitHub)" <gi...@apache.org>.
iwanttobepowerful closed pull request #4603: [CALCITE-7239] For the HepPlanner used to execute the SubQueryRemoveRule, its noDag property should be set to true
URL: https://github.com/apache/calcite/pull/4603


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7239] For the HepPlanner used to execute the SubQueryRemoveRule, its noDag property should be set to true [calcite]

Posted by "iwanttobepowerful (via GitHub)" <gi...@apache.org>.
iwanttobepowerful commented on PR #4603:
URL: https://github.com/apache/calcite/pull/4603#issuecomment-3456123197

   @mihaibudiu this is ready for review. It is not a calcite bug. So I just added one test case to close the jira.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add test case for CALCITE-7239 [calcite]

Posted by "iwanttobepowerful (via GitHub)" <gi...@apache.org>.
iwanttobepowerful commented on code in PR #4603:
URL: https://github.com/apache/calcite/pull/4603#discussion_r2464553672


##########
core/src/test/java/org/apache/calcite/tools/PlannerTest.java:
##########
@@ -1558,6 +1558,32 @@ private void assertValidPlan(String sql, RelDataTypeSystem typeSystem,
     assertThat(toString(root.rel), planMatcher);
   }
 
+  @Test void test7239() throws Exception {
+    final String sql = "SELECT e1.*, d.deptno\n"
+        + "FROM emp e1 LEFT JOIN dept d\n"
+        + "ON e1.deptno = d.deptno\n"
+        + "AND d.deptno IN (\n"
+        + " SELECT e3.deptno FROM emp e3 WHERE d.deptno > e3.comm)\n"
+        + "ORDER BY e1.empno";
+    assertValidPlan2(sql, new VaryingTypeSystem(DelegatingTypeSystem.DEFAULT));
+  }
+
+  /** Asserts that a Planner generates the correct plan using the
+   * provided type system. */
+  private void assertValidPlan2(String sql, RelDataTypeSystem typeSystem)
+      throws SqlParseException, ValidationException, RelConversionException {
+    final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
+    final FrameworkConfig config = Frameworks.newConfigBuilder()
+        .defaultSchema(
+            CalciteAssert.addSchema(rootSchema, CalciteAssert.SchemaSpec.SCOTT))
+        .typeSystem(typeSystem).build();
+    final Planner planner = Frameworks.getPlanner(config);
+    SqlNode parse = planner.parse(sql);
+    final SqlNode validate = planner.validate(parse);
+    final RelRoot root = planner.relWithSubQueryRemoved(validate);
+    System.out.println(toString(root.rel));

Review Comment:
   I print the wrong plan here, add  check.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org