You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "JiajunBernoulli (via GitHub)" <gi...@apache.org> on 2023/09/12 02:06:46 UTC

[GitHub] [calcite] JiajunBernoulli commented on a diff in pull request #3390: [CALCITE-5949] RexExecutable should return unchanged original expressions when it fails

JiajunBernoulli commented on code in PR #3390:
URL: https://github.com/apache/calcite/pull/3390#discussion_r1322277382


##########
core/src/main/java/org/apache/calcite/rex/RexExecutable.java:
##########
@@ -87,11 +88,14 @@ public void reduce(RexBuilder rexBuilder, List<RexNode> constExps,
         values = new Object[constExps.size()];
       } else {
         assert values.length == constExps.size();
+        final List<RexNode> successfullyReduced = new ArrayList<>();
         final List<@Nullable Object> valueList = Arrays.asList(values);
         for (Pair<RexNode, @Nullable Object> value : Pair.zip(constExps, valueList)) {
-          reducedValues.add(
+          successfullyReduced.add(
               rexBuilder.makeLiteral(value.right, value.left.getType(), true));
         }
+        assert successfullyReduced.size() == constExps.size();

Review Comment:
   `values.length == constExps.size();` and `successfullyReduced.size() == values.length`.
   
   Should we need `assert successfullyReduced.size() == constExps.size();`?



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