org.eigenbase.sql
Class SqlSelectOperator

java.lang.Object
  extended by org.eigenbase.sql.SqlOperator
      extended by org.eigenbase.sql.SqlSelectOperator

public class SqlSelectOperator
extends SqlOperator

An operator describing a query. (Not a query itself.)

Operands are:


Field Summary
 
Fields inherited from class org.eigenbase.sql.SqlOperator
MaxPrec, NL
 
Constructor Summary
SqlSelectOperator()
           
 
Method Summary
<R> void
acceptCall(SqlVisitor<R> visitor, SqlCall call, boolean onlyExpressions, SqlBasicVisitor.ArgHandler<R> argHandler)
          Accepts a SqlVisitor, directing an SqlBasicVisitor.ArgHandler to visit operand of a call.
 boolean argumentMustBeScalar(int ordinal)
          Returns whether the ordinalth argument to this operator must be scalar (as opposed to a query).
 SqlCall createCall(SqlLiteral functionQualifier, SqlParserPos pos, SqlNode... operands)
          Creates a call to this operand with an array of operands.
 SqlSelect createCall(SqlNodeList keywordList, SqlNodeList selectList, SqlNode fromClause, SqlNode whereClause, SqlNode groupBy, SqlNode having, SqlNodeList windowDecls, SqlNode orderBy, SqlParserPos pos)
          Creates a call to the SELECT operator.
 SqlSyntax getSyntax()
          Returns the syntactic type of this operator.
 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, adjustType, checkOperandCount, checkOperandTypes, 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

SqlSelectOperator

public SqlSelectOperator()
Method Detail

getSyntax

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

Specified by:
getSyntax in class SqlOperator

createCall

public SqlCall createCall(SqlLiteral functionQualifier,
                          SqlParserPos pos,
                          SqlNode... operands)
Description copied from class: SqlOperator
Creates a call to this operand with an array of operands.

The position of the resulting call is the union of the pos and the positions of all of the operands.

Overrides:
createCall in class SqlOperator
Parameters:
functionQualifier - function qualifier (e.g. "DISTINCT"), may be
pos - parser position of the identifier of the call
operands - array of operands

createCall

public SqlSelect createCall(SqlNodeList keywordList,
                            SqlNodeList selectList,
                            SqlNode fromClause,
                            SqlNode whereClause,
                            SqlNode groupBy,
                            SqlNode having,
                            SqlNodeList windowDecls,
                            SqlNode orderBy,
                            SqlParserPos pos)
Creates a call to the SELECT operator.

Parameters:
keywordList - List of keywords such DISTINCT and ALL, or null
selectList - The SELECT clause, or null if empty
fromClause - The FROM clause
whereClause - The WHERE clause, or null if not present
groupBy - The GROUP BY clause, or null if not present
having - The HAVING clause, or null if not present
windowDecls - The WINDOW clause, or null if not present
orderBy - The ORDER BY clause, or null if not present
pos - The parser position, or SqlParserPos.ZERO if not specified; must not be null.
Returns:
A SqlSelect, never null

acceptCall

public <R> void acceptCall(SqlVisitor<R> visitor,
                           SqlCall call,
                           boolean onlyExpressions,
                           SqlBasicVisitor.ArgHandler<R> argHandler)
Description copied from class: SqlOperator
Accepts a SqlVisitor, directing an SqlBasicVisitor.ArgHandler to visit operand of a call. The argument handler allows fine control about how the operands are visited, and how the results are combined.

Overrides:
acceptCall in class SqlOperator
Parameters:
visitor - Visitor
call - Call to visit
onlyExpressions - If true, ignores operands which are not expressions. For example, in the call to the AS operator
argHandler - Called for each operand

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

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