public abstract class ReturnTypes
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static SqlReturnTypeInference |
AGG_SUM
Type-inference strategy for SUM aggregate function inferred from the
operand type, and nullable if the call occurs within a "GROUP BY ()"
query.
|
static SqlReturnTypeInference |
AGG_SUM_EMPTY_IS_ZERO
Type-inference strategy for $SUM0 aggregate function inferred from the
operand type.
|
static SqlReturnTypeInference |
ARG0
Type-inference strategy whereby the result type of a call is the type of
the operand #0 (0-based).
|
static SqlReturnTypeInference |
ARG0_FORCE_NULLABLE
Type-inference strategy whereby the result type of a call is the type of
the operand #0 (0-based), with nulls always allowed.
|
static SqlReturnTypeInference |
ARG0_INTERVAL |
static SqlReturnTypeInference |
ARG0_INTERVAL_NULLABLE |
static SqlReturnTypeInference |
ARG0_NULLABLE
Type-inference strategy whereby the result type of a call is the type of
the operand #0 (0-based).
|
static SqlReturnTypeInference |
ARG0_NULLABLE_IF_EMPTY
Type-inference strategy whereby the result type of a call is the type of
the operand #0 (0-based), and nullable if the call occurs within a
"GROUP BY ()" query.
|
static SqlReturnTypeInference |
ARG0_NULLABLE_VARYING
Type-inference strategy whereby the result type of a call is VARYING the
type of the first argument.
|
static SqlReturnTypeInference |
ARG0_OR_EXACT_NO_SCALE
Type-inference strategy whereby the result type of a call is
DECIMAL_SCALE0 with a fallback to ARG0 This rule
is used for floor, ceiling. |
static SqlReturnTypeInference |
ARG1
Type-inference strategy whereby the result type of a call is the type of
the operand #1 (0-based).
|
static SqlReturnTypeInference |
ARG1_NULLABLE
Type-inference strategy whereby the result type of a call is the type of
the operand #1 (0-based).
|
static SqlReturnTypeInference |
ARG2
Type-inference strategy whereby the result type of a call is the type of
operand #2 (0-based).
|
static SqlReturnTypeInference |
ARG2_NULLABLE
Type-inference strategy whereby the result type of a call is the type of
operand #2 (0-based).
|
static SqlReturnTypeInference |
AVG_AGG_FUNCTION |
static SqlReturnTypeInference |
BIGINT
Type-inference strategy whereby the result type of a call is a Bigint
|
static SqlReturnTypeInference |
BIGINT_FORCE_NULLABLE
Type-inference strategy whereby the result type of a call is a nullable
Bigint
|
static SqlReturnTypeInference |
BIGINT_NULLABLE
Type-inference strategy whereby the result type of a call is an Bigint
with nulls allowed if any of the operands allow nulls.
|
static SqlReturnTypeInference |
BOOLEAN
Type-inference strategy whereby the result type of a call is Boolean.
|
static SqlReturnTypeInference |
BOOLEAN_FORCE_NULLABLE
Type-inference strategy whereby the result type of a call is a nullable
Boolean.
|
static SqlReturnTypeInference |
BOOLEAN_NOT_NULL
Type-inference strategy whereby the result type of a call is Boolean
not null.
|
static SqlReturnTypeInference |
BOOLEAN_NULLABLE
Type-inference strategy whereby the result type of a call is Boolean,
with nulls allowed if any of the operands allow nulls.
|
static SqlReturnTypeInference |
BOOLEAN_NULLABLE_OPTIMIZED
Type-inference strategy with similar effect to
BOOLEAN_NULLABLE ,
which is more efficient, but can only be used if all arguments are
BOOLEAN. |
static SqlReturnTypeInference |
COLUMN_LIST
Type-inference strategy that always returns "COLUMN_LIST".
|
static SqlReturnTypeInference |
COVAR_REGR_FUNCTION |
static SqlReturnTypeInference |
CURSOR
Type-inference strategy that always returns "CURSOR".
|
static SqlReturnTypeInference |
DATE
Type-inference strategy whereby the result type of a call is Date.
|
static SqlReturnTypeInference |
DATE_NULLABLE
Type-inference strategy whereby the result type of a call is nullable
Date.
|
static SqlReturnTypeInference |
DECIMAL_PRODUCT
Type-inference strategy whereby the result type of a call is the decimal
product of two exact numeric operands where at least one of the operands
is a decimal.
|
static SqlReturnTypeInference |
DECIMAL_PRODUCT_NULLABLE
Same as
DECIMAL_PRODUCT but returns with nullability if any of
the operands is nullable by using
SqlTypeTransforms.TO_NULLABLE |
static SqlReturnTypeInference |
DECIMAL_QUOTIENT
Type-inference strategy whereby the result type of a call is the decimal
product of two exact numeric operands where at least one of the operands
is a decimal.
|
static SqlReturnTypeInference |
DECIMAL_QUOTIENT_NULLABLE
Same as
DECIMAL_QUOTIENT but returns with nullability if any of
the operands is nullable by using
SqlTypeTransforms.TO_NULLABLE |
static SqlReturnTypeInference |
DECIMAL_SCALE0
Type-inference strategy for a call where the first argument is a decimal.
|
static SqlReturnTypeInference |
DECIMAL_SUM
Type-inference strategy whereby the result type of a call is the decimal
sum of two exact numeric operands where at least one of the operands is a
decimal.
|
static SqlReturnTypeInference |
DECIMAL_SUM_NULLABLE
Same as
DECIMAL_SUM but returns with nullability if any
of the operands is nullable by using
SqlTypeTransforms.TO_NULLABLE . |
static SqlReturnTypeInference |
DOUBLE
Type-inference strategy whereby the result type of a call is Double.
|
static SqlReturnTypeInference |
DOUBLE_NULLABLE
Type-inference strategy whereby the result type of a call is Double with
nulls allowed if any of the operands allow nulls.
|
static SqlReturnTypeInference |
DYADIC_STRING_SUM_PRECISION
Type-inference strategy whereby the result type of a call is
the same type as the input types but with the combined length of the
two first types
if types are of char type the type with the highest coercibility will
be used
result is varying if either input is; otherwise fixed
|
static SqlReturnTypeInference |
DYADIC_STRING_SUM_PRECISION_NULLABLE
Same as
DYADIC_STRING_SUM_PRECISION and using
SqlTypeTransforms.TO_NULLABLE |
static SqlReturnTypeInference |
DYADIC_STRING_SUM_PRECISION_NULLABLE_VARYING
Same as
DYADIC_STRING_SUM_PRECISION and using
SqlTypeTransforms.TO_NULLABLE ,
SqlTypeTransforms.TO_VARYING . |
static SqlReturnTypeInference |
FRACTIONAL_RANK
Type-inference strategy for the
CUME_DIST and PERCENT_RANK
aggregate functions. |
static SqlReturnTypeInference |
HISTOGRAM
Type-inference strategy for Histogram agg support
|
static SqlReturnTypeInference |
INTEGER
Type-inference strategy whereby the result type of a call is an Integer.
|
static SqlReturnTypeInference |
INTEGER_NULLABLE
Type-inference strategy whereby the result type of a call is an Integer
with nulls allowed if any of the operands allow nulls.
|
static SqlReturnTypeInference |
INTEGER_QUOTIENT_NULLABLE
Type-inference strategy whereby the result type of a call is
ARG0_INTERVAL_NULLABLE and LEAST_RESTRICTIVE . |
static SqlReturnTypeInference |
LEAST_RESTRICTIVE
Type-inference strategy whereby the result type of a call is using its
operands biggest type, using the SQL:1999 rules described in "Data types
of results of aggregations".
|
static SqlReturnTypeInference |
MULTISET
Returns the same type as the multiset carries.
|
static SqlReturnTypeInference |
MULTISET_ELEMENT_NULLABLE
Returns the element type of a multiset
|
static SqlReturnTypeInference |
MULTISET_NULLABLE
Same as
MULTISET but returns with nullability if any of the
operands is nullable. |
static SqlReturnTypeInference |
MULTISET_PROJECT_ONLY
Returns the type of the only column of a multiset.
|
static SqlReturnTypeInference |
MULTISET_PROJECT0
Returns a multiset of column #0 of a multiset.
|
static SqlReturnTypeInference |
MULTISET_RECORD
Returns a multiset of the first column of a multiset.
|
static SqlReturnTypeInference |
NULLABLE_SUM
Type-inference strategy whereby the result type of a call is
DECIMAL_SUM_NULLABLE with a fallback to LEAST_RESTRICTIVE
These rules are used for addition and subtraction. |
static SqlReturnTypeInference |
PRODUCT_NULLABLE
Type-inference strategy whereby the result type of a call is
DECIMAL_PRODUCT_NULLABLE with a fallback to
ARG0_INTERVAL_NULLABLE
and LEAST_RESTRICTIVE . |
static SqlReturnTypeInference |
QUOTIENT_NULLABLE
Type-inference strategy whereby the result type of a call is
DECIMAL_QUOTIENT_NULLABLE with a fallback to
ARG0_INTERVAL_NULLABLE and LEAST_RESTRICTIVE These rules
are used for division. |
static SqlReturnTypeInference |
RANK
Type-inference strategy for the
NTILE , RANK ,
DENSE_RANK , and ROW_NUMBER aggregate functions. |
static SqlReturnTypeInference |
RECORD_TO_SCALAR
Returns the field type of a structured type which has only one field.
|
static SqlReturnTypeInference |
SCOPE
Type-inference strategy where the expression is assumed to be registered
as a
SqlValidatorNamespace , and
therefore the result type of the call is the type of that namespace. |
static SqlReturnTypeInference |
TIME
Type-inference strategy whereby the result type of a call is Time(0).
|
static SqlReturnTypeInference |
TIME_NULLABLE
Type-inference strategy whereby the result type of a call is nullable
Time(0).
|
static SqlReturnTypeInference |
TO_MULTISET
Returns a multiset type.
|
static SqlReturnTypeInference |
VARCHAR_2000
Type-inference strategy that always returns "VARCHAR(2000)".
|
static SqlReturnTypeInference |
VARCHAR_2000_NULLABLE
Type-inference strategy that always returns "VARCHAR(2000)" with nulls
allowed if any of the operands allow nulls.
|
static SqlReturnTypeInference |
VARCHAR_4
Type-inference strategy that always returns "VARCHAR(4)".
|
static SqlReturnTypeInference |
VARCHAR_4_NULLABLE
Type-inference strategy that always returns "VARCHAR(4)" with nulls
allowed if any of the operands allow nulls.
|
Modifier | Constructor and Description |
---|---|
private |
ReturnTypes() |
Modifier and Type | Method and Description |
---|---|
static SqlTypeTransformCascade |
cascade(SqlReturnTypeInference rule,
SqlTypeTransform... transforms)
Creates a return-type inference that applies a rule then a sequence of
transforms.
|
static SqlReturnTypeInferenceChain |
chain(SqlReturnTypeInference... rules) |
static ExplicitReturnTypeInference |
explicit(RelDataType type)
Creates an inference rule which returns a copy of a given data type.
|
static ExplicitReturnTypeInference |
explicit(RelProtoDataType protoType) |
static ExplicitReturnTypeInference |
explicit(SqlTypeName typeName)
Creates an inference rule which returns a type with no precision or scale,
such as
DATE . |
static ExplicitReturnTypeInference |
explicit(SqlTypeName typeName,
int precision)
Creates an inference rule which returns a type with precision but no scale,
such as
VARCHAR(100) . |
public static final SqlReturnTypeInference ARG0
public static final SqlReturnTypeInference ARG0_NULLABLE_VARYING
public static final SqlReturnTypeInference ARG0_NULLABLE
public static final SqlReturnTypeInference ARG0_FORCE_NULLABLE
public static final SqlReturnTypeInference ARG0_INTERVAL
public static final SqlReturnTypeInference ARG0_INTERVAL_NULLABLE
public static final SqlReturnTypeInference ARG0_NULLABLE_IF_EMPTY
public static final SqlReturnTypeInference ARG1
public static final SqlReturnTypeInference ARG1_NULLABLE
public static final SqlReturnTypeInference ARG2
public static final SqlReturnTypeInference ARG2_NULLABLE
public static final SqlReturnTypeInference BOOLEAN
public static final SqlReturnTypeInference BOOLEAN_NULLABLE
public static final SqlReturnTypeInference BOOLEAN_NULLABLE_OPTIMIZED
BOOLEAN_NULLABLE
,
which is more efficient, but can only be used if all arguments are
BOOLEAN.public static final SqlReturnTypeInference BOOLEAN_FORCE_NULLABLE
public static final SqlReturnTypeInference BOOLEAN_NOT_NULL
public static final SqlReturnTypeInference DATE
public static final SqlReturnTypeInference DATE_NULLABLE
public static final SqlReturnTypeInference TIME
public static final SqlReturnTypeInference TIME_NULLABLE
public static final SqlReturnTypeInference DOUBLE
public static final SqlReturnTypeInference DOUBLE_NULLABLE
public static final SqlReturnTypeInference INTEGER
public static final SqlReturnTypeInference INTEGER_NULLABLE
public static final SqlReturnTypeInference BIGINT
public static final SqlReturnTypeInference BIGINT_FORCE_NULLABLE
public static final SqlReturnTypeInference BIGINT_NULLABLE
public static final SqlReturnTypeInference VARCHAR_4
public static final SqlReturnTypeInference VARCHAR_4_NULLABLE
public static final SqlReturnTypeInference VARCHAR_2000
public static final SqlReturnTypeInference VARCHAR_2000_NULLABLE
public static final SqlReturnTypeInference HISTOGRAM
public static final SqlReturnTypeInference CURSOR
public static final SqlReturnTypeInference COLUMN_LIST
public static final SqlReturnTypeInference LEAST_RESTRICTIVE
SQL:1999 Part 2 Section 9.3
public static final SqlReturnTypeInference MULTISET
public static final SqlReturnTypeInference TO_MULTISET
For example, given INTEGER
, returns
INTEGER MULTISET
.
public static final SqlReturnTypeInference MULTISET_ELEMENT_NULLABLE
public static final SqlReturnTypeInference MULTISET_NULLABLE
MULTISET
but returns with nullability if any of the
operands is nullable.public static final SqlReturnTypeInference MULTISET_PROJECT_ONLY
For example, given RECORD(x INTEGER) MULTISET
, returns
INTEGER MULTISET
.
public static final SqlReturnTypeInference INTEGER_QUOTIENT_NULLABLE
ARG0_INTERVAL_NULLABLE
and LEAST_RESTRICTIVE
. These rules
are used for integer division.public static final SqlReturnTypeInference DECIMAL_SCALE0
public static final SqlReturnTypeInference ARG0_OR_EXACT_NO_SCALE
DECIMAL_SCALE0
with a fallback to ARG0
This rule
is used for floor, ceiling.public static final SqlReturnTypeInference DECIMAL_PRODUCT
public static final SqlReturnTypeInference DECIMAL_PRODUCT_NULLABLE
DECIMAL_PRODUCT
but returns with nullability if any of
the operands is nullable by using
SqlTypeTransforms.TO_NULLABLE
public static final SqlReturnTypeInference PRODUCT_NULLABLE
DECIMAL_PRODUCT_NULLABLE
with a fallback to
ARG0_INTERVAL_NULLABLE
and LEAST_RESTRICTIVE
.
These rules are used for multiplication.public static final SqlReturnTypeInference DECIMAL_QUOTIENT
public static final SqlReturnTypeInference DECIMAL_QUOTIENT_NULLABLE
DECIMAL_QUOTIENT
but returns with nullability if any of
the operands is nullable by using
SqlTypeTransforms.TO_NULLABLE
public static final SqlReturnTypeInference QUOTIENT_NULLABLE
DECIMAL_QUOTIENT_NULLABLE
with a fallback to
ARG0_INTERVAL_NULLABLE
and LEAST_RESTRICTIVE
These rules
are used for division.public static final SqlReturnTypeInference DECIMAL_SUM
p and s are capped at their maximum values
SQL:2003 Part 2 Section 6.26
public static final SqlReturnTypeInference DECIMAL_SUM_NULLABLE
DECIMAL_SUM
but returns with nullability if any
of the operands is nullable by using
SqlTypeTransforms.TO_NULLABLE
.public static final SqlReturnTypeInference NULLABLE_SUM
DECIMAL_SUM_NULLABLE
with a fallback to LEAST_RESTRICTIVE
These rules are used for addition and subtraction.public static final SqlReturnTypeInference DYADIC_STRING_SUM_PRECISION
Pre-requisites:
public static final SqlReturnTypeInference DYADIC_STRING_SUM_PRECISION_NULLABLE_VARYING
DYADIC_STRING_SUM_PRECISION
and using
SqlTypeTransforms.TO_NULLABLE
,
SqlTypeTransforms.TO_VARYING
.public static final SqlReturnTypeInference DYADIC_STRING_SUM_PRECISION_NULLABLE
DYADIC_STRING_SUM_PRECISION
and using
SqlTypeTransforms.TO_NULLABLE
public static final SqlReturnTypeInference SCOPE
SqlValidatorNamespace
, and
therefore the result type of the call is the type of that namespace.public static final SqlReturnTypeInference MULTISET_PROJECT0
RECORD(x INTEGER, y DATE) MULTISET
, returns INTEGER
MULTISET
.public static final SqlReturnTypeInference MULTISET_RECORD
INTEGER MULTISET
, returns RECORD(x INTEGER)
MULTISET
.public static final SqlReturnTypeInference RECORD_TO_SCALAR
RECORD(x INTEGER)
returns INTEGER
.public static final SqlReturnTypeInference AGG_SUM
public static final SqlReturnTypeInference AGG_SUM_EMPTY_IS_ZERO
public static final SqlReturnTypeInference FRACTIONAL_RANK
CUME_DIST
and PERCENT_RANK
aggregate functions.public static final SqlReturnTypeInference RANK
NTILE
, RANK
,
DENSE_RANK
, and ROW_NUMBER
aggregate functions.public static final SqlReturnTypeInference AVG_AGG_FUNCTION
public static final SqlReturnTypeInference COVAR_REGR_FUNCTION
public static SqlReturnTypeInferenceChain chain(SqlReturnTypeInference... rules)
public static SqlTypeTransformCascade cascade(SqlReturnTypeInference rule, SqlTypeTransform... transforms)
public static ExplicitReturnTypeInference explicit(RelProtoDataType protoType)
public static ExplicitReturnTypeInference explicit(RelDataType type)
public static ExplicitReturnTypeInference explicit(SqlTypeName typeName)
DATE
.public static ExplicitReturnTypeInference explicit(SqlTypeName typeName, int precision)
VARCHAR(100)
.Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.