Mihai Budiu created CALCITE-6129:
------------------------------------
Summary: SqlToRelConverter throws an exception when converting a
NULL SqlLiteral
Key: CALCITE-6129
URL: https://issues.apache.org/jira/browse/CALCITE-6129
Project: Calcite
Issue Type: Bug
Components: core
Affects Versions: 1.36.0
Reporter: Mihai Budiu
The problem is in SqlNodeToRexConverterImpl.convertLiteral. This function
attempts to handle NULL literals differently from all other literals:
{code:java}
final RexBuilder rexBuilder = cx.getRexBuilder();
if (literal.getValue() == null) {
RelDataType type = cx.getValidator().getValidatedNodeType(literal);
return rexBuilder.makeNullLiteral(type);
}
switch (literal.getTypeName()) {
...
{code}
However, such a literal does *not* have a validated data type, to
getValidatedNodeType will throw Util.needToImplement.
The solution would be to handle NULL literals like all other literals and
create a literal with a NULL type.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)