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

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

Maybe I misunderstood your meaning. Is the purpose to push the Filter into the 
Join, or to push the Filter or Join conditions over the Join? If it is the 
first one, I think it should be possible to directly modify 
JdbcJoinRule#canJoinOnCondition. If we want to push the filter through the 
join, we may need to modify JOIN_CONDITION_PUSH. As you said, we should not 
expand the search, and we may need to directly implement the search push down. 
I'm not sure this idea is reasonable or not.

> 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)

Reply via email to