[GitHub] [calcite] mihaibudiu commented on a diff in pull request #3430: [CALCITE-6008] ARRAY_AGG should returns ARRAY NULL when there's no input rows

2023-09-21 Thread via GitHub


mihaibudiu commented on code in PR #3430:
URL: https://github.com/apache/calcite/pull/3430#discussion_r183870


##
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##
@@ -9314,11 +9314,12 @@ private static void 
checkGroupConcatFuncFails(SqlOperatorFixture t) {
   }
 
   private static void checkArrayAggFunc(SqlOperatorFixture f) {
-f.setFor(SqlLibraryOperators.ARRAY_CONCAT_AGG, VM_FENNEL, VM_JAVA);
+f.setFor(SqlLibraryOperators.ARRAY_AGG, VM_FENNEL, VM_JAVA);

Review Comment:
   This was just a suggestion, I don't think it is required necessarily for 
this PR.



-- 
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] mihaibudiu commented on a diff in pull request #3430: [CALCITE-6008] ARRAY_AGG should returns ARRAY NULL when there's no input rows

2023-09-21 Thread via GitHub


mihaibudiu commented on code in PR #3430:
URL: https://github.com/apache/calcite/pull/3430#discussion_r181033


##
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##
@@ -9314,11 +9314,12 @@ private static void 
checkGroupConcatFuncFails(SqlOperatorFixture t) {
   }
 
   private static void checkArrayAggFunc(SqlOperatorFixture f) {
-f.setFor(SqlLibraryOperators.ARRAY_CONCAT_AGG, VM_FENNEL, VM_JAVA);
+f.setFor(SqlLibraryOperators.ARRAY_AGG, VM_FENNEL, VM_JAVA);

Review Comment:
   I have found that sometimes optimization rules produce results that differ 
from the runtime results for the same expression. In particular 
`CoreRules.PROJECT_REDUCE_EXPRESSIONS` will optimize constant expressions. 
Currently there is no easy way to check that the optimization produces the 
expected result. Does the SqlToRelConverterTest allow you to specify 
optimizations?
   
   I am working towards https://issues.apache.org/jira/browse/CALCITE-5891, 
once that exists all the existing SqlOperatorTests will be automatically run in 
both ways. (But it may take awhile, it has uncovered at least 50 bugs in 
RelToSql and the optimizer.)
   



-- 
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] mihaibudiu commented on a diff in pull request #3430: [CALCITE-6008] ARRAY_AGG should returns ARRAY NULL when there's no input rows

2023-09-16 Thread via GitHub


mihaibudiu commented on code in PR #3430:
URL: https://github.com/apache/calcite/pull/3430#discussion_r1327999598


##
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##
@@ -9314,11 +9314,12 @@ private static void 
checkGroupConcatFuncFails(SqlOperatorFixture t) {
   }
 
   private static void checkArrayAggFunc(SqlOperatorFixture f) {
-f.setFor(SqlLibraryOperators.ARRAY_CONCAT_AGG, VM_FENNEL, VM_JAVA);
+f.setFor(SqlLibraryOperators.ARRAY_AGG, VM_FENNEL, VM_JAVA);

Review Comment:
   The optimization will replace the plan with a query returning constant null.



-- 
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] mihaibudiu commented on a diff in pull request #3430: [CALCITE-6008] ARRAY_AGG should returns ARRAY NULL when there's no input rows

2023-09-16 Thread via GitHub


mihaibudiu commented on code in PR #3430:
URL: https://github.com/apache/calcite/pull/3430#discussion_r1327987695


##
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##
@@ -9314,11 +9314,12 @@ private static void 
checkGroupConcatFuncFails(SqlOperatorFixture t) {
   }
 
   private static void checkArrayAggFunc(SqlOperatorFixture f) {
-f.setFor(SqlLibraryOperators.ARRAY_CONCAT_AGG, VM_FENNEL, VM_JAVA);
+f.setFor(SqlLibraryOperators.ARRAY_AGG, VM_FENNEL, VM_JAVA);

Review Comment:
   When fixing some similar bugs I have found that a RelOptRulesTest can often 
exhibit the bug by producing a wrong plan.
   Here is an example: 
https://github.com/apache/calcite/pull/3289/files#diff-a430972be1169f680b7886b824720254fa1dabe37191db34bd2a63f10cf7a438
   I don't know if it will work in your case as well.



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