org.eigenbase.sql
Class SqlOperatorBinding

java.lang.Object
  extended by org.eigenbase.sql.SqlOperatorBinding
Direct Known Subclasses:
AggregateRelBase.AggCallBinding, ExplicitOperatorBinding, RexCallBinding, SqlCallBinding

public abstract class SqlOperatorBinding
extends Object

SqlOperatorBinding represents the binding of an SqlOperator to actual operands, along with any additional information required to validate those operands if needed.

Since:
Dec 16, 2004
Version:
$Id: //open/dev/farrago/src/org/eigenbase/sql/SqlOperatorBinding.java#12 $
Author:
Wael Chatila

Field Summary
private  SqlOperator sqlOperator
           
protected  RelDataTypeFactory typeFactory
           
 
Constructor Summary
protected SqlOperatorBinding(RelDataTypeFactory typeFactory, SqlOperator sqlOperator)
          Creates a SqlOperatorBinding.
 
Method Summary
 RelDataType[] collectOperandTypes()
          Collects the types of the bound operands into an array.
 String getColumnListParamInfo(int ordinal, String paramName, List<String> columnList)
          Retrieves information about a column list parameter.
 RelDataType getCursorOperand(int ordinal)
          Returns the rowtype of the ordinalth operand, which is a cursor.
 int getIntLiteralOperand(int ordinal)
          Gets the integer value of a numeric literal operand.
abstract  int getOperandCount()
           
abstract  RelDataType getOperandType(int ordinal)
          Gets the type of a bound operand.
 SqlOperator getOperator()
           
 String getStringLiteralOperand(int ordinal)
          Gets the string value of a string literal operand.
 RelDataTypeFactory getTypeFactory()
           
 boolean isOperandNull(int ordinal, boolean allowCast)
          Determines whether a bound operand is NULL.
abstract  EigenbaseException newError(SqlValidatorException e)
          Wraps a validation error with context appropriate to this operator call.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

typeFactory

protected final RelDataTypeFactory typeFactory

sqlOperator

private final SqlOperator sqlOperator
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

getOperator

public SqlOperator getOperator()
Returns:
bound operator

getTypeFactory

public RelDataTypeFactory getTypeFactory()
Returns:
factory for type creation

getStringLiteralOperand

public String getStringLiteralOperand(int ordinal)
Gets the string value of a string literal operand.

Parameters:
ordinal - zero-based ordinal of operand of interest
Returns:
string value

getIntLiteralOperand

public int getIntLiteralOperand(int ordinal)
Gets the integer value of a numeric literal operand.

Parameters:
ordinal - zero-based ordinal of operand of interest
Returns:
integer value

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

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

collectOperandTypes

public RelDataType[] collectOperandTypes()
Collects the types of the bound operands into an array.

Returns:
collected array

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 String getColumnListParamInfo(int ordinal,
                                     String paramName,
                                     List<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 EigenbaseException newError(SqlValidatorException e)
Wraps a validation error with context appropriate to this operator call.

Parameters:
e - Validation error
Returns:
Error wrapped, if possible, with positional information
"Precondition:"
node != null
"Postcondition:"
return != null