[ https://issues.apache.org/jira/browse/CALCITE-5394?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jess Balint closed CALCITE-5394. -------------------------------- Resolved in release 1.33.0 (2023-02-06) > RelToSql converter fails when semi-join is under a join node > ------------------------------------------------------------ > > Key: CALCITE-5394 > URL: https://issues.apache.org/jira/browse/CALCITE-5394 > Project: Calcite > Issue Type: Bug > Affects Versions: 1.32.0 > Reporter: Leonid Chistov > Assignee: Jiajun Xie > Priority: Minor > Labels: pull-request-available > Fix For: 1.33.0 > > Time Spent: 0.5h > Remaining Estimate: 0h > > The following test case would fail if added to RelToSqlConverterTest.java: > {code:java} > @Test void testSemiJoinUnderJoin() { > final RelBuilder builder = relBuilder(); > final RelNode base = builder > .scan("EMP") > .scan("EMP") > .join( > JoinRelType.SEMI, builder.equals( > builder.field(2, 0, "EMPNO"), > builder.field(2, 1, "EMPNO"))) > .build(); > final RelNode root = builder > .scan("DEPT") > .push(base) > .join( > JoinRelType.INNER, builder.equals( > builder.field(2, 1, "DEPTNO"), > builder.field(2, 0, "DEPTNO"))) > .project(builder.field("DEPTNO")) > .build(); > toSql(root); > } {code} > The exception is: > {code:java} > alias > java.lang.NullPointerException: alias > at java.base/java.util.Objects.requireNonNull(Objects.java:233) > at > org.apache.calcite.rel.rel2sql.SqlImplementor.collectAliases(SqlImplementor.java:493) > at > org.apache.calcite.rel.rel2sql.SqlImplementor.collectAliases(SqlImplementor.java:491) > at > org.apache.calcite.rel.rel2sql.SqlImplementor.result(SqlImplementor.java:476) > at > org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:246) > {code} > Cause of failure seems to be that `RelToSqlConverter::visitAntiOrSemiJoin` > rewrites semi-join as select with no associated alias. -- This message was sent by Atlassian Jira (v8.20.10#820010)