[
https://issues.apache.org/jira/browse/FLINK-32447?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
lincoln lee resolved FLINK-32447.
---------------------------------
Resolution: Fixed
fixed in master: e35f33f539b09b2c18fb826a144c08541e148dd0
> table hints lost when they inside a view referenced by an external query
> ------------------------------------------------------------------------
>
> Key: FLINK-32447
> URL: https://issues.apache.org/jira/browse/FLINK-32447
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Planner
> Affects Versions: 1.17.1
> Reporter: lincoln lee
> Assignee: lincoln lee
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.18.0, 1.17.2
>
>
> Table hints will lost when they inside a view referenced by an external
> query, this is due to the upgrading of calcite-1.28 (affected by CALCITE-4640
> which changed the default implementation of SqlDialect suppresses all table
> hints).
> This can be reproduced by adding a new case to current
> {code}OptionsHintTest{code}:
> {code}
> +
> + @Test
> + def testOptionsHintInsideView(): Unit = {
> + util.tableEnv.executeSql(
> + "create view v1 as select * from t1 /*+ OPTIONS(k1='#v111',
> k4='#v444')*/")
> + util.verifyExecPlan(s"""
> + |select * from t2 join v1 on v1.a = t2.d
> + |""".stripMargin)
> + }
> {code}
> wrong plan which lost table hints(dynamic options):
> {code}
> Join(joinType=[InnerJoin], where=[(a = d)], select=[d, e, f, a, b, c],
> leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey])
> :- Exchange(distribution=[hash[d]])
> : +- LegacyTableSourceScan(table=[[default_catalog, default_database, t2,
> source: [OptionsTableSource(props={k3=v3, k4=v4})]]], fields=[d, e, f])
> +- Exchange(distribution=[hash[a]])
> +- Calc(select=[a, b, (a + 1) AS c])
> +- LegacyTableSourceScan(table=[[default_catalog, default_database, t1,
> source: [OptionsTableSource(props={k1=v1, k2=v2})]]], fields=[a, b])
> {code}
> We should use {code}AnsiSqlDialect{code} instead to reserve table hints.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)