Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.32.0
-
None
Description
The following test case would fail if added to RelToSqlConverterTest.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); }
The exception is:
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)
Cause of failure seems to be that `RelToSqlConverter::visitAntiOrSemiJoin` rewrites semi-join as select with no associated alias.
Attachments
Issue Links
- links to