[
https://issues.apache.org/jira/browse/CALCITE-3575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16989522#comment-16989522
]
Wang Yanlin commented on CALCITE-3575:
--------------------------------------
{code:java}
// JdbcTest
@Test public void testPushDownJoin() {
CalciteAssert.hr()
.query(
"select * from\n"
+ " (select \"empid\", \"deptno\", \"name\", \"salary\" from
\"hr\".\"emps\") a\n"
+ " join \"hr\".\"depts\" b on a.\"deptno\" + 20 =
b.\"deptno\"")
.returnsUnordered("xxxx");
}
{code}
got
{noformat}
java.lang.IndexOutOfBoundsException: index (8) must be less than size (8)
at
com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:310)
at
com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:293)
at
com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:67)
at
org.apache.calcite.plan.RelOptUtil$2.visitInputRef(RelOptUtil.java:2856)
at
org.apache.calcite.plan.RelOptUtil$2.visitInputRef(RelOptUtil.java:2854)
at org.apache.calcite.rex.RexInputRef.accept(RexInputRef.java:112)
at org.apache.calcite.rex.RexShuttle.visitList(RexShuttle.java:164)
at
org.apache.calcite.plan.RelOptUtil.pushPastProject(RelOptUtil.java:2849)
at org.apache.calcite.tools.RelBuilder.project(RelBuilder.java:1328)
at
org.apache.calcite.tools.RelBuilder.projectNamed(RelBuilder.java:1471)
at
org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectList(SqlToRelConverter.java:4010)
at
org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:688)
at
org.apache.calcite.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:645)
at
org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:3229)
at
org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:571)
at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:265)
at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:231)
at
org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:638)
at
org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:502)
at
org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:472)
at
org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:231)
at
org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:550)
at
org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:675)
at
org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
... 71 more
{noformat}
> JOIN pushDownJoinConditions BUG
> -------------------------------
>
> Key: CALCITE-3575
> URL: https://issues.apache.org/jira/browse/CALCITE-3575
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.18.0, 1.19.0, 1.20.0, 1.21.0
> Reporter: 小黑一点都不黑
> Priority: Critical
> Attachments: image-2019-12-06-14-30-26-738.png
>
>
> In the case, a join statement with equal condition and left is expression
> instead of column, will fire the bug. the reason is pushDownJoinConditions
> method does't add left project node to SqlToRelConverter.leaves。
> My english is poor, did I make myself clear?
> !image-2019-12-06-14-30-26-738.png!
--
This message was sent by Atlassian Jira
(v8.3.4#803005)