mihaibudiu commented on code in PR #3640: URL: https://github.com/apache/calcite/pull/3640#discussion_r1496781556
########## core/src/main/java/org/apache/calcite/plan/RelOptUtil.java: ########## @@ -286,6 +286,22 @@ public static Set<CorrelationId> getVariablesUsed(RelNode rel) { return visitor.vuv.variables; } + /** + * Returns a set of variables used by the given list of sub-queries and its descendants. + * + * <p> Internally it uses the {@link org.apache.calcite.plan.RelOptUtil#getVariablesUsed} Review Comment: In general I would refrain from describing *implementation* in JavaDoc, unless it is very relevant. JavaDoc is about what the function does, not how. This comment can be a regular comment inside the function, although the function is pretty clear as is. ########## core/src/test/java/org/apache/calcite/test/JdbcTest.java: ########## @@ -8217,6 +8217,75 @@ private void checkGetTimestamp(Connection con) throws SQLException { .returns("EXPR$0=[1, 1.1]\n"); } + /** Test case for + * <a href="https://issues.apache.org/jira/browse/CALCITE-6032">[CALCITE-6032] + * NullPointerException in Reldecorrelator for a Multi level correlated subquery</a>. */ + @Test void testMultiLevelDecorrelation() throws Exception { + String hsqldbMemUrl = "jdbc:hsqldb:mem:."; + Connection baseConnection = DriverManager.getConnection(hsqldbMemUrl); + Statement baseStmt = baseConnection.createStatement(); + baseStmt.execute("create table invoice (c5633_485 integer, c5633_503\n" Review Comment: this code looks like it's machine generated. This makes it hard to read by a human. ########## core/src/main/java/org/apache/calcite/plan/RelOptUtil.java: ########## @@ -286,6 +286,22 @@ public static Set<CorrelationId> getVariablesUsed(RelNode rel) { return visitor.vuv.variables; } + /** + * Returns a set of variables used by the given list of sub-queries and its descendants. + * + * <p> Internally it uses the {@link org.apache.calcite.plan.RelOptUtil#getVariablesUsed} + * to get all the variables used in the relational expression of a given sub-query. + * + * <p> The item type is same as {@link org.apache.calcite.rex.RexCorrelVariable#id}. Review Comment: I really don't know what item you are referring to here. ########## core/src/main/java/org/apache/calcite/plan/RelOptUtil.java: ########## @@ -286,6 +286,22 @@ public static Set<CorrelationId> getVariablesUsed(RelNode rel) { return visitor.vuv.variables; } + /** + * Returns a set of variables used by the given list of sub-queries and its descendants. Review Comment: "a" set is imprecise. I would say "the set" -- 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-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org