Enum StructKind
- java.lang.Object
-
- java.lang.Enum<StructKind>
-
- org.apache.calcite.rel.type.StructKind
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<StructKind>
public enum StructKind extends java.lang.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 writeSELECT 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
orPEEK_FIELDS_DEFAULT
we suspend that rule and would allowaddress.zip
.If there are multiple matches, we choose the one that is:
- Shorter. If you write
zipcode
,address.zipcode
will be preferred overproduct.supplier.zipcode
. - 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 usesPEEK_FIELDS
at some point.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description FULLY_QUALIFIED
This is a traditional structured type, where each field must be referenced explicitly.NONE
This is not a structured type.PEEK_FIELDS
If a field has this type, you can see its fields without qualifying them with the name of this field.PEEK_FIELDS_DEFAULT
AsPEEK_FIELDS
, but takes priority if another struct-typed field also has a field of the name being sought.PEEK_FIELDS_NO_EXPAND
AsPEEK_FIELDS
, but fields are not expanded in "SELECT *".
-
Constructor Summary
Constructors Modifier Constructor Description private
StructKind()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StructKind
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static StructKind[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
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 butSELECT address.zipcode FROM customer
it not valid.
-
PEEK_FIELDS_DEFAULT
public static final StructKind PEEK_FIELDS_DEFAULT
AsPEEK_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 labeledPEEK_FIELDS
, you could writezipcode
as shorthand foraddress.zipcode
.
-
PEEK_FIELDS_NO_EXPAND
public static final StructKind PEEK_FIELDS_NO_EXPAND
AsPEEK_FIELDS
, but fields are not expanded in "SELECT *".Used in Flink, not Phoenix.
-
-
Method Detail
-
values
public static StructKind[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (StructKind c : StructKind.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static StructKind valueOf(java.lang.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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
-