org.eigenbase.reltype
Class RelCrossType

java.lang.Object
  extended by org.eigenbase.reltype.RelDataTypeImpl
      extended by org.eigenbase.reltype.RelCrossType
All Implemented Interfaces:
RelDataType, RelDataTypeFamily

public class RelCrossType
extends RelDataTypeImpl

Type of the cartesian product of two or more sets of records.

Its fields are those of its constituent records, but unlike a RelRecordType, those fields' names are not necessarily distinct.

Version:
$Id: //open/dev/farrago/src/org/eigenbase/reltype/RelCrossType.java#12 $
Author:
jhyde

Field Summary
 RelDataType[] types
           
 
Fields inherited from class org.eigenbase.reltype.RelDataTypeImpl
digest, fieldList, fields
 
Constructor Summary
RelCrossType(RelDataType[] types, RelDataTypeField[] fields)
          Creates a cartesian product type.
 
Method Summary
protected  void generateTypeString(StringBuilder sb, boolean withDetail)
          Generates a string representation of this type.
 RelDataTypeField getField(String fieldName)
          Looks up a field by name.
 int getFieldOrdinal(String fieldName)
          Looks up the ordinal of a field by name.
 RelDataTypeField[] getFields()
          Gets the fields in a struct type.
 RelDataType[] getTypes()
           
 boolean isStruct()
          Queries whether this is a structured type.
 
Methods inherited from class org.eigenbase.reltype.RelDataTypeImpl
computeDigest, equals, getCharset, getCollation, getComparability, getComponentType, getFamily, getFieldCount, getFieldList, getFullTypeString, getIntervalQualifier, getPrecedenceList, getPrecision, getScale, getSqlIdentifier, getSqlTypeName, hashCode, isNullable, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

types

public final RelDataType[] types
Constructor Detail

RelCrossType

public RelCrossType(RelDataType[] types,
                    RelDataTypeField[] fields)
Creates a cartesian product type. This should only be called from a factory method.

"Precondition:"
types != null, types.length >= 1, !(types[i] instanceof CrossType)
Method Detail

isStruct

public boolean isStruct()
Description copied from interface: RelDataType
Queries whether this is a structured type.

Specified by:
isStruct in interface RelDataType
Overrides:
isStruct in class RelDataTypeImpl
Returns:
whether this type has fields; examples include rows and user-defined structured types in SQL, and classes in Java

getField

public RelDataTypeField getField(String fieldName)
Description copied from interface: RelDataType
Looks up a field by name.

Specified by:
getField in interface RelDataType
Overrides:
getField in class RelDataTypeImpl
Parameters:
fieldName - name of field to find
Returns:
named field, or null if not found

getFieldOrdinal

public int getFieldOrdinal(String fieldName)
Description copied from interface: RelDataType
Looks up the ordinal of a field by name.

Specified by:
getFieldOrdinal in interface RelDataType
Overrides:
getFieldOrdinal in class RelDataTypeImpl
Parameters:
fieldName - name of field to find
Returns:
0-based ordinal of named field, or -1 if not found

getFields

public RelDataTypeField[] getFields()
Description copied from interface: RelDataType
Gets the fields in a struct type. The field count is equal to the length of the returned array.

NOTE jvs 17-Dec-2004: this method will become deprecated once we move to Java generics, and eventually eliminated

Specified by:
getFields in interface RelDataType
Overrides:
getFields in class RelDataTypeImpl
Returns:
array of fields

getTypes

public RelDataType[] getTypes()

generateTypeString

protected void generateTypeString(StringBuilder sb,
                                  boolean withDetail)
Description copied from class: RelDataTypeImpl
Generates a string representation of this type.

Specified by:
generateTypeString in class RelDataTypeImpl
Parameters:
sb - StringBuffer into which to generate the string
withDetail - when true, all detail information needed to compute a unique digest (and return from getFullTypeString) should be included;