[jira] [Updated] (CALCITE-5879) Calcite crashes with AssertionFailure during evaluation of constant SPLIT expression

2023-07-31 Thread Ruben Q L (Jira)


 [ 
https://issues.apache.org/jira/browse/CALCITE-5879?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ruben Q L updated CALCITE-5879:
---
Fix Version/s: 1.36.0

> 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
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.36.0
>
>
> 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)


[jira] [Updated] (CALCITE-5879) Calcite crashes with AssertionFailure during evaluation of constant SPLIT expression

2023-07-28 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/CALCITE-5879?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated CALCITE-5879:

Labels: pull-request-available  (was: )

> 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
>Priority: Minor
>  Labels: pull-request-available
>
> 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)