Package org.apache.calcite.rel.type
Class SingleColumnAliasRelDataType
java.lang.Object
org.apache.calcite.rel.type.SingleColumnAliasRelDataType
- All Implemented Interfaces:
RelDataType
Specific type of RelDataType that corresponds to a single column table,
where column can have alias.
For instance:
select rmp, rmp.i from table(ramp(3)) as rmp;
- See Also:
-
Field Summary
Fields inherited from interface org.apache.calcite.rel.type.RelDataType
PRECISION_NOT_SPECIFIED, SCALE_NOT_SPECIFIED
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@Nullable Charset
Gets this type's character set, or null if this type cannot carry a character set or has no character set defined.@Nullable SqlCollation
Gets this type's collation, or null if this type cannot carry a collation or has no collation defined.Returns the category of comparison operators that make sense when applied to values of this type.@Nullable RelDataType
Gets the component type if this type is a collection, otherwise null.Gets a canonical object representing the family of this type.@Nullable RelDataTypeField
Looks up a field by name.int
Returns the number of fields in a struct type.Gets the fields in a struct type.Returns the names of the fields in a struct type.Gets a string representation of this type with full detail such as character set and nullability.@Nullable SqlIntervalQualifier
Gets this type's interval qualifier, or null if this is not an interval type.@Nullable RelDataType
Gets the key type if this type is a map, otherwise null.Returns the precedence list for this type.int
Gets the JDBC-defined precision for values of this type.int
getScale()
Gets the scale of this type.@Nullable SqlIdentifier
Gets theSqlIdentifier
associated with this type.Gets theSqlTypeName
of this type.Returns the rule for resolving the fields of a structured type, orStructKind.NONE
if this is not a structured type.@Nullable RelDataType
Gets the value type if this type is a map, otherwise null.boolean
Returns whether this type has dynamic structure (for "schema-on-read" table).boolean
Queries whether this type allows null values.boolean
isStruct()
Queries whether this is a structured type.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.calcite.rel.type.RelDataType
equalsSansFieldNames, equalsSansFieldNamesAndNullability, getMeasureElementType, isMeasure, toString
-
Constructor Details
-
SingleColumnAliasRelDataType
-
-
Method Details
-
isStruct
public boolean isStruct()Description copied from interface:RelDataType
Queries whether this is a structured type.- Specified by:
isStruct
in interfaceRelDataType
- Returns:
- whether this type has fields; examples include rows and user-defined structured types in SQL, and classes in Java
-
getFieldList
Description copied from interface:RelDataType
Gets the fields in a struct type. The field count is equal to the size of the returned list.- Specified by:
getFieldList
in interfaceRelDataType
- Returns:
- read-only list of fields
-
getFieldNames
Description copied from interface:RelDataType
Returns the names of the fields in a struct type. The field count is equal to the size of the returned list.- Specified by:
getFieldNames
in interfaceRelDataType
- Returns:
- read-only list of field names
-
getFieldCount
public int getFieldCount()Description copied from interface:RelDataType
Returns the number of fields in a struct type.This method is equivalent to
.RelDataType.getFieldList()
.size()- Specified by:
getFieldCount
in interfaceRelDataType
-
getStructKind
Description copied from interface:RelDataType
Returns the rule for resolving the fields of a structured type, orStructKind.NONE
if this is not a structured type.- Specified by:
getStructKind
in interfaceRelDataType
- Returns:
- the StructKind that determines how this type's fields are resolved
-
getField
public @Nullable RelDataTypeField getField(String fieldName, boolean caseSensitive, boolean elideRecord) Description copied from interface:RelDataType
Looks up a field by name.NOTE: Be careful choosing the value of
caseSensitive
:- If the field name was supplied by an end-user (e.g. as a column alias in SQL), use your session's case-sensitivity setting.
- Only hard-code
true
if you are sure that the field name is internally generated. - Hard-coding
false
is almost certainly wrong.
- Specified by:
getField
in interfaceRelDataType
- Parameters:
fieldName
- Name of field to findcaseSensitive
- Whether match is case-sensitiveelideRecord
- Whether to find fields nested within records- Returns:
- named field, or null if not found
-
isNullable
public boolean isNullable()Description copied from interface:RelDataType
Queries whether this type allows null values.- Specified by:
isNullable
in interfaceRelDataType
- Returns:
- whether type allows null values
-
getComponentType
Description copied from interface:RelDataType
Gets the component type if this type is a collection, otherwise null.- Specified by:
getComponentType
in interfaceRelDataType
- Returns:
- canonical type descriptor for components
-
getKeyType
Description copied from interface:RelDataType
Gets the key type if this type is a map, otherwise null.- Specified by:
getKeyType
in interfaceRelDataType
- Returns:
- canonical type descriptor for key
-
getValueType
Description copied from interface:RelDataType
Gets the value type if this type is a map, otherwise null.- Specified by:
getValueType
in interfaceRelDataType
- Returns:
- canonical type descriptor for value
-
getCharset
Description copied from interface:RelDataType
Gets this type's character set, or null if this type cannot carry a character set or has no character set defined.- Specified by:
getCharset
in interfaceRelDataType
- Returns:
- charset of type
-
getCollation
Description copied from interface:RelDataType
Gets this type's collation, or null if this type cannot carry a collation or has no collation defined.- Specified by:
getCollation
in interfaceRelDataType
- Returns:
- collation of type
-
getIntervalQualifier
Description copied from interface:RelDataType
Gets this type's interval qualifier, or null if this is not an interval type.- Specified by:
getIntervalQualifier
in interfaceRelDataType
- Returns:
- interval qualifier
-
getPrecision
public int getPrecision()Description copied from interface:RelDataType
Gets the JDBC-defined precision for values of this type. Note that this is not always the same as the user-specified precision. For example, the type INTEGER has no user-specified precision, but this method returns 10 for an INTEGER type.Returns
RelDataType.PRECISION_NOT_SPECIFIED
(-1) if precision is not applicable for this type.- Specified by:
getPrecision
in interfaceRelDataType
- Returns:
- number of decimal digits for exact numeric types; number of decimal digits in mantissa for approximate numeric types; number of decimal digits for fractional seconds of datetime types; length in characters for character types; length in bytes for binary types; length in bits for bit types; 1 for BOOLEAN; -1 if precision is not valid for this type
-
getScale
public int getScale()Description copied from interface:RelDataType
Gets the scale of this type. ReturnsRelDataType.SCALE_NOT_SPECIFIED
(-1) if scale is not valid for this type.- Specified by:
getScale
in interfaceRelDataType
- Returns:
- number of digits of scale
-
getSqlTypeName
Description copied from interface:RelDataType
Gets theSqlTypeName
of this type.- Specified by:
getSqlTypeName
in interfaceRelDataType
- Returns:
- SqlTypeName, never null
-
getSqlIdentifier
Description copied from interface:RelDataType
Gets theSqlIdentifier
associated with this type. For a predefined type, this is a simple identifier based onRelDataType.getSqlTypeName()
. For a user-defined type, this is a compound identifier which uniquely names the type.- Specified by:
getSqlIdentifier
in interfaceRelDataType
- Returns:
- SqlIdentifier, or null if this is not an SQL type
-
getFullTypeString
Description copied from interface:RelDataType
Gets a string representation of this type with full detail such as character set and nullability. The string must serve as a "digest" for this type, meaning two types can be considered identical iff their digests are equal.- Specified by:
getFullTypeString
in interfaceRelDataType
- Returns:
- full type string
-
getFamily
Description copied from interface:RelDataType
Gets a canonical object representing the family of this type. Two values can be compared if and only if their types are in the same family.- Specified by:
getFamily
in interfaceRelDataType
- Returns:
- canonical object representing type family, never null
-
getPrecedenceList
Description copied from interface:RelDataType
Returns the precedence list for this type.- Specified by:
getPrecedenceList
in interfaceRelDataType
-
getComparability
Description copied from interface:RelDataType
Returns the category of comparison operators that make sense when applied to values of this type.- Specified by:
getComparability
in interfaceRelDataType
-
isDynamicStruct
public boolean isDynamicStruct()Description copied from interface:RelDataType
Returns whether this type has dynamic structure (for "schema-on-read" table).- Specified by:
isDynamicStruct
in interfaceRelDataType
-