org.eigenbase.sql.validate
Class FieldNamespace

java.lang.Object
  extended by org.eigenbase.sql.validate.AbstractNamespace
      extended by org.eigenbase.sql.validate.FieldNamespace
All Implemented Interfaces:
SqlValidatorNamespace

 class FieldNamespace
extends AbstractNamespace

Implementation of SqlValidatorNamespace for a field of a record.

A field is not a very interesting namespace - except if the field has a record or multiset type - but this class exists to make fields behave similarly to other records for purposes of name resolution.

Version:
$Id: //open/dev/farrago/src/org/eigenbase/sql/validate/FieldNamespace.java#5 $
Author:
jhyde

Field Summary
 
Fields inherited from class org.eigenbase.sql.validate.AbstractNamespace
enclosingNode, rowType, validator
 
Constructor Summary
FieldNamespace(SqlValidatorImpl validator, RelDataType dataType)
          Creates a FieldNamespace.
 
Method Summary
 boolean fieldExists(String name)
          Returns whether this namespace has a field of a given name.
 SqlNode getNode()
          Returns the parse tree node at the root of this namespace.
 SqlValidatorNamespace lookupChild(String name)
          Looks up a child namespace of a given name.
 void setRowType(RelDataType rowType)
          Allows RowType for the namespace to be explicitly set.
protected  RelDataType validateImpl()
          Validates this scope and returns the type of the records it returns.
 
Methods inherited from class org.eigenbase.sql.validate.AbstractNamespace
getEnclosingNode, getMonotonicExprs, getMonotonicity, getRowType, getRowTypeSansSystemColumns, getTable, getValidator, isWrapperFor, makeNullable, translate, unwrap, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldNamespace

FieldNamespace(SqlValidatorImpl validator,
               RelDataType dataType)
Creates a FieldNamespace.

Parameters:
validator - Validator
dataType - Data type of field
Method Detail

setRowType

public void setRowType(RelDataType rowType)
Description copied from interface: SqlValidatorNamespace
Allows RowType for the namespace to be explicitly set.

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

validateImpl

protected 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

getNode

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

Returns:
parse tree node

lookupChild

public SqlValidatorNamespace lookupChild(String name)
Description copied from interface: SqlValidatorNamespace
Looks up a child namespace of a given name.

For example, in the query select e.name from emps as e, e is an IdentifierNamespace which has a child name which is a FieldNamespace.

Specified by:
lookupChild in interface SqlValidatorNamespace
Overrides:
lookupChild in class AbstractNamespace
Parameters:
name - Name of namespace
Returns:
Namespace

fieldExists

public boolean fieldExists(String name)
Description copied from interface: SqlValidatorNamespace
Returns whether this namespace has a field of a given name.

Specified by:
fieldExists in interface SqlValidatorNamespace
Overrides:
fieldExists in class AbstractNamespace
Parameters:
name - Field name
Returns:
Whether field exists