Repository: apache/flink
File: flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/SqlCall.java (Java)

Code before:
import org.apache.calcite.sql.validate.SqlValidator;
import org.apache.calcite.sql.validate.SqlValidatorImpl;
import org.apache.calcite.sql.validate.SqlValidatorScope;
import org.apache.calcite.util.Litmus;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.dataflow.qual.Pure;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;

import static org.apache.calcite.linq4j.Nullness.castNonNull;

/**
 * A <code>SqlCall</code> is a call to an {@link SqlOperator operator}. (Operators can be used to
 * describe any syntactic construct, so in practice, every non-leaf node in a SQL parse tree is a
 * <code>SqlCall</code> of some kind.)
 *
 * <p>The class was copied over because of CALCITE-6944, in order to align {@link
 * SqlNode#toSqlString} with SQL std for Table Args in PTF. Line 132 in {@link #unparse(SqlWriter,
 * int, int)} and new method {@link #needsParentheses(SqlWriter, int, int)}.
 */
public abstract class SqlCall extends SqlNode {
    // ~ Constructors -----------------------------------------------------------

    protected SqlCall(SqlParserPos pos) {
        super(pos);
    }

    // ~ Methods ----------------------------------------------------------------

    /**
     * Whether this call was created by expanding a parentheses-free call to what was syntactically
     * an identifier.
     */
    public boolean isExpanded() {
        return false;
    }

    /**
     * Changes the value of an operand. Allows some rewrite by {@link SqlValidator}; use sparingly.
     *
     * @param i Operand index
     * @param operand Operand value
     */
    public void setOperand(int i, @Nullable SqlNode operand) {
        throw new UnsupportedOperationException();
    }

    @Override

Review comment (suggestion):
can you please add comments like `// FLINK MODIFICATION BEGIN/END` as in other classes from Calcite

also since recently Calcite dependency was updated to 1.36 can you please rebase and probably update the class to be sure all the tests still able to pass

Code after:
import org.apache.calcite.sql.validate.SqlValidator;
import org.apache.calcite.sql.validate.SqlValidatorImpl;
import org.apache.calcite.sql.validate.SqlValidatorScope;
import org.apache.calcite.util.Litmus;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.dataflow.qual.Pure;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;

import static org.apache.calcite.linq4j.Nullness.castNonNull;

/**
 * A <code>SqlCall</code> is a call to an {@link SqlOperator operator}. (Operators can be used to
 * describe any syntactic construct, so in practice, every non-leaf node in a SQL parse tree is a
 * <code>SqlCall</code> of some kind.)
 *
 * <p>FLINK modifications are at lines
 *
 * <ol>
 *   <li>Should be removed after fixing CALCITE-6944 (Calcite 1.40.0): Lines 121-139
 * </ol>
 */
public abstract class SqlCall extends SqlNode {
    // ~ Constructors -----------------------------------------------------------

    protected SqlCall(SqlParserPos pos) {
        super(pos);
    }

    // ~ Methods ----------------------------------------------------------------

    /**
     * Whether this call was created by expanding a parentheses-free call to what was syntactically
     * an identifier.
     */
    public boolean isExpanded() {
        return false;
    }

    /**
     * Changes the value of an operand. Allows some rewrite by {@link SqlValidator}; use sparingly.
     *
     * @param i Operand index
     * @param operand Operand value
     */
    public void setOperand(int i, @Nullable SqlNode operand) {
        throw new UnsupportedOperationException();
    }