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

[PR] [CALCITE-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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

   Ref https://issues.apache.org/jira/browse/CALCITE-7197


-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/test/resources/sql/conditions.iq:
##########
@@ -547,4 +547,21 @@ where 5 < cast(deptno as integer) OR 5 >= cast(deptno as integer) OR deptno IS N
 EnumerableTableScan(table=[[scott, EMP]])
 !plan
 
+!use scott
+
+# Test case for [CALCITE-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression
+select *
+from "scott".emp
+where row(empno, ename) in ((7782, 'CLARK'), (7902, 'FORD'), (7839, 'KING'));
++-------+-------+-----------+------+------------+---------+------+--------+

Review Comment:
   Yes, I have added testSelectWithPlaceholdersInRowExpression to JDBCTest to test dynamic parameters. Of course, it would be better if QuidemTest can support dynamic parameters.



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml:
##########
@@ -19738,15 +19729,9 @@ LogicalProject(A=[$0], Y=[$1])
       LogicalUnion(all=[true])
         LogicalProject(EXPR$0=[1], EXPR$1=[2])
           LogicalValues(tuples=[[{ 0 }]])
-        LogicalProject(EXPR$0=[3], EXPR$1=[null:INTEGER])
-          LogicalValues(tuples=[[{ 0 }]])
-        LogicalProject(EXPR$0=[7369], EXPR$1=[null:INTEGER])
-          LogicalValues(tuples=[[{ 0 }]])
         LogicalProject(EXPR$0=[null:INTEGER], EXPR$1=[20])
           LogicalValues(tuples=[[{ 0 }]])
-        LogicalProject(EXPR$0=[null:INTEGER], EXPR$1=[5])
-          LogicalValues(tuples=[[{ 0 }]])
-        LogicalValues(tuples=[[{ 7499, 30 }]])
+        LogicalValues(tuples=[[{ 3, null }, { 7369, null }, { 7499, 30 }, { null, 5 }]])

Review Comment:
   I have a question: why aren't all the Rows merged into a single Values here, unlike other test cases? Additionally, why is the order of Rows in other Values different from before?



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -2204,6 +2208,25 @@ protected void inferUnknownTypes(
     }
   }
 
+  private boolean isRowSqlNodeList(final RelDataType inferredType, final SqlNodeList nodeList) {
+    return inferredType.isStruct() && !nodeList.isEmpty()
+        && SqlKind.ROW == nodeList.get(0).getKind();

Review Comment:
   Also, I have one more question, you return from the function if at least one element of kind `SqlKind.ROW`, but what about the other elements that might not be of kind `SqlKind.ROW`?
   
   ```java
         if (isRowSqlNodeList(inferredType, nodeList)) {
           inferRowSqlNodeList(inferredType, scope, nodeList);
           return; <-- why we return here
         }
   ```
   Why do we return and skip the rest of the logic at the end?



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -2204,6 +2208,25 @@ protected void inferUnknownTypes(
     }
   }
 
+  private boolean isRowSqlNodeList(final RelDataType inferredType, final SqlNodeList nodeList) {
+    return inferredType.isStruct() && !nodeList.isEmpty()
+        && SqlKind.ROW == nodeList.get(0).getKind();

Review Comment:
   Also, I have one more question, you return from the function if at least one element can be inferred, but what about the other elements that might not be of kind `SqlKind.ROW`?
   Why do we return and skip the rest of the logic at the end?



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/test/resources/sql/conditions.iq:
##########
@@ -547,4 +547,21 @@ where 5 < cast(deptno as integer) OR 5 >= cast(deptno as integer) OR deptno IS N
 EnumerableTableScan(table=[[scott, EMP]])
 !plan
 
+!use scott
+
+# Test case for [CALCITE-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression
+select *
+from "scott".emp
+where row(empno, ename) in ((7782, 'CLARK'), (7902, 'FORD'), (7839, 'KING'));
++-------+-------+-----------+------+------------+---------+------+--------+

Review Comment:
   It's fine. But it would be better to have a case with dynamic parameters. It may not necessarily be in QuidemTest, or we can also make QuidemTest support dynamic parameters (maybe another topic).



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -2204,6 +2208,25 @@ protected void inferUnknownTypes(
     }
   }
 
+  private boolean isRowSqlNodeList(final RelDataType inferredType, final SqlNodeList nodeList) {
+    return inferredType.isStruct() && !nodeList.isEmpty()
+        && SqlKind.ROW == nodeList.get(0).getKind();

Review Comment:
   The main point of my comment is that checking only the first element isn’t enough (for example, the first element could be a function that returns a ROW, and the second could be a ROW constructor). The query I mentioned is definitely a separate issue, thanks for creating jira ticket!
   
   Now, you have two `for` loops that can be merged into one function `inferRowSqlNodeList`
   ```java
    private void inferRowSqlNodeList(final RelDataType inferredType,
     final SqlValidatorScope scope, final SqlNodeList nodeList) {
     if (!inferredType.isStruct()) {
       return false;
     }
   
     for (SqlNode child: nodeList) {
       if (child instanceof SqlBasicCall && SqlKind.ROW == sqlNode.getKind()) {
         List <SqlNode> operands = ((SqlBasicCall) child).getOperandList();
         for (int index = 0; index < operands.size(); index++) {
           RelDataType type = inferredType.getFieldList().get(index).getType();
           inferUnknownTypes(type, scope, operands.get(index));
         }
       }
     }
   }
     ```
   



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/test/resources/sql/conditions.iq:
##########
@@ -547,4 +547,21 @@ where 5 < cast(deptno as integer) OR 5 >= cast(deptno as integer) OR deptno IS N
 EnumerableTableScan(table=[[scott, EMP]])
 !plan
 
+!use scott
+
+# Test case for [CALCITE-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression
+select *
+from "scott".emp
+where row(empno, ename) in ((7782, 'CLARK'), (7902, 'FORD'), (7839, 'KING'));
++-------+-------+-----------+------+------------+---------+------+--------+

Review Comment:
   Since QuidemTest does not support SQL statements containing dynamic parameters, this case is added to cover scenarios where literals are included in ROW expressions.



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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

   This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 90 days if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@calcite.apache.org list. Thank you for your contributions.


-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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

   This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 90 days if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@calcite.apache.org list. Thank you for your contributions.


-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/test/resources/sql/conditions.iq:
##########
@@ -547,4 +547,21 @@ where 5 < cast(deptno as integer) OR 5 >= cast(deptno as integer) OR deptno IS N
 EnumerableTableScan(table=[[scott, EMP]])
 !plan
 
+!use scott
+
+# Test case for [CALCITE-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression
+select *
+from "scott".emp
+where row(empno, ename) in ((7782, 'CLARK'), (7902, 'FORD'), (7839, 'KING'));
++-------+-------+-----------+------+------------+---------+------+--------+

Review Comment:
   Will there be an error if a literal value is included in `ROW`? I don't know if it is still allowed to add tests in `JdbcTest`.



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -2204,6 +2208,25 @@ protected void inferUnknownTypes(
     }
   }
 
+  private boolean isRowSqlNodeList(final RelDataType inferredType, final SqlNodeList nodeList) {
+    return inferredType.isStruct() && !nodeList.isEmpty()
+        && SqlKind.ROW == nodeList.get(0).getKind();

Review Comment:
   This is because in a ROW Expression, the values ​​on the right must be of the ROW type (or the ROW reference type in PostgreSQL). These values ​​will have their type inferred in the isRowSqlNodeList method, so the method returns directly after processing.



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml:
##########
@@ -19698,16 +19698,7 @@ LogicalProject(A=[$0], Y=[$1])
     LogicalProject(EXPR$0=[$0], EXPR$1=[$1])
       LogicalValues(tuples=[[{ 1, 2 }, { 3, null }, { 7369, null }, { 7499, 30 }, { null, 20 }, { null, 5 }]])
     LogicalAggregate(group=[{0, 1}])
-      LogicalUnion(all=[true])
-        LogicalProject(EXPR$0=[3], EXPR$1=[null:INTEGER])
-          LogicalValues(tuples=[[{ 0 }]])
-        LogicalProject(EXPR$0=[7369], EXPR$1=[null:INTEGER])
-          LogicalValues(tuples=[[{ 0 }]])
-        LogicalProject(EXPR$0=[null:INTEGER], EXPR$1=[20])
-          LogicalValues(tuples=[[{ 0 }]])
-        LogicalProject(EXPR$0=[null:INTEGER], EXPR$1=[5])
-          LogicalValues(tuples=[[{ 0 }]])
-        LogicalValues(tuples=[[{ 1, 2 }, { 7499, 30 }]])
+      LogicalValues(tuples=[[{ 1, 2 }, { 3, null }, { 7369, null }, { 7499, 30 }, { null, 20 }, { null, 5 }]])

Review Comment:
   Yes, this change is due to the additional validation logic for ROW expressions, which allows the type of the item in each ROW expression to be inferred, avoiding additional type conversions.



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -2204,6 +2208,25 @@ protected void inferUnknownTypes(
     }
   }
 
+  private boolean isRowSqlNodeList(final RelDataType inferredType, final SqlNodeList nodeList) {
+    return inferredType.isStruct() && !nodeList.isEmpty()
+        && SqlKind.ROW == nodeList.get(0).getKind();

Review Comment:
   The main point of my comment is that checking only the first element isn’t enough (for example, the first element could be a function that returns a `ROW`, and the second could be a `ROW` constructor). The query I mentioned is definitely a separate issue, thanks for creating jira ticket!
   
   Now, you have two `for` loops that can be merged into one function `inferRowSqlNodeList`
   ```java
    private Boolean inferRowSqlNodeList(final RelDataType inferredType,
     final SqlValidatorScope scope, final SqlNodeList nodeList) {
     if (!inferredType.isStruct()) {
       return false;
     }
     
     Boolean inferred = false;
     for (SqlNode child: nodeList) {
       if (child instanceof SqlBasicCall && SqlKind.ROW == sqlNode.getKind()) {
         List <SqlNode> operands = ((SqlBasicCall) child).getOperandList();
         for (int index = 0; index < operands.size(); index++) {
           RelDataType type = inferredType.getFieldList().get(index).getType();
           inferUnknownTypes(type, scope, operands.get(index));
         }
         inferred = true
       }
     }
     return inferred;
   }
     ```
   



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -2204,6 +2208,25 @@ protected void inferUnknownTypes(
     }
   }
 
+  private boolean isRowSqlNodeList(final RelDataType inferredType, final SqlNodeList nodeList) {
+    return inferredType.isStruct() && !nodeList.isEmpty()
+        && SqlKind.ROW == nodeList.get(0).getKind();

Review Comment:
   Here is the jira link - https://issues.apache.org/jira/browse/CALCITE-7229



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/test/resources/sql/conditions.iq:
##########
@@ -547,4 +547,21 @@ where 5 < cast(deptno as integer) OR 5 >= cast(deptno as integer) OR deptno IS N
 EnumerableTableScan(table=[[scott, EMP]])
 !plan
 
+!use scott
+
+# Test case for [CALCITE-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression
+select *
+from "scott".emp
+where row(empno, ename) in ((7782, 'CLARK'), (7902, 'FORD'), (7839, 'KING'));
++-------+-------+-----------+------+------------+---------+------+--------+

Review Comment:
   Before this PR, including literals in ROW worked fine, but there were no tests covering this scenario. Considering that this PR modifies the validate logic, adding such a test will help with the regression of row literals scenarios.



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/test/resources/sql/conditions.iq:
##########
@@ -547,4 +547,21 @@ where 5 < cast(deptno as integer) OR 5 >= cast(deptno as integer) OR deptno IS N
 EnumerableTableScan(table=[[scott, EMP]])
 !plan
 
+!use scott
+
+# Test case for [CALCITE-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression
+select *
+from "scott".emp
+where row(empno, ename) in ((7782, 'CLARK'), (7902, 'FORD'), (7839, 'KING'));
++-------+-------+-----------+------+------------+---------+------+--------+

Review Comment:
   I wonder how this case has to do with dynamic parameters.



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #4553: [CALCITE-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression
URL: https://github.com/apache/calcite/pull/4553


-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -2204,6 +2208,25 @@ protected void inferUnknownTypes(
     }
   }
 
+  private boolean isRowSqlNodeList(final RelDataType inferredType, final SqlNodeList nodeList) {
+    return inferredType.isStruct() && !nodeList.isEmpty()
+        && SqlKind.ROW == nodeList.get(0).getKind();

Review Comment:
   The main point of my comment is that checking only the first element isn’t enough. The query I mentioned is definitely a separate issue, thanks for creating jira ticket!
   
   Now, you have two `for` loops that can be merged into one function `inferRowSqlNodeList`
   ```java
    private void inferRowSqlNodeList(final RelDataType inferredType,
     final SqlValidatorScope scope, final SqlNodeList nodeList) {
     if (!inferredType.isStruct()) {
       return false;
     }
   
     for (SqlNode child: nodeList) {
       if (child instanceof SqlBasicCall && SqlKind.ROW == sqlNode.getKind()) {
         List <SqlNode> operands = ((SqlBasicCall) child).getOperandList();
         for (int index = 0; index < operands.size(); index++) {
           RelDataType type = inferredType.getFieldList().get(index).getType();
           inferUnknownTypes(type, scope, operands.get(index));
         }
       }
     }
   }
     ```
   



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -2204,6 +2208,25 @@ protected void inferUnknownTypes(
     }
   }
 
+  private boolean isRowSqlNodeList(final RelDataType inferredType, final SqlNodeList nodeList) {
+    return inferredType.isStruct() && !nodeList.isEmpty()
+        && SqlKind.ROW == nodeList.get(0).getKind();

Review Comment:
   The main point of my comment is that checking only the first element isn’t enough (for example, the first element could be a function that returns a `ROW`, and the second could be a `ROW` constructor). The query I mentioned is definitely a separate issue, thanks for creating jira ticket!
   
   Now, you have two `for` loops that can be merged into one function `inferRowSqlNodeList`
   ```java
    private void inferRowSqlNodeList(final RelDataType inferredType,
     final SqlValidatorScope scope, final SqlNodeList nodeList) {
     if (!inferredType.isStruct()) {
       return false;
     }
   
     for (SqlNode child: nodeList) {
       if (child instanceof SqlBasicCall && SqlKind.ROW == sqlNode.getKind()) {
         List <SqlNode> operands = ((SqlBasicCall) child).getOperandList();
         for (int index = 0; index < operands.size(); index++) {
           RelDataType type = inferredType.getFieldList().get(index).getType();
           inferUnknownTypes(type, scope, operands.get(index));
         }
       }
     }
   }
     ```
   



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -2204,6 +2207,25 @@ protected void inferUnknownTypes(
     }
   }
 
+  private boolean inferRowSqlNodeList(final RelDataType inferredType,
+      final SqlValidatorScope scope, final SqlNodeList nodeList) {
+    if (!inferredType.isStruct()) {
+      return false;
+    }
+    boolean inferred = false;
+    for (SqlNode child : nodeList) {
+      if (child instanceof SqlBasicCall && SqlKind.ROW == child.getKind()) {

Review Comment:
   There are expressions that evaluate to a ROW type that are not ROW expressions.
   For example, a[1], where a is an array of ROW values.
   



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml:
##########
@@ -19698,16 +19698,7 @@ LogicalProject(A=[$0], Y=[$1])
     LogicalProject(EXPR$0=[$0], EXPR$1=[$1])
       LogicalValues(tuples=[[{ 1, 2 }, { 3, null }, { 7369, null }, { 7499, 30 }, { null, 20 }, { null, 5 }]])
     LogicalAggregate(group=[{0, 1}])
-      LogicalUnion(all=[true])
-        LogicalProject(EXPR$0=[3], EXPR$1=[null:INTEGER])
-          LogicalValues(tuples=[[{ 0 }]])
-        LogicalProject(EXPR$0=[7369], EXPR$1=[null:INTEGER])
-          LogicalValues(tuples=[[{ 0 }]])
-        LogicalProject(EXPR$0=[null:INTEGER], EXPR$1=[20])
-          LogicalValues(tuples=[[{ 0 }]])
-        LogicalProject(EXPR$0=[null:INTEGER], EXPR$1=[5])
-          LogicalValues(tuples=[[{ 0 }]])
-        LogicalValues(tuples=[[{ 1, 2 }, { 7499, 30 }]])
+      LogicalValues(tuples=[[{ 1, 2 }, { 3, null }, { 7369, null }, { 7499, 30 }, { null, 20 }, { null, 5 }]])

Review Comment:
   are these supposed to change?



##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -2204,6 +2208,25 @@ protected void inferUnknownTypes(
     }
   }
 
+  private boolean isRowSqlNodeList(final RelDataType inferredType, final SqlNodeList nodeList) {
+    return inferredType.isStruct() && !nodeList.isEmpty()
+        && SqlKind.ROW == nodeList.get(0).getKind();

Review Comment:
   why is the first element special?



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -2204,6 +2208,25 @@ protected void inferUnknownTypes(
     }
   }
 
+  private boolean isRowSqlNodeList(final RelDataType inferredType, final SqlNodeList nodeList) {
+    return inferredType.isStruct() && !nodeList.isEmpty()
+        && SqlKind.ROW == nodeList.get(0).getKind();

Review Comment:
   Consider a case
   ```sql
   SELECT e.empno,r.r
   FROM emp AS e, LATERAL (SELECT ROW(e.empno, e.ename) AS r) AS r
   WHERE ROW(e.empno, e.ename) IN (
       r.r,
       ROW(?, ?)
   );
   ```
   first argument is no longer `SqlKind.ROW`. I will go through each item in the list separately and check if it is row or something else.



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -2204,6 +2208,25 @@ protected void inferUnknownTypes(
     }
   }
 
+  private boolean isRowSqlNodeList(final RelDataType inferredType, final SqlNodeList nodeList) {
+    return inferredType.isStruct() && !nodeList.isEmpty()
+        && SqlKind.ROW == nodeList.get(0).getKind();

Review Comment:
   Consider a case
   ```sql
   SELECT e.empno,r.r
   FROM emp AS e, LATERAL (SELECT ROW(e.empno, e.ename) AS r) AS r
   WHERE ROW(e.empno, e.ename) IN (
       r.r,
       ROW(?, ?)
   );
   ```
   first argument is no longer `SqlKind.ROW`. I would go through each item in the list separately and check if it is row or something else.



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml:
##########
@@ -19738,15 +19729,9 @@ LogicalProject(A=[$0], Y=[$1])
       LogicalUnion(all=[true])
         LogicalProject(EXPR$0=[1], EXPR$1=[2])
           LogicalValues(tuples=[[{ 0 }]])
-        LogicalProject(EXPR$0=[3], EXPR$1=[null:INTEGER])
-          LogicalValues(tuples=[[{ 0 }]])
-        LogicalProject(EXPR$0=[7369], EXPR$1=[null:INTEGER])
-          LogicalValues(tuples=[[{ 0 }]])
         LogicalProject(EXPR$0=[null:INTEGER], EXPR$1=[20])
           LogicalValues(tuples=[[{ 0 }]])
-        LogicalProject(EXPR$0=[null:INTEGER], EXPR$1=[5])
-          LogicalValues(tuples=[[{ 0 }]])
-        LogicalValues(tuples=[[{ 7499, 30 }]])
+        LogicalValues(tuples=[[{ 3, null }, { 7369, null }, { 7499, 30 }, { null, 5 }]])

Review Comment:
   The order of the values ​​in LogicalValues ​​changes because the UnionToValuesRule processes them in the order of their inputs. In this case, the order of the planBefore LogicalUnion inputs changes, so the order changes after the UnionToValuesRule processes them.



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml:
##########
@@ -19755,7 +19740,7 @@ LogicalProject(A=[$0], Y=[$1])
   LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[inner])
     LogicalValues(tuples=[[{ 1, 2 }, { 3, null }, { 7369, null }, { 7499, 30 }, { null, 20 }, { null, 5 }]])
     LogicalAggregate(group=[{0, 1}])
-      LogicalValues(tuples=[[{ 1, 2 }, { 3, null }, { 7369, null }, { null, 20 }, { null, 5 }, { 7499, 30 }]])
+      LogicalValues(tuples=[[{ 1, 2 }, { null, 20 }, { 3, null }, { 7369, null }, { 7499, 30 }, { null, 5 }]])

Review Comment:
   Maybe what I want to ask is this—why has the order changed here? Is this necessary?



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -2204,6 +2207,25 @@ protected void inferUnknownTypes(
     }
   }
 
+  private boolean inferRowSqlNodeList(final RelDataType inferredType,
+      final SqlValidatorScope scope, final SqlNodeList nodeList) {
+    if (!inferredType.isStruct()) {
+      return false;
+    }
+    boolean inferred = false;
+    for (SqlNode child : nodeList) {
+      if (child instanceof SqlBasicCall && SqlKind.ROW == child.getKind()) {

Review Comment:
   Thanks for bringing this up, I might not have considered it before. Can you give a sql example? I will continue to analyze the possible problems in this scenario.



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -2204,6 +2207,25 @@ protected void inferUnknownTypes(
     }
   }
 
+  private boolean inferRowSqlNodeList(final RelDataType inferredType,
+      final SqlValidatorScope scope, final SqlNodeList nodeList) {
+    if (!inferredType.isStruct()) {
+      return false;
+    }
+    boolean inferred = false;
+    for (SqlNode child : nodeList) {
+      if (child instanceof SqlBasicCall && SqlKind.ROW == child.getKind()) {

Review Comment:
   See https://issues.apache.org/jira/browse/CALCITE-7231 for an example



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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

   This pull request has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.


-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -2204,6 +2208,25 @@ protected void inferUnknownTypes(
     }
   }
 
+  private boolean isRowSqlNodeList(final RelDataType inferredType, final SqlNodeList nodeList) {
+    return inferredType.isStruct() && !nodeList.isEmpty()
+        && SqlKind.ROW == nodeList.get(0).getKind();

Review Comment:
   Thanks for your feedback, I will consider this SQL Case.



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml:
##########
@@ -19738,15 +19729,9 @@ LogicalProject(A=[$0], Y=[$1])
       LogicalUnion(all=[true])
         LogicalProject(EXPR$0=[1], EXPR$1=[2])
           LogicalValues(tuples=[[{ 0 }]])
-        LogicalProject(EXPR$0=[3], EXPR$1=[null:INTEGER])
-          LogicalValues(tuples=[[{ 0 }]])
-        LogicalProject(EXPR$0=[7369], EXPR$1=[null:INTEGER])
-          LogicalValues(tuples=[[{ 0 }]])
         LogicalProject(EXPR$0=[null:INTEGER], EXPR$1=[20])
           LogicalValues(tuples=[[{ 0 }]])
-        LogicalProject(EXPR$0=[null:INTEGER], EXPR$1=[5])
-          LogicalValues(tuples=[[{ 0 }]])
-        LogicalValues(tuples=[[{ 7499, 30 }]])
+        LogicalValues(tuples=[[{ 3, null }, { 7369, null }, { 7499, 30 }, { null, 5 }]])

Review Comment:
   I looked at the code and found that the SqlToRelConverter#convertRowValues ​​method merges RexLiteral into LogicalValues. In this case, the values ​​that cannot be converted to LogicalValues ​​are `(cast(1.1 as int), 2)` and `(null, cast(20.2 as int))`, which have type conversion.



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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

   ## [![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=4553) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4553&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=4553&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=4553&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=4553&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=4553&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4553)
   
   


-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml:
##########
@@ -19755,7 +19740,7 @@ LogicalProject(A=[$0], Y=[$1])
   LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[inner])
     LogicalValues(tuples=[[{ 1, 2 }, { 3, null }, { 7369, null }, { 7499, 30 }, { null, 20 }, { null, 5 }]])
     LogicalAggregate(group=[{0, 1}])
-      LogicalValues(tuples=[[{ 1, 2 }, { 3, null }, { 7369, null }, { null, 20 }, { null, 5 }, { 7499, 30 }]])
+      LogicalValues(tuples=[[{ 1, 2 }, { null, 20 }, { 3, null }, { 7369, null }, { 7499, 30 }, { null, 5 }]])

Review Comment:
   Yes, it's neccessay. This order is generated by the `UnionToValuesRule` rule based on planBefore. For details, see the corresponding relationship in the following figure.
   
   <img width="1832" height="1026" alt="image" src="https://github.com/user-attachments/assets/4984f275-3051-4cf2-a249-0e45ddeb7c15" />
   



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -2204,6 +2208,25 @@ protected void inferUnknownTypes(
     }
   }
 
+  private boolean isRowSqlNodeList(final RelDataType inferredType, final SqlNodeList nodeList) {
+    return inferredType.isStruct() && !nodeList.isEmpty()
+        && SqlKind.ROW == nodeList.get(0).getKind();

Review Comment:
   Hi @mihaibudiu @dssysolyatin, sorry for the late reply. I spent some time to research how to support this SQL.
   
   ```sql
   SELECT e.empno,r.r
   FROM emp AS e, LATERAL (SELECT ROW(e.empno, e.ename) AS r) AS r
   WHERE ROW(e.empno, e.ename) IN (
       r.r,
       ROW(?, ?)
   );
   ```
   
   I found that Calcite currently does not support ROW alias references in many components, including: `TypeCoercionImpl`, `SqlToRelConverter#convertInToOr`, and the join logic generated by Janio. So I plan to log a new Jira to record this SQL related issue and then try to support it.



-- 
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-7197] UnsupportedOperationException when using dynamic parameters inside ROW expression [calcite]

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

   ## [![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=4553) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=4553&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=4553&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=4553&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [93.9% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=4553&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=4553&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=4553)
   
   


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