You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Zhen Chen (Jira)" <ji...@apache.org> on 2025/03/30 13:11:00 UTC

[jira] [Commented] (CALCITE-6924) FilterIntoJoinRule make JdbcJoin contains expressions that it does not support

    [ https://issues.apache.org/jira/browse/CALCITE-6924?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17939485#comment-17939485 ] 

Zhen Chen commented on CALCITE-6924:
------------------------------------

[~nobigo] Hi, I don't know if you are solving this problem, if not, can I try to solve it?

> FilterIntoJoinRule make JdbcJoin contains expressions that it does not support
> ------------------------------------------------------------------------------
>
>                 Key: CALCITE-6924
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6924
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: xiong duan
>            Priority: Major
>
> The unit test in JdbcTest:
> {code:java}
> @Test void testJdbcJoin() {
>   CalciteAssert.that()
>       .with(CalciteAssert.Config.JDBC_FOODMART)
>       .query("select *\n"
>           + "from \"foodmart\".\"store\" as p1\n"
>           + "inner join \"foodmart\".\"store\" as p2 on true\n"
>           + "where p1.\"store_id\" between 10 and 20 or p1.\"grocery_sqft\" = p2.\"grocery_sqft\"")
>       .explainContains("PLAN=" +
>           "JdbcToEnumerableConverter\n" +
>           "  JdbcJoin(condition=[OR(SEARCH($0, Sarg[[10..20]]), =($16, $40))], joinType=[inner])\n" +
>           "    JdbcTableScan(table=[[foodmart, store]])\n" +
>           "    JdbcTableScan(table=[[foodmart, store]])\n\n");
> }
> @Test void testJdbcJoin2() {
>   CalciteAssert.that()
>       .with(CalciteAssert.Config.JDBC_FOODMART)
>       .query("select *\n"
>           + "from \"foodmart\".\"store\" as p1\n"
>           + "inner join \"foodmart\".\"store\" as p2\n"
>           + "on p1.\"store_id\" between 10 and 20 or p1.\"grocery_sqft\" = p2.\"grocery_sqft\"")
>       .explainContains("PLAN=" +
>           "EnumerableNestedLoopJoin(condition=[OR(SEARCH($0, Sarg[[10..20]]), =($16, $40))], joinType=[inner])\n" +
>           "  JdbcToEnumerableConverter\n" +
>           "    JdbcTableScan(table=[[foodmart, store]])\n" +
>           "  JdbcToEnumerableConverter\n" +
>           "    JdbcTableScan(table=[[foodmart, store]])\n\n");
> } {code}
> The testJdbcJoin test generate :
> {code:java}
> JdbcJoin(condition=[OR(SEARCH($0, Sarg[[10..20]]), =($16, $40))], joinType=[inner]){code}
> But the JdbcJoinRule#canJoinOnCondition doesn't include the SEARCH operator, so the condition can't push down to JdbcJoin like testJdbcJoin2.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)