Package org.apache.calcite.sql
Class SqlBasicTypeNameSpec
java.lang.Object
org.apache.calcite.sql.SqlTypeNameSpec
org.apache.calcite.sql.SqlBasicTypeNameSpec
- Direct Known Subclasses:
SqlAlienSystemTypeNameSpec
A sql type name specification of basic sql type.
Supported basic sql types grammar:
basicSqlType:
GEOMETRY
| BOOLEAN
| [ INTEGER | INT ]
| TINYINT
| SMALLINT
| BIGINT
| REAL
| DOUBLE [ PRECISION ]
| FLOAT
| BINARY [ precision ]
| [ BINARY VARYING | VARBINARY ] [ precision ]
| [ DECIMAL | DEC | NUMERIC ] [ precision [, scale] ]
| ANY [ precision [, scale] ]
| charType [ precision ] [ charSet ]
| varcharType [ precision ] [ charSet ]
| DATE
| TIME [ precision ] [ timeZone ]
| TIMESTAMP [ precision ] [ timeZone ]
charType:
CHARACTER
| CHAR
varcharType:
charType VARYING
| VARCHAR
charSet:
CHARACTER SET charSetName
timeZone:
WITHOUT TIME ZONE
| WITH LOCAL TIME ZONE
-
Constructor Summary
ConstructorsConstructorDescriptionSqlBasicTypeNameSpec(SqlTypeName typeName, int precision, int scale, @Nullable String charSetName, SqlParserPos pos) Create a basic sql type name specification.SqlBasicTypeNameSpec(SqlTypeName typeName, int precision, int scale, SqlParserPos pos) SqlBasicTypeNameSpec(SqlTypeName typeName, int precision, String charSetName, SqlParserPos pos) SqlBasicTypeNameSpec(SqlTypeName typeName, int precision, SqlParserPos pos) SqlBasicTypeNameSpec(SqlTypeName typeName, SqlParserPos pos) -
Method Summary
Modifier and TypeMethodDescriptionderiveType(SqlValidator validator) Derive type from this SqlTypeNameSpec.booleanequalsDeep(SqlTypeNameSpec node, Litmus litmus) Returns whether this spec is structurally equivalent to another spec.@Nullable StringintintgetScale()voidWrites a SQL representation of this spec to a writer.Methods inherited from class org.apache.calcite.sql.SqlTypeNameSpec
getParserPos, getTypeName
-
Constructor Details
-
SqlBasicTypeNameSpec
public SqlBasicTypeNameSpec(SqlTypeName typeName, int precision, int scale, @Nullable String charSetName, SqlParserPos pos) Create a basic sql type name specification.- Parameters:
typeName- Type nameprecision- Precision of the type name if it is allowed, default is -1scale- Scale of the type name if it is allowed, default is -1charSetName- Char set of the type, only works when the type belong to CHARACTER type familypos- The parser position
-
SqlBasicTypeNameSpec
-
SqlBasicTypeNameSpec
-
SqlBasicTypeNameSpec
public SqlBasicTypeNameSpec(SqlTypeName typeName, int precision, String charSetName, SqlParserPos pos) -
SqlBasicTypeNameSpec
-
-
Method Details
-
getScale
public int getScale() -
getPrecision
public int getPrecision() -
getCharSetName
-
equalsDeep
Description copied from class:SqlTypeNameSpecReturns whether this spec is structurally equivalent to another spec.- Specified by:
equalsDeepin classSqlTypeNameSpec
-
unparse
Description copied from class:SqlTypeNameSpecWrites a SQL representation of this spec to a writer.- Specified by:
unparsein classSqlTypeNameSpec
-
deriveType
Description copied from class:SqlTypeNameSpecDerive type from this SqlTypeNameSpec.- Specified by:
deriveTypein classSqlTypeNameSpec- Parameters:
validator- The sql validator- Returns:
- the
RelDataTypeinstance, throws exception if we could not deduce the type
-