Class ColumnTypeFamilies

java.lang.Object
dev.frostlake.executor.ColumnTypeFamilies

public final class ColumnTypeFamilies extends Object
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 Type
    Method
    Description
    static void
    rejectIncompatible(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 = 1 is "incompatible types: [BOOLEAN] and [NUMBER(38,0)]" (live-verified).
    static void
    rejectMismatch(TableColumn target, DataType sourceType)
    Refuse a value written to target whose 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • rejectMismatch

      public static void rejectMismatch(TableColumn target, DataType sourceType)
      Refuse a value written to target whose 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 written
      sourceType - the value's static type, or null when the channel cannot type it
    • rejectIncompatible

      public static void rejectIncompatible(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 = 1 is "incompatible types: [BOOLEAN] and [NUMBER(38,0)]" (live-verified).
      Parameters:
      targetType - the declared column's type
      sourceType - the source column's static type, or null when the channel cannot type it