Class SqlOperatorBinding

    • Constructor Detail

      • SqlOperatorBinding

        protected SqlOperatorBinding​(RelDataTypeFactory typeFactory,
                                     SqlOperator sqlOperator)
        Creates a SqlOperatorBinding.
        Parameters:
        typeFactory - Type factory
        sqlOperator - Operator which is subject of this call
    • Method Detail

      • getGroupCount

        public int getGroupCount()
        If the operator call occurs in an aggregate query, returns the number of columns in the GROUP BY clause. For example, for "SELECT count(*) FROM emp GROUP BY deptno, gender", returns 2.

        Returns 0 if the query is implicitly "GROUP BY ()" because of an aggregate expression. For example, "SELECT sum(sal) FROM emp".

        Returns -1 if the query is not an aggregate query.

      • hasFilter

        public boolean hasFilter()
        Returns whether the operator is an aggregate function with a filter.
      • getOperator

        public SqlOperator getOperator()
        Returns:
        bound operator
      • getTypeFactory

        public RelDataTypeFactory getTypeFactory()
        Returns:
        factory for type creation
      • getStringLiteralOperand

        @Deprecated
        public java.lang.String getStringLiteralOperand​(int ordinal)
        Deprecated.
        Gets the string value of a string literal operand.
        Parameters:
        ordinal - zero-based ordinal of operand of interest
        Returns:
        string value
      • getIntLiteralOperand

        @Deprecated
        public int getIntLiteralOperand​(int ordinal)
        Deprecated.
        Gets the integer value of a numeric literal operand.
        Parameters:
        ordinal - zero-based ordinal of operand of interest
        Returns:
        integer value
      • getOperandLiteralValue

        public <T> T getOperandLiteralValue​(int ordinal,
                                            java.lang.Class<T> clazz)
        Gets the value of a literal operand.

        Cases:

        • If the operand is not a literal, the value is null.
        • If the operand is a string literal, the value will be of type NlsString.
        • If the operand is a numeric literal, the value will be of type BigDecimal.
        • If the operand is an interval qualifier, the value will be of type SqlIntervalQualifier
        • Otherwise the type is undefined, and the value may be null.
        Parameters:
        ordinal - zero-based ordinal of operand of interest
        clazz - Desired valued type
        Returns:
        value of operand
      • getOperandLiteralValue

        @Deprecated
        public java.lang.Comparable getOperandLiteralValue​(int ordinal)
        Deprecated.
      • isOperandNull

        public boolean isOperandNull​(int ordinal,
                                     boolean allowCast)
        Determines whether a bound operand is NULL.

        This is only relevant for SQL validation.

        Parameters:
        ordinal - zero-based ordinal of operand of interest
        allowCast - whether to regard CAST(constant) as a constant
        Returns:
        whether operand is null; false for everything except SQL validation
      • isOperandLiteral

        public boolean isOperandLiteral​(int ordinal,
                                        boolean allowCast)
        Determines whether an operand is a literal.
        Parameters:
        ordinal - zero-based ordinal of operand of interest
        allowCast - whether to regard CAST(literal) as a literal
        Returns:
        whether operand is literal
      • getOperandCount

        public abstract int getOperandCount()
        Returns:
        the number of bound operands
      • getOperandType

        public abstract RelDataType getOperandType​(int ordinal)
        Gets the type of a bound operand.
        Parameters:
        ordinal - zero-based ordinal of operand of interest
        Returns:
        bound operand type
      • getOperandMonotonicity

        public SqlMonotonicity getOperandMonotonicity​(int ordinal)
        Gets the monotonicity of a bound operand.
        Parameters:
        ordinal - zero-based ordinal of operand of interest
        Returns:
        monotonicity of operand
      • collectOperandTypes

        public java.util.List<RelDataType> collectOperandTypes()
        Collects the types of the bound operands into a list.
        Returns:
        collected list
      • getCursorOperand

        public RelDataType getCursorOperand​(int ordinal)
        Returns the rowtype of the ordinalth operand, which is a cursor.

        This is only implemented for SqlCallBinding.

        Parameters:
        ordinal - Ordinal of the operand
        Returns:
        Rowtype of the query underlying the cursor
      • getColumnListParamInfo

        public java.lang.String getColumnListParamInfo​(int ordinal,
                                                       java.lang.String paramName,
                                                       java.util.List<java.lang.String> columnList)
        Retrieves information about a column list parameter.
        Parameters:
        ordinal - ordinal position of the column list parameter
        paramName - name of the column list parameter
        columnList - returns a list of the column names that are referenced in the column list parameter
        Returns:
        the name of the parent cursor referenced by the column list parameter if it is a column list parameter; otherwise, null is returned
      • newError

        public abstract CalciteException newError​(Resources.ExInst<SqlValidatorException> e)
        Wraps a validation error with context appropriate to this operator call.
        Parameters:
        e - Validation error, not null
        Returns:
        Error wrapped, if possible, with positional information