rubenada commented on code in PR #4500:
URL: https://github.com/apache/calcite/pull/4500#discussion_r2290297707


##########
core/src/main/java/org/apache/calcite/rel/rules/ReduceExpressionsRule.java:
##########
@@ -1151,10 +1151,11 @@ private void analyzeCall(RexCall call, Constancy 
callConstancy) {
       // the operands are constants, we still want to reduce those
       if ((callConstancy == Constancy.REDUCIBLE_CONSTANT)
           && (call.getOperator() instanceof SqlRowOperator)) {
-        callConstancy = Constancy.NON_CONSTANT;
+        // Consider Row call as kind of "struct literal"
+        callConstancy = Constancy.IRREDUCIBLE_CONSTANT;

Review Comment:
   Actually, the main issue seemed that RexBuilder#makeLiteral was failing when 
trying to process a ROW (because it's receiving the values in an Object[] and 
the code was casting into a List), so the whole constant reduction (including 
other expressions that didn't fail) were aborted. I think that was the reason 
why SqlRowOperator is having this special treatment in here. However, I have 
the impression that we can remove this special treatment if we adjust the 
makeLiteral code to make ROW case more robust, using `SqlStdOperatorTable.ROW` 
operator (as it happens on other cases like MAP, ARRAY, MULTISET). 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to