[
https://issues.apache.org/jira/browse/CALCITE-6399?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Benchao Li reopened CALCITE-6399:
---------------------------------
> The predicate IN is transformed by the sqltorelConverter into join
> ------------------------------------------------------------------
>
> Key: CALCITE-6399
> URL: https://issues.apache.org/jira/browse/CALCITE-6399
> Project: Calcite
> Issue Type: Wish
> Components: core
> Affects Versions: 1.36.0
> Reporter: kate
> Priority: Minor
>
>
> *Simple Example:*
>
> My SqlToRelConverter:
> {code:java}
> SqlToRelConverter.Config config = new SqlToRelNodeConfig()
> .withTrimUnusedFields(true)
> .withRelBuilderFactory(RelFactories.LOGICAL_BUILDER)
> .withRelBuilderConfigTransform(relBuilderConfig -> relBuilderConfig
> .withSimplify(false))
> .withHintStrategyTable(HintStrategyTable.EMPTY);
> RelRoot root = sqlToRelConverter.convertQuery(sqlNode, false, false);
> {code}
>
>
> SQL
>
> {code:java}
> SELECT cd_gender,
> cd_marital_status,
> cd_education_status, cd_purchase_estimate,
> cd_credit_rating, cd_dep_count,
> cd_dep_employed_count, cd_dep_college_countFROM
> pg.tpcds.customer c,
> pg.tpcds. customer_address ca,
> pg.tpcds.customer_demographics
> WHERE c.c_current_addr_sk = ca.ca_address_sk
> AND cd_demo_sk = c.c_current_cdemo_sk
> AND ca_county IN ( 'Lycoming County', 'Sheridan County', 'Kandiyohi
> County',Pike County','Greene County' )
> {code}
>
> RelNode tree after converting
>
>
> {code:java}
> LogicalProject(cd_gender=[$32], cd_marital_status=[$33],
> cd_education_status=[$34], cd_purchase_estimate=[$35],
> cd_credit_rating=[$36], cd_dep_count=[$37], cd_dep_employed_count=[$38],
> cd_dep_college_count=[$39])
> LogicalFilter(condition=[AND(=($4, $18), true, =($31, $2))])
> LogicalJoin(condition=[=($25, $40)], joinType=[inner])
> LogicalJoin(condition=[true], joinType=[inner])
> LogicalJoin(condition=[true], joinType=[inner])
> LogicalTableScan(table=[[tpcds, customer]])
> LogicalTableScan(table=[[tpcds, customer_address]])
> LogicalTableScan(table=[[tpcds, customer_demographics]])
> LogicalAggregate(group=[{0}])
> LogicalUnion(all=[true])
> LogicalValues(tuples=[[{ 'Lycoming County' }]])
> LogicalValues(tuples=[[{ 'Sheridan County' }]])
> LogicalValues(tuples=[[{ 'Kandiyohi County' }]])
> LogicalValues(tuples=[[{ 'Pike County' }]])
> LogicalValues(tuples=[[{ 'Greene County' }]]) {code}
>
> I'm trying to figure out how to keep in as a filter instead of converting it
> to a join value.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)