Package dev.frostlake.executor
Class ColumnTypeFamilies
java.lang.Object
dev.frostlake.executor.ColumnTypeFamilies
Snowflake's compile-time type matching of a value against the column it is written to (live-verified
matrix). A source whose static type family cannot implicitly convert to the column's family is refused
before any row is written, whether an INSERT, an UPDATE, either MERGE branch or a column-listed CTAS
writes it, and over an empty table too. VARCHAR still converts to numbers, booleans, temporals and BINARY
at row time, and a VARIANT casts to any scalar or container at row time. But a VARCHAR, temporal or
BINARY source never reaches a VARIANT column, containers never leave their own family except through
VARIANT, and BINARY takes nothing but strings. A type with no audited static family is left alone: the
channel never guesses.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidrejectIncompatible(DataType targetType, DataType sourceType) Refuse a column-listed CTAS's source column whose family the declared column does not take, with the sentence a CTAS gives:CREATE TABLE t (n NUMBER) AS SELECT 1 = 1is "incompatible types: [BOOLEAN] and [NUMBER(38,0)]" (live-verified).static voidrejectMismatch(TableColumn target, DataType sourceType) Refuse a value written totargetwhose static type the column's family does not take, with the write's sentence,Expression type does not match column data type, expecting NUMBER(38,0) but got BOOLEAN for column N.
-
Method Details
-
rejectMismatch
Refuse a value written totargetwhose static type the column's family does not take, with the write's sentence,Expression type does not match column data type, expecting NUMBER(38,0) but got BOOLEAN for column N. A TIME written to a TIMESTAMP column has a sentence of its own.- Parameters:
target- the column writtensourceType- the value's static type, or null when the channel cannot type it
-
rejectIncompatible
Refuse a column-listed CTAS's source column whose family the declared column does not take, with the sentence a CTAS gives:CREATE TABLE t (n NUMBER) AS SELECT 1 = 1is "incompatible types: [BOOLEAN] and [NUMBER(38,0)]" (live-verified).- Parameters:
targetType- the declared column's typesourceType- the source column's static type, or null when the channel cannot type it
-