rubenada commented on code in PR #3390:
URL: https://github.com/apache/calcite/pull/3390#discussion_r1346986432
##########
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:
Certainly I can't imagine a scenario where that equality won't hold (if the
`Pair#zip` behaves as it should), but the assertion doesn't hurt (and
assertions can be disabled anyway), so I'm not against having 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]