org.eigenbase.sql
Class SqlSetOperator

java.lang.Object
  extended by org.eigenbase.sql.SqlOperator
      extended by org.eigenbase.sql.SqlBinaryOperator
          extended by org.eigenbase.sql.SqlSetOperator

public class SqlSetOperator
extends SqlBinaryOperator

SqlSetOperator represents a relational set theory operator (UNION, INTERSECT, MINUS). These are binary operators, but with an extra boolean attribute tacked on for whether to remove duplicates (e.g. UNION ALL does not remove duplicates).

Version:
$Id: //open/dev/farrago/src/org/eigenbase/sql/SqlSetOperator.java#16 $
Author:
John V. Sichi

Field Summary
private  boolean all
           
 
Fields inherited from class org.eigenbase.sql.SqlOperator
MaxPrec, NL
 
Constructor Summary
SqlSetOperator(String name, SqlKind kind, int prec, boolean all)
           
SqlSetOperator(String name, SqlKind kind, int prec, boolean all, SqlReturnTypeInference returnTypeInference, SqlOperandTypeInference operandTypeInference, SqlOperandTypeChecker operandTypeChecker)
           
 
Method Summary
 boolean isAll()
           
 boolean isDistinct()
           
 void validateCall(SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope)
          Validates a call to this operator.
 
Methods inherited from class org.eigenbase.sql.SqlBinaryOperator
adjustType, deriveType, getMonotonicity, getSignatureTemplate, getSyntax, needsSpace
 
Methods inherited from class org.eigenbase.sql.SqlOperator
acceptCall, acceptCall, argumentMustBeScalar, checkOperandCount, checkOperandTypes, createCall, createCall, createCall, createCall, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getName, getOperandCountRange, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, hashCode, inferReturnType, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isName, leftPrec, preValidateCall, requiresDecimalExpansion, rewriteCall, rightPrec, toString, unparse, unparseListClause, unparseListClause, validateOperands
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

all

private final boolean all
Constructor Detail

SqlSetOperator

public SqlSetOperator(String name,
                      SqlKind kind,
                      int prec,
                      boolean all)

SqlSetOperator

public SqlSetOperator(String name,
                      SqlKind kind,
                      int prec,
                      boolean all,
                      SqlReturnTypeInference returnTypeInference,
                      SqlOperandTypeInference operandTypeInference,
                      SqlOperandTypeChecker operandTypeChecker)
Method Detail

isAll

public boolean isAll()

isDistinct

public boolean isDistinct()

validateCall

public void validateCall(SqlCall call,
                         SqlValidator validator,
                         SqlValidatorScope scope,
                         SqlValidatorScope operandScope)
Description copied from class: SqlOperator
Validates a call to this operator.

This method should not perform type-derivation or perform validation related related to types. That is done later, by SqlOperator.deriveType(SqlValidator, SqlValidatorScope, SqlCall). This method should focus on structural validation.

A typical implementation of this method first validates the operands, then performs some operator-specific logic. The default implementation just validates the operands.

This method is the default implementation of SqlCall.validate(org.eigenbase.sql.validate.SqlValidator, org.eigenbase.sql.validate.SqlValidatorScope); but note that some sub-classes of SqlCall never call this method.

Overrides:
validateCall in class SqlOperator
Parameters:
call - the call to this operator
validator - the active validator
scope - validator scope
operandScope - validator scope in which to validate operands to this call; usually equal to scope, but not always because some operators introduce new scopes
See Also:
SqlNode.validateExpr(SqlValidator, SqlValidatorScope), SqlOperator.deriveType(SqlValidator, SqlValidatorScope, SqlCall)