Enum Class CastFieldsModifier

java.lang.Object
java.lang.Enum<CastFieldsModifier>
dev.frostlake.executor.expressions.CastFieldsModifier
All Implemented Interfaces:
Serializable, Comparable<CastFieldsModifier>, Constable

public enum CastFieldsModifier extends Enum<CastFieldsModifier>
The optional field modifier of CAST(expr AS <structured type> [RENAME FIELDS | ADD FIELDS]).

Live-verified: RENAME FIELDS maps the source's fields POSITIONALLY onto the target's field names (counts must match), ADD FIELDS matches BY NAME and fills the fields only the target declares with NULL (the target must list every source field). Both require a STRUCTURED source and a STRUCTURED target.

  • Enum Constant Details

    • NONE

      public static final CastFieldsModifier NONE
      No modifier — a plain CAST(expr AS type).
    • RENAME

      public static final CastFieldsModifier RENAME
      RENAME FIELDS — positional re-labelling of the source's fields.
    • ADD

      public static final CastFieldsModifier ADD
      ADD FIELDS — by-name carry-over, new fields default to NULL.
  • Method Details

    • values

      public static CastFieldsModifier[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static CastFieldsModifier valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getSql

      public String getSql()
      The modifier as written in SQL, e.g. RENAME FIELDS.