[GitHub] [calcite] dssysolyatin commented on a diff in pull request #2929: [CALCITE-5310] JSON_OBJECT in scalar sub-query throws AssertionError

2022-11-14 Thread GitBox


dssysolyatin commented on code in PR #2929:
URL: https://github.com/apache/calcite/pull/2929#discussion_r1022331269


##
core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java:
##
@@ -1790,10 +1790,11 @@ private RexNode createCaseExpression(
 
 @Override public RexNode visitLiteral(RexLiteral literal) {
   // Use nullIndicator to decide whether to project null.
-  // Do nothing if the literal is null.
+  // Do nothing if the literal is null or symbol.
   if (!RexUtil.isNull(literal)

Review Comment:
   Ok, I was just trying to understand if we can reduce number of 
caseExpression. Anyway it is not directly related to this ticket.
   
   LGTM



-- 
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] dssysolyatin commented on a diff in pull request #2929: [CALCITE-5310] JSON_OBJECT in scalar sub-query throws AssertionError

2022-11-14 Thread GitBox


dssysolyatin commented on code in PR #2929:
URL: https://github.com/apache/calcite/pull/2929#discussion_r1021396407


##
core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java:
##
@@ -1790,10 +1790,11 @@ private RexNode createCaseExpression(
 
 @Override public RexNode visitLiteral(RexLiteral literal) {
   // Use nullIndicator to decide whether to project null.
-  // Do nothing if the literal is null.
+  // Do nothing if the literal is null or symbol.
   if (!RexUtil.isNull(literal)

Review Comment:
   Ok, I got why calcite wraps literals if literal is in SELECT list like 
`SELEC (SELECT 1 )`. But I still don't understand why `CARDINALITY` 
arguments should be wrapped in case expression ?
   ```
   CARDINALITY(ARRAY[false, true, a.attidentity = 'a'])
   ```
   In my understanding only CARDINALITY should be wrapped to caseExpression



-- 
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] dssysolyatin commented on a diff in pull request #2929: [CALCITE-5310] JSON_OBJECT in scalar sub-query throws AssertionError

2022-11-11 Thread GitBox


dssysolyatin commented on code in PR #2929:
URL: https://github.com/apache/calcite/pull/2929#discussion_r1020099005


##
core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java:
##
@@ -1790,10 +1790,11 @@ private RexNode createCaseExpression(
 
 @Override public RexNode visitLiteral(RexLiteral literal) {
   // Use nullIndicator to decide whether to project null.
-  // Do nothing if the literal is null.
+  // Do nothing if the literal is null or symbol.
   if (!RexUtil.isNull(literal)

Review Comment:
   Do I understand correctly that if I have query like:
   ```
   SELECT (SELECT CARDINALITY(ARRAY[false, true, a.attidentity = 'a']) FROM 
UNNEST(ARRAY[1]) as v) as options
   FROM UNNEST(ARRAY['a', 'b']) AS a(attidentity);
   ```
   RelDecorrelator will try to wrap true and false into case expression ?
   
   Another question. why do we need to wrap literals into case expression at 
all ?



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