org.eigenbase.sql
Class SqlSpecialOperator

java.lang.Object
  extended by org.eigenbase.sql.SqlOperator
      extended by org.eigenbase.sql.SqlSpecialOperator
Direct Known Subclasses:
SqlAsOperator, SqlColumnListConstructor, SqlCursorConstructor, SqlDatetimeSubtractionOperator, SqlFunctionalOperator, SqlInfixOperator, SqlInternalOperator, SqlLikeOperator, SqlMultisetQueryConstructor, SqlMultisetValueConstructor, SqlOrderByOperator, SqlOverlapsOperator, SqlRowOperator, SqlValuesOperator

public class SqlSpecialOperator
extends SqlOperator

Generic operator for nodes with special syntax.


Field Summary
 
Fields inherited from class org.eigenbase.sql.SqlOperator
MaxPrec, NL
 
Constructor Summary
SqlSpecialOperator(String name, SqlKind kind)
           
SqlSpecialOperator(String name, SqlKind kind, int prec)
           
SqlSpecialOperator(String name, SqlKind kind, int prec, boolean leftAssoc, SqlReturnTypeInference returnTypeInference, SqlOperandTypeInference operandTypeInference, SqlOperandTypeChecker operandTypeChecker)
           
 
Method Summary
 SqlSyntax getSyntax()
          Returns the syntactic type of this operator.
 int reduceExpr(int ordinal, List<Object> list)
          Reduces a list of operators and arguments according to the rules of precedence and associativity.
 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.SqlOperator
acceptCall, acceptCall, adjustType, argumentMustBeScalar, checkOperandCount, checkOperandTypes, createCall, createCall, createCall, createCall, deriveType, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getName, getOperandCountRange, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSignatureTemplate, hashCode, inferReturnType, 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

SqlSpecialOperator

public SqlSpecialOperator(String name,
                          SqlKind kind)

SqlSpecialOperator

public SqlSpecialOperator(String name,
                          SqlKind kind,
                          int prec)

SqlSpecialOperator

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

getSyntax

public SqlSyntax getSyntax()
Description copied from class: SqlOperator
Returns the syntactic type of this operator.

Specified by:
getSyntax in class SqlOperator

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 SqlOperator

reduceExpr

public int reduceExpr(int ordinal,
                      List<Object> list)
Reduces a list of operators and arguments according to the rules of precedence and associativity. Returns the ordinal of the node which replaced the expression.

The default implementation throws UnsupportedOperationException.

Parameters:
ordinal - indicating the ordinal of the current operator in the list on which a possible reduction can be made
list - List of alternating SqlParserUtil.ToTreeListItem and SqlNode
Returns:
ordinal of the node which replaced the expression