public class SqlRowOperator
extends org.apache.calcite.sql.SqlSpecialOperator
There are differences following:
1. The return value about R IS NULL
and R IS NOT NULL
.
At the same time SQL standard says that the next about `ROW`:
R IS NULL
is:
R IS NOT NULL
is:
Calcite applies that logic since CALCITE-3627 (1.30.0+).
SELECT ROW(CAST(NULL AS INT), CAST(NULL AS INT)) IS NOT NULL; -- returns
FALSE
SELECT ROW(CAST(NULL AS INT), CAST(NULL AS INT)) IS NULL; -- returns TRUE
.
SELECT ROW(CAST(NULL AS INT), CAST(NULL AS INT)) IS NOT NULL; -- returns TRUE
SELECT ROW(CAST(NULL AS INT), CAST(NULL AS INT)) IS NULL; -- returns FALSE
Once Flink applies same logic for both table api and sql, this first changes should be removed.
2. It uses StructKind.PEEK_FIELDS_NO_EXPAND
with a nested struct type (Flink [[RowType
]]).
See more at LogicalRelDataTypeConverter
and
FlinkTypeFactory
.
Changed lines
Constructor and Description |
---|
SqlRowOperator(String name) |
Modifier and Type | Method and Description |
---|---|
org.apache.calcite.rel.type.RelDataType |
inferReturnType(org.apache.calcite.sql.SqlOperatorBinding opBinding) |
boolean |
requiresDecimalExpansion() |
void |
unparse(org.apache.calcite.sql.SqlWriter writer,
org.apache.calcite.sql.SqlCall call,
int leftPrec,
int rightPrec) |
acceptCall, acceptCall, adjustType, allowsFraming, argumentMustBeScalar, checkOperandCount, checkOperandTypes, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, createCall, createCall, createCall, deriveType, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getMonotonicity, getName, getNameAsId, getOperandCountRange, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSignatureTemplate, getStrongPolicyInference, hashCode, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, isSymmetrical, leftPrec, not, preValidateCall, requiresOrder, requiresOver, reverse, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateCall, validateOperands, validRexOperands
public SqlRowOperator(String name)
public org.apache.calcite.rel.type.RelDataType inferReturnType(org.apache.calcite.sql.SqlOperatorBinding opBinding)
inferReturnType
in class org.apache.calcite.sql.SqlOperator
public void unparse(org.apache.calcite.sql.SqlWriter writer, org.apache.calcite.sql.SqlCall call, int leftPrec, int rightPrec)
unparse
in class org.apache.calcite.sql.SqlOperator
public boolean requiresDecimalExpansion()
requiresDecimalExpansion
in class org.apache.calcite.sql.SqlOperator
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.