Enum StructKind

java.lang.Object
java.lang.Enum<StructKind>
org.apache.calcite.rel.type.StructKind
All Implemented Interfaces:
Serializable, Comparable<StructKind>, Constable

public enum StructKind extends Enum<StructKind>
Describes a policy for resolving fields in record types.

The usual value is FULLY_QUALIFIED.

A field whose record type is labeled PEEK_FIELDS can be omitted. In Phoenix, column families are represented by fields like this. PEEK_FIELDS_DEFAULT is similar, but represents the default column family, so it will win in the event of a tie.

SQL usually disallows a record type. For instance,

SELECT address.zip FROM Emp AS e

is disallowed because address "looks like" a table alias. You'd have to write

SELECT e.address.zip FROM Emp AS e

But if a table has one or more columns that are record-typed and are labeled PEEK_FIELDS or PEEK_FIELDS_DEFAULT we suspend that rule and would allow address.zip.

If there are multiple matches, we choose the one that is:

  1. Shorter. If you write zipcode, address.zipcode will be preferred over product.supplier.zipcode.
  2. Uses as little skipping as possible. A match that is fully-qualified will beat one that uses PEEK_FIELDS_DEFAULT at some point, which will beat one that uses PEEK_FIELDS at some point.
  • Enum Constant Details

    • NONE

      public static final StructKind NONE
      This is not a structured type.
    • FULLY_QUALIFIED

      public static final StructKind FULLY_QUALIFIED
      This is a traditional structured type, where each field must be referenced explicitly.

      Also, when referencing a struct column, you need to qualify it with the table alias, per standard SQL. For instance, SELECT c.address.zipcode FROM customer AS c is valid but SELECT address.zipcode FROM customer it not valid.

    • PEEK_FIELDS_DEFAULT

      public static final StructKind PEEK_FIELDS_DEFAULT
      As PEEK_FIELDS, but takes priority if another struct-typed field also has a field of the name being sought.

      In Phoenix, only one of a table's columns is labeled PEEK_FIELDS_DEFAULT - the default column family - but in principle there could be more than one.

    • PEEK_FIELDS

      public static final StructKind PEEK_FIELDS
      If a field has this type, you can see its fields without qualifying them with the name of this field.

      For example, if address is labeled PEEK_FIELDS, you could write zipcode as shorthand for address.zipcode.

    • PEEK_FIELDS_NO_EXPAND

      public static final StructKind PEEK_FIELDS_NO_EXPAND
      As PEEK_FIELDS, but fields are not expanded in "SELECT *".

      Used in Flink, not Phoenix.

  • Method Details

    • values

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

      public static StructKind valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
      NullPointerException - if the argument is null