Package org.apache.calcite.sql
Class SqlRowTypeNameSpec
java.lang.Object
org.apache.calcite.sql.SqlTypeNameSpec
org.apache.calcite.sql.SqlRowTypeNameSpec
A sql type name specification of row type.
The grammar definition in SQL-2011 IWD 9075-2:201?(E) 6.1 <data type> is as following:
<row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type>
As a extended syntax to the standard SQL, each field type can have a [ NULL | NOT NULL ] suffix specification, i.e. Row(f0 int null, f1 varchar not null). The default is NOT NULL(not nullable).
-
Constructor Summary
ConstructorDescriptionSqlRowTypeNameSpec
(SqlParserPos pos, List<SqlIdentifier> fieldNames, List<SqlDataTypeSpec> fieldTypes) Creates a row type specification. -
Method Summary
Modifier and TypeMethodDescriptionderiveType
(SqlValidator sqlValidator) Derive type from this SqlTypeNameSpec.boolean
equalsDeep
(SqlTypeNameSpec node, Litmus litmus) Returns whether this spec is structurally equivalent to another spec.int
getArity()
void
Writes a SQL representation of this spec to a writer.Methods inherited from class org.apache.calcite.sql.SqlTypeNameSpec
getParserPos, getTypeName
-
Constructor Details
-
SqlRowTypeNameSpec
public SqlRowTypeNameSpec(SqlParserPos pos, List<SqlIdentifier> fieldNames, List<SqlDataTypeSpec> fieldTypes) Creates a row type specification.- Parameters:
pos
- The parser positionfieldNames
- The field namesfieldTypes
- The field data types
-
-
Method Details
-
getFieldNames
-
getFieldTypes
-
getArity
public int getArity() -
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
-
deriveType
Description copied from class:SqlTypeNameSpec
Derive type from this SqlTypeNameSpec.- Specified by:
deriveType
in classSqlTypeNameSpec
- Parameters:
sqlValidator
- The sql validator- Returns:
- the
RelDataType
instance, throws exception if we could not deduce the type
-