Package org.apache.calcite.sql
Class SqlCollectionTypeNameSpec
java.lang.Object
org.apache.calcite.sql.SqlTypeNameSpec
org.apache.calcite.sql.SqlCollectionTypeNameSpec
A sql type name specification of collection type.
The grammar definition in SQL-2011 IWD 9075-2:201?(E) 6.1 <collection type> is as following:
<collection type> ::= <array type> | <multiset type> <array type> ::= <data type> ARRAY [ <left bracket or trigraph> <maximum cardinality> <right bracket or trigraph> ] <maximum cardinality> ::= <unsigned integer> <multiset type> ::= <data type> MULTISET
This class is intended to describe SQL collection type. It can describe
either simple collection type like "int array" or nested collection type like
"int array array" or "int array multiset". For nested collection type, the element type
name of this SqlCollectionTypeNameSpec
is also a SqlCollectionTypeNameSpec
.
-
Constructor Summary
ConstructorDescriptionSqlCollectionTypeNameSpec
(SqlTypeNameSpec elementTypeName, SqlTypeName collectionTypeName, SqlParserPos pos) Creates aSqlCollectionTypeNameSpec
. -
Method Summary
Modifier and TypeMethodDescriptionderiveType
(SqlValidator validator) Derive type from this SqlTypeNameSpec.boolean
equalsDeep
(SqlTypeNameSpec spec, Litmus litmus) Returns whether this spec is structurally equivalent to another spec.void
Writes a SQL representation of this spec to a writer.Methods inherited from class org.apache.calcite.sql.SqlTypeNameSpec
getParserPos, getTypeName
-
Constructor Details
-
SqlCollectionTypeNameSpec
public SqlCollectionTypeNameSpec(SqlTypeNameSpec elementTypeName, SqlTypeName collectionTypeName, SqlParserPos pos) Creates aSqlCollectionTypeNameSpec
.- Parameters:
elementTypeName
- Type of the collection elementcollectionTypeName
- Collection type namepos
- Parser position, must not be null
-
-
Method Details
-
getElementTypeName
-
deriveType
Description copied from class:SqlTypeNameSpec
Derive type from this SqlTypeNameSpec.- Specified by:
deriveType
in classSqlTypeNameSpec
- Parameters:
validator
- The sql validator- Returns:
- the
RelDataType
instance, throws exception if we could not deduce the type
-
unparse
Description copied from class:SqlTypeNameSpec
Writes a SQL representation of this spec to a writer.- Specified by:
unparse
in classSqlTypeNameSpec
-
equalsDeep
Description copied from class:SqlTypeNameSpec
Returns whether this spec is structurally equivalent to another spec.- Specified by:
equalsDeep
in classSqlTypeNameSpec
-