Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4795

In class SqlBasicCall, make the "operands" field private

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.29.0
    • None
    • None

    Description

      In class SqlBasicCall, the operands field 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.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            julianhyde Julian Hyde
            julianhyde Julian Hyde
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment