Julian Hyde created CALCITE-4795: ------------------------------------ Summary: In class SqlBasicCall, make the "operands" field private. Key: CALCITE-4795 URL: https://issues.apache.org/jira/browse/CALCITE-4795 Project: Calcite Issue Type: Bug Reporter: Julian Hyde
In {{class SqlBasicCall}}, the {{operands}} [field|https://github.com/apache/calcite/blob/4bc916619fd286b2c0cc4d5c653c96a68801d74e/core/src/main/java/org/apache/calcite/sql/SqlBasicCall.java#L34] is a {{public}} array. This seems crazy to me – any client might be writing into that field at any time. I propose to make the field private. This presents some compatibility problems, because people might be depending on the field. So I propose a quick deprecation and removal: * In release 1.28 (the next release, as I write this) the field and the {{public SqlNode[] getOperands()}} method will be marked deprecated. We will mirror into another field, {{private final List<SqlNode> operandList = Arrays.asList(operands);}} We can replace all uses of the {{operands}} field in Calcite with uses of the new {{operandList}} field. * In release 1.29 (the release after next) the {{operands}} field and the {{getOperands()}} method will be removed. People can operate using {{List<SqlNode> getOperandList()}} and {{setOperand(int, SqlNode)}} methods that are inherited from {{SqlCall}}. After the field is a private list, we could consider making it an immutable list. The list would be copied when people call {{setOperand}}, but would not need to be cloned when the {{SqlBasicCall}} is created or cloned. This case completes the work started in CALCITE-147. -- This message was sent by Atlassian Jira (v8.3.4#803005)