org.eigenbase.sql.validate
Class IdentifierNamespace

java.lang.Object
  extended by org.eigenbase.sql.validate.AbstractNamespace
      extended by org.eigenbase.sql.validate.IdentifierNamespace
All Implemented Interfaces:
SqlValidatorNamespace
Direct Known Subclasses:
SqlValidatorImpl.DmlNamespace

public class IdentifierNamespace
extends AbstractNamespace

Namespace whose contents are defined by the type of an identifier.

Since:
Mar 25, 2003
Version:
$Id: //open/dev/farrago/src/org/eigenbase/sql/validate/IdentifierNamespace.java#17 $
Author:
jhyde

Field Summary
private  SqlIdentifier id
           
private  List<Pair<SqlNode,SqlMonotonicity>> monotonicExprs
          List of monotonic expressions.
private  SqlValidatorTable table
          The underlying table.
 
Fields inherited from class org.eigenbase.sql.validate.AbstractNamespace
enclosingNode, rowType, validator
 
Constructor Summary
IdentifierNamespace(SqlValidatorImpl validator, SqlIdentifier id, SqlNode enclosingNode)
          Creates an IdentifierNamespace.
 
Method Summary
 SqlIdentifier getId()
           
 List<Pair<SqlNode,SqlMonotonicity>> getMonotonicExprs()
          Returns a list of expressions which are monotonic in this namespace.
 SqlMonotonicity getMonotonicity(String columnName)
          Returns whether and how a given column is sorted.
 SqlNode getNode()
          Returns the parse tree node at the root of this namespace.
 SqlValidatorTable getTable()
          Returns the underlying table, or null if there is none.
 SqlValidatorNamespace resolve(String name, SqlValidatorScope[] ancestorOut, int[] offsetOut)
           
 RelDataType validateImpl()
          Validates this scope and returns the type of the records it returns.
 
Methods inherited from class org.eigenbase.sql.validate.AbstractNamespace
fieldExists, getEnclosingNode, getRowType, getRowTypeSansSystemColumns, getValidator, isWrapperFor, lookupChild, makeNullable, setRowType, translate, unwrap, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

private final SqlIdentifier id

table

private SqlValidatorTable table
The underlying table. Set on validate.


monotonicExprs

private List<Pair<SqlNode,SqlMonotonicity>> monotonicExprs
List of monotonic expressions. Set on validate.

Constructor Detail

IdentifierNamespace

IdentifierNamespace(SqlValidatorImpl validator,
                    SqlIdentifier id,
                    SqlNode enclosingNode)
Creates an IdentifierNamespace.

Parameters:
validator - Validator
id - Identifier node
enclosingNode - Enclosing node
Method Detail

validateImpl

public RelDataType validateImpl()
Description copied from class: AbstractNamespace
Validates this scope and returns the type of the records it returns. External users should call AbstractNamespace.validate(), which uses the AbstractNamespace.status field to protect against cycles.

Specified by:
validateImpl in class AbstractNamespace
Returns:
record data type, never null

getId

public SqlIdentifier getId()

getNode

public SqlNode getNode()
Description copied from interface: SqlValidatorNamespace
Returns the parse tree node at the root of this namespace.

Returns:
parse tree node

getTable

public SqlValidatorTable getTable()
Description copied from interface: SqlValidatorNamespace
Returns the underlying table, or null if there is none.

Specified by:
getTable in interface SqlValidatorNamespace
Overrides:
getTable in class AbstractNamespace

resolve

public SqlValidatorNamespace resolve(String name,
                                     SqlValidatorScope[] ancestorOut,
                                     int[] offsetOut)

getMonotonicExprs

public List<Pair<SqlNode,SqlMonotonicity>> getMonotonicExprs()
Description copied from interface: SqlValidatorNamespace
Returns a list of expressions which are monotonic in this namespace. For example, if the namespace represents a relation ordered by a column called "TIMESTAMP", then the list would contain a SqlIdentifier called "TIMESTAMP".

Specified by:
getMonotonicExprs in interface SqlValidatorNamespace
Overrides:
getMonotonicExprs in class AbstractNamespace

getMonotonicity

public SqlMonotonicity getMonotonicity(String columnName)
Description copied from interface: SqlValidatorNamespace
Returns whether and how a given column is sorted.

Specified by:
getMonotonicity in interface SqlValidatorNamespace
Overrides:
getMonotonicity in class AbstractNamespace