Mihai Budiu created CALCITE-5879:
------------------------------------
Summary: Calcite crashes with AssertionFailure during evaluation
of constant SPLIT expression
Key: CALCITE-5879
URL: https://issues.apache.org/jira/browse/CALCITE-5879
Project: Calcite
Issue Type: Bug
Components: core
Affects Versions: 1.35.0
Reporter: Mihai Budiu
The following test, when inserted in RelOptRulesTest, crashes at compilation
time with an AssertionFailure:
{code:java}
@Test public void testSplit() {
final String query = "select split('1|2|3', NULL)";
sql(query)
.withFactory(
t -> t.withOperatorTable(opTab ->
SqlLibraryOperatorTableFactory.INSTANCE.getOperatorTable(
SqlLibrary.BIG_QUERY))) // needed for SPLIT function
.withRule(CoreRules.PROJECT_REDUCE_EXPRESSIONS)
.check();
}
{code}
The error message and stack trace look like this:
{code:java}
java.lang.AssertionError: Cannot add expression of different type to set:
set type is RecordType(CHAR(5) NOT NULL ARRAY NOT NULL EXPR$0) NOT NULL
expression type is RecordType(CHAR(5) NOT NULL ARRAY EXPR$0) NOT NULL
set is rel#4:LogicalProject.(input=HepRelVertex#3,exprs=[SPLIT('1|2|3',
null:NULL)])
expression is LogicalProject(EXPR$0=[null:CHAR(5) NOT NULL ARRAY])
LogicalValues(tuples=[[{ 0 }]])
Type mismatch:
rowtype of original rel: RecordType(CHAR(5) NOT NULL ARRAY NOT NULL EXPR$0) NOT
NULL
rowtype of new rel: RecordType(CHAR(5) NOT NULL ARRAY EXPR$0) NOT NULL
Difference:
EXPR$0: CHAR(5) NOT NULL ARRAY NOT NULL -> CHAR(5) NOT NULL ARRAY
at
org.apache.calcite.plan.RelOptUtil.verifyTypeEquivalence(RelOptUtil.java:394)
at
org.apache.calcite.plan.hep.HepRuleCall.transformTo(HepRuleCall.java:60)
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)