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
ConstructorsConstructorDescriptionSqlRowTypeNameSpec(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.booleanequalsDeep(SqlTypeNameSpec node, Litmus litmus) Returns whether this spec is structurally equivalent to another spec.intgetArity()voidWrites 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:SqlTypeNameSpecWrites a SQL representation of this spec to a writer.- Specified by:
unparsein classSqlTypeNameSpec
-
equalsDeep
Description copied from class:SqlTypeNameSpecReturns whether this spec is structurally equivalent to another spec.- Specified by:
equalsDeepin classSqlTypeNameSpec
-
deriveType
Description copied from class:SqlTypeNameSpecDerive type from this SqlTypeNameSpec.- Specified by:
deriveTypein classSqlTypeNameSpec- Parameters:
sqlValidator- The sql validator- Returns:
- the
RelDataTypeinstance, throws exception if we could not deduce the type
-