[GitHub] [calcite] libenchao commented on a diff in pull request #2974: [CALCITE-5209] ArrayIndexOutOfBoundsException during SqlToRelConverter for group-by on `case` having `in` expression predicates
libenchao commented on code in PR #2974: URL: https://github.com/apache/calcite/pull/2974#discussion_r1070491944 ## core/src/test/resources/sql/agg.iq: ## @@ -3467,4 +3467,38 @@ order by ename, deptno; !ok +# Test cases for [CALCITE-5209] ArrayIndexOutOfBoundsException during SqlToRelConverter for group-by on `case` +# having `in` expression predicates exceeding SqlRelConverter.Config InSubQueryThreshold +!use scott +select +case when deptno in (1, 2, 3, 4, 5) THEN 1 else 0 end +from emp +group by +case when deptno in (1, 2, 3, 4, 5) THEN 1 else 0 end; + +++ +| EXPR$0 | +++ +| 0 | +++ +(1 row) + +!ok + +!set insubquerythreshold 5 +select +case when deptno in (1, 2, 3, 4, 5) THEN 1 else 0 end Review Comment: This looks better! -- 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
[GitHub] [calcite] libenchao commented on a diff in pull request #2974: [CALCITE-5209] ArrayIndexOutOfBoundsException during SqlToRelConverter for group-by on `case` having `in` expression predicates
libenchao commented on code in PR #2974: URL: https://github.com/apache/calcite/pull/2974#discussion_r1038794437 ## core/src/test/resources/sql/agg.iq: ## @@ -3467,4 +3467,38 @@ order by ename, deptno; !ok +# Test cases for [CALCITE-5209] ArrayIndexOutOfBoundsException during SqlToRelConverter for group-by on `case` +# having `in` expression predicates exceeding SqlRelConverter.Config InSubQueryThreshold +!use scott +select +case when deptno in (1, 2, 3, 4, 5) THEN 1 else 0 end +from emp +group by +case when deptno in (1, 2, 3, 4, 5) THEN 1 else 0 end; + +++ +| EXPR$0 | +++ +| 0 | +++ +(1 row) + +!ok + +!set insubquerythreshold 5 +select +case when deptno in (1, 2, 3, 4, 5) THEN 1 else 0 end Review Comment: The exception has nothing to do with `case`, I would suggest to make it simpler (at least for the commit message and Jira title) -- 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
[GitHub] [calcite] libenchao commented on a diff in pull request #2974: [CALCITE-5209] ArrayIndexOutOfBoundsException during SqlToRelConverter for group-by on `case` having `in` expression predicates
libenchao commented on code in PR #2974: URL: https://github.com/apache/calcite/pull/2974#discussion_r1038789810 ## core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java: ## @@ -6374,10 +6390,13 @@ private static class SubQuery { final SqlNode node; final RelOptUtil.Logic logic; @Nullable RexNode expr; +final SqlImplementor.@Nullable Clause parentClause; Review Comment: How about just name it `clause` instead of `parentClause`? ('parent' makes think that it's something like 'parent scope') -- 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