Package org.apache.calcite.sql.type
Class SqlTypeExplicitPrecedenceList
- java.lang.Object
-
- org.apache.calcite.sql.type.SqlTypeExplicitPrecedenceList
-
- All Implemented Interfaces:
RelDataTypePrecedenceList
public class SqlTypeExplicitPrecedenceList extends java.lang.Object implements RelDataTypePrecedenceList
SqlTypeExplicitPrecedenceList implements theRelDataTypePrecedenceList
interface via an explicit list ofSqlTypeName
entries.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.List<SqlTypeName>
COMPACT_NUMERIC_TYPES
private static java.util.List<SqlTypeName>
NUMERIC_TYPES
private static java.util.Map<SqlTypeName,SqlTypeExplicitPrecedenceList>
TYPE_NAME_TO_PRECEDENCE_LIST
Map from SqlTypeName to corresponding precedence list.private java.util.List<SqlTypeName>
typeNames
-
Constructor Summary
Constructors Constructor Description SqlTypeExplicitPrecedenceList(java.lang.Iterable<SqlTypeName> typeNames)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTypePrecedence(RelDataType type1, RelDataType type2)
Compares the precedence of two types.boolean
containsType(RelDataType type)
Determines whether a type appears in this precedence list.(package private) static RelDataTypePrecedenceList
getListForType(RelDataType type)
private static int
getListPosition(SqlTypeName type, java.util.List<SqlTypeName> list)
private static SqlTypeExplicitPrecedenceList
list(java.lang.Iterable<SqlTypeName> typeNames)
private static SqlTypeExplicitPrecedenceList
list(SqlTypeName... typeNames)
private static SqlTypeExplicitPrecedenceList
numeric(SqlTypeName typeName)
-
-
-
Field Detail
-
NUMERIC_TYPES
private static final java.util.List<SqlTypeName> NUMERIC_TYPES
-
COMPACT_NUMERIC_TYPES
private static final java.util.List<SqlTypeName> COMPACT_NUMERIC_TYPES
-
TYPE_NAME_TO_PRECEDENCE_LIST
private static final java.util.Map<SqlTypeName,SqlTypeExplicitPrecedenceList> TYPE_NAME_TO_PRECEDENCE_LIST
Map from SqlTypeName to corresponding precedence list.- See Also:
SQL:2003 Part 2 Section 9.5
-
typeNames
private final java.util.List<SqlTypeName> typeNames
-
-
Constructor Detail
-
SqlTypeExplicitPrecedenceList
public SqlTypeExplicitPrecedenceList(java.lang.Iterable<SqlTypeName> typeNames)
-
-
Method Detail
-
list
private static SqlTypeExplicitPrecedenceList list(SqlTypeName... typeNames)
-
list
private static SqlTypeExplicitPrecedenceList list(java.lang.Iterable<SqlTypeName> typeNames)
-
numeric
private static SqlTypeExplicitPrecedenceList numeric(SqlTypeName typeName)
-
containsType
public boolean containsType(RelDataType type)
Description copied from interface:RelDataTypePrecedenceList
Determines whether a type appears in this precedence list.- Specified by:
containsType
in interfaceRelDataTypePrecedenceList
- Parameters:
type
- type to check- Returns:
- true iff this list contains type
-
compareTypePrecedence
public int compareTypePrecedence(RelDataType type1, RelDataType type2)
Description copied from interface:RelDataTypePrecedenceList
Compares the precedence of two types.The list must contain both types.
- Specified by:
compareTypePrecedence
in interfaceRelDataTypePrecedenceList
- Parameters:
type1
- first type to comparetype2
- second type to compare- Returns:
- positive if type1 has higher precedence; negative if type2 has higher precedence; 0 if types have equal precedence
-
getListPosition
private static int getListPosition(SqlTypeName type, java.util.List<SqlTypeName> list)
-
getListForType
static RelDataTypePrecedenceList getListForType(RelDataType type)
-
-