Enum SqlTypeFamily
- java.lang.Object
-
- java.lang.Enum<SqlTypeFamily>
-
- org.apache.calcite.sql.type.SqlTypeFamily
-
- All Implemented Interfaces:
Serializable,Comparable<SqlTypeFamily>,org.apache.calcite.rel.type.RelDataTypeFamily
public enum SqlTypeFamily extends Enum<SqlTypeFamily> implements org.apache.calcite.rel.type.RelDataTypeFamily
SqlTypeFamily provides SQL type categorization.The primary family categorization is a complete disjoint partitioning of SQL types into families, where two types are members of the same primary family iff instances of the two types can be the operands of an SQL equality predicate such as
WHERE v1 = v2. Primary families are returned by RelDataType.getFamily().There is also a secondary family categorization which overlaps with the primary categorization. It is used in type strategies for more specific or more general categorization than the primary families. Secondary families are never returned by RelDataType.getFamily().
This class was copied over from Calcite to support variant type(CALCITE-4918). When upgrading to Calcite 1.39.0 version, please remove the entire class.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ANYAPPROXIMATE_NUMERICARRAYBINARYBOOLEANCHARACTERCOLUMN_LISTCURSORDATEDATETIMEDATETIME_INTERVALDECIMALEXACT_NUMERICGEOIGNORELike ANY, but do not even validate the operand.INTEGERINTERVAL_DAY_TIMEINTERVAL_YEAR_MONTHMAPMULTISETNULLNUMERICSTRINGTIMETIMESTAMPVARIANT
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<SqlTypeFamily>allowableDifferenceTypes()For this type family, returns the allow types of the difference between two values of this family.booleancontains(org.apache.calcite.rel.type.RelDataType type)@Nullable org.apache.calcite.rel.type.RelDataTypegetDefaultConcreteType(org.apache.calcite.rel.type.RelDataTypeFactory factory)Return the defaultRelDataTypethat belongs to this family.static @Nullable SqlTypeFamilygetFamilyForJdbcType(int jdbcType)Gets the primary family containing a JDBC type.Collection<SqlTypeName>getTypeNames()Returns the collection ofSqlTypeNames included in this family.static SqlTypeFamilyvalueOf(String name)Returns the enum constant of this type with the specified name.static SqlTypeFamily[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
CHARACTER
public static final SqlTypeFamily CHARACTER
-
BINARY
public static final SqlTypeFamily BINARY
-
NUMERIC
public static final SqlTypeFamily NUMERIC
-
DATE
public static final SqlTypeFamily DATE
-
TIME
public static final SqlTypeFamily TIME
-
TIMESTAMP
public static final SqlTypeFamily TIMESTAMP
-
BOOLEAN
public static final SqlTypeFamily BOOLEAN
-
INTERVAL_YEAR_MONTH
public static final SqlTypeFamily INTERVAL_YEAR_MONTH
-
INTERVAL_DAY_TIME
public static final SqlTypeFamily INTERVAL_DAY_TIME
-
STRING
public static final SqlTypeFamily STRING
-
APPROXIMATE_NUMERIC
public static final SqlTypeFamily APPROXIMATE_NUMERIC
-
EXACT_NUMERIC
public static final SqlTypeFamily EXACT_NUMERIC
-
DECIMAL
public static final SqlTypeFamily DECIMAL
-
INTEGER
public static final SqlTypeFamily INTEGER
-
DATETIME
public static final SqlTypeFamily DATETIME
-
DATETIME_INTERVAL
public static final SqlTypeFamily DATETIME_INTERVAL
-
MULTISET
public static final SqlTypeFamily MULTISET
-
ARRAY
public static final SqlTypeFamily ARRAY
-
MAP
public static final SqlTypeFamily MAP
-
NULL
public static final SqlTypeFamily NULL
-
ANY
public static final SqlTypeFamily ANY
-
CURSOR
public static final SqlTypeFamily CURSOR
-
COLUMN_LIST
public static final SqlTypeFamily COLUMN_LIST
-
GEO
public static final SqlTypeFamily GEO
-
VARIANT
public static final SqlTypeFamily VARIANT
-
IGNORE
public static final SqlTypeFamily IGNORE
Like ANY, but do not even validate the operand. It may not be an expression.
-
-
Method Detail
-
values
public static SqlTypeFamily[] 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 (SqlTypeFamily c : SqlTypeFamily.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static SqlTypeFamily 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 nameNullPointerException- if the argument is null
-
getFamilyForJdbcType
public static @Nullable SqlTypeFamily getFamilyForJdbcType(int jdbcType)
Gets the primary family containing a JDBC type.- Parameters:
jdbcType- the JDBC type of interest- Returns:
- containing family
-
allowableDifferenceTypes
public List<SqlTypeFamily> allowableDifferenceTypes()
For this type family, returns the allow types of the difference between two values of this family.Equivalently, given an
ORDER BYexpression with one key, returns the allowable type families of the difference between two keys.Example 1. For
ORDER BY empno, a NUMERIC, the difference between twoempnovalues is also NUMERIC.Example 2. For
ORDER BY hireDate, a DATE, the difference between twohireDatevalues might be an INTERVAL_DAY_TIME or INTERVAL_YEAR_MONTH.The result determines whether a
SqlWindowwith aRANGEis valid (for example,OVER (ORDER BY empno RANGE 10is valid because10is numeric); and whether a call toPERCENTILE_CONTis valid (for example,PERCENTILE_CONT(0.25)ORDER BY (hireDate)} is valid becausehireDatevalues may be interpolated by adding values of typeINTERVAL_DAY_TIME.
-
getTypeNames
public Collection<SqlTypeName> getTypeNames()
Returns the collection ofSqlTypeNames included in this family.
-
getDefaultConcreteType
public @Nullable org.apache.calcite.rel.type.RelDataType getDefaultConcreteType(org.apache.calcite.rel.type.RelDataTypeFactory factory)
Return the defaultRelDataTypethat belongs to this family.
-
contains
public boolean contains(org.apache.calcite.rel.type.RelDataType type)
-
-