FrankChen021 commented on code in PR #5283:
URL: https://github.com/apache/calcite/pull/5283#discussion_r4115158424
##########
core/src/main/java/org/apache/calcite/sql/util/SqlShuttle.java:
##########
@@ -100,24 +108,23 @@ public class SqlShuttle extends SqlBasicVisitor<@Nullable
SqlNode> {
*/
protected class CallCopyingArgHandler implements ArgHandler<@Nullable
SqlNode> {
boolean update;
- final @Nullable SqlNode[] clonedOperands;
+ private @Nullable SqlNode @Nullable [] clonedOperands;
private final SqlCall call;
private final boolean alwaysCopy;
public CallCopyingArgHandler(SqlCall call, boolean alwaysCopy) {
this.call = call;
this.update = false;
- final List<@Nullable SqlNode> operands = (List<@Nullable SqlNode>)
call.getOperandList();
- this.clonedOperands = operands.toArray(new SqlNode[0]);
this.alwaysCopy = alwaysCopy;
+ this.clonedOperands = alwaysCopy ? copyOperands(call) : null;
Review Comment:
Applied. `alwaysCopy` now copies operands lazily in `result()` when a new
call is required.
--
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]