org.eigenbase.sql.fun
Class SqlMultisetQueryConstructor

java.lang.Object
  extended by org.eigenbase.sql.SqlOperator
      extended by org.eigenbase.sql.SqlSpecialOperator
          extended by org.eigenbase.sql.fun.SqlMultisetQueryConstructor

public class SqlMultisetQueryConstructor
extends SqlSpecialOperator

Definition of the SQL:2003 standard MULTISET query constructor, MULTISET (<query>).

Since:
Oct 17, 2004
Version:
$Id: //open/dev/farrago/src/org/eigenbase/sql/fun/SqlMultisetQueryConstructor.java#8 $
Author:
Wael Chatila
See Also:
SqlMultisetValueConstructor

Field Summary
 
Fields inherited from class org.eigenbase.sql.SqlOperator
MaxPrec, NL
 
Constructor Summary
SqlMultisetQueryConstructor()
           
 
Method Summary
 boolean argumentMustBeScalar(int ordinal)
          Returns whether the ordinalth argument to this operator must be scalar (as opposed to a query).
 boolean checkOperandTypes(SqlCallBinding callBinding, boolean throwOnFailure)
          Checks that the operand values in a SqlCall to this operator are valid.
 RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call)
          Derives the type of a call to this operator.
private  RelDataType getComponentType(RelDataTypeFactory typeFactory, RelDataType[] argTypes)
           
 RelDataType inferReturnType(SqlOperatorBinding opBinding)
          Infers the return type of an invocation of this operator; only called after the number and types of operands have already been validated.
 void unparse(SqlWriter writer, SqlNode[] operands, int leftPrec, int rightPrec)
          Writes a SQL representation of a call to this operator to a writer, including parentheses if the operators on either side are of greater precedence.
 
Methods inherited from class org.eigenbase.sql.SqlSpecialOperator
getSyntax, reduceExpr
 
Methods inherited from class org.eigenbase.sql.SqlOperator
acceptCall, acceptCall, adjustType, checkOperandCount, createCall, createCall, createCall, createCall, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getName, getOperandCountRange, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSignatureTemplate, hashCode, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isName, leftPrec, preValidateCall, requiresDecimalExpansion, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateCall, validateOperands
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SqlMultisetQueryConstructor

public SqlMultisetQueryConstructor()
Method Detail

inferReturnType

public RelDataType inferReturnType(SqlOperatorBinding opBinding)
Description copied from class: SqlOperator
Infers the return type of an invocation of this operator; only called after the number and types of operands have already been validated. Subclasses must either override this method or supply an instance of SqlReturnTypeInference to the constructor.

Overrides:
inferReturnType in class SqlOperator
Parameters:
opBinding - description of invocation (not necessarily a SqlCall)
Returns:
inferred return type

getComponentType

private RelDataType getComponentType(RelDataTypeFactory typeFactory,
                                     RelDataType[] argTypes)

checkOperandTypes

public boolean checkOperandTypes(SqlCallBinding callBinding,
                                 boolean throwOnFailure)
Description copied from class: SqlOperator
Checks that the operand values in a SqlCall to this operator are valid. Subclasses must either override this method or supply an instance of SqlOperandTypeChecker to the constructor.

Overrides:
checkOperandTypes in class SqlOperator
Parameters:
callBinding - description of call
throwOnFailure - whether to throw an exception if check fails (otherwise returns false in that case)
Returns:
whether check succeeded

deriveType

public RelDataType deriveType(SqlValidator validator,
                              SqlValidatorScope scope,
                              SqlCall call)
Description copied from class: SqlOperator
Derives the type of a call to this operator.

This method is an intrinsic part of the validation process so, unlike SqlOperator.inferReturnType(org.eigenbase.sql.SqlOperatorBinding), specific operators would not typically override this method.

Overrides:
deriveType in class SqlOperator
Parameters:
validator - Validator
scope - Scope of validation
call - Call to this operator
Returns:
Type of call

unparse

public void unparse(SqlWriter writer,
                    SqlNode[] operands,
                    int leftPrec,
                    int rightPrec)
Description copied from class: SqlOperator
Writes a SQL representation of a call to this operator to a writer, including parentheses if the operators on either side are of greater precedence.

The default implementation of this method delegates to SqlSyntax.unparse(org.eigenbase.sql.SqlWriter, org.eigenbase.sql.SqlOperator, org.eigenbase.sql.SqlNode[], int, int).

Overrides:
unparse in class SqlSpecialOperator

argumentMustBeScalar

public boolean argumentMustBeScalar(int ordinal)
Description copied from class: SqlOperator
Returns whether the ordinalth argument to this operator must be scalar (as opposed to a query).

If true (the default), the validator will attempt to convert the argument into a scalar subquery, which must have one column and return at most one row.

Operators such as SELECT and EXISTS override this method.

Overrides:
argumentMustBeScalar in class SqlOperator