Package dev.frostlake.executor.commands
Class DataTypeParser
java.lang.Object
dev.frostlake.executor.commands.DataTypeParser
The one
dataTypeName parse-tree → DataType mapping, shared by column / parameter
definitions (ColumnDefinitionParser) and by expression casts (the expression AST builder), so
a type spelled in a CREATE TABLE and the same type spelled in a CAST produce the same object.
It reads the STRUCTURED spellings — OBJECT(x VARCHAR, ...), ARRAY(INT),
MAP(k, v) — into StructuredObjectType / StructuredArrayType /
MapType rather than collapsing them onto the plain semi-structured singletons, because
Snowflake treats structured and plain semi-structured types as DIFFERENT types.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe default length of a bare VARCHAR inside a CAST TARGET. -
Method Summary
Modifier and TypeMethodDescriptionstatic DataTypestatic DataTypeparse(FrostlakeParser.DataTypeNameContext ctx, FrostlakeParser.TypeParametersContext typeParams, int bareStringDefault) parse(dev.frostlake.parser.FrostlakeParser.DataTypeNameContext, dev.frostlake.parser.FrostlakeParser.TypeParametersContext)with the bare-VARCHAR default the CONTEXT implies —CAST_STRING_DEFAULTfor a cast target,DDL_STRING_DEFAULTfor a column definition.
-
Field Details
-
CAST_STRING_DEFAULT
public static final int CAST_STRING_DEFAULTThe default length of a bare VARCHAR inside a CAST TARGET. Live renders a cast-produced structured type with the LONGER conversion default —ARRAY_AGG(CAST(... AS OBJECT(x VARCHAR)))is refused as "(OBJECT(x VARCHAR(134217728)))" where the same type DECLARED on a column reportsVARCHAR(16777216).- See Also:
-
-
Method Details
-
parse
public static DataType parse(FrostlakeParser.DataTypeNameContext ctx, FrostlakeParser.TypeParametersContext typeParams) -
parse
public static DataType parse(FrostlakeParser.DataTypeNameContext ctx, FrostlakeParser.TypeParametersContext typeParams, int bareStringDefault) parse(dev.frostlake.parser.FrostlakeParser.DataTypeNameContext, dev.frostlake.parser.FrostlakeParser.TypeParametersContext)with the bare-VARCHAR default the CONTEXT implies —CAST_STRING_DEFAULTfor a cast target,DDL_STRING_DEFAULTfor a column definition.
-