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

Jane Chan commented on FLINK-34034:
-----------------------------------

Hi [~xuyangzhong], thanks for reporting this issue.

According to the implementation, the description of the [hint 
doc|https://nightlies.apache.org/flink/flink-docs-release-1.18/docs/dev/table/sql/queries/hints/#conflict-cases-in-join-hints]
 does not match the actual behavior.
{quote}If the Join Hints conflicts occur, Flink will choose the most matching 
one. Conflict in one same Join Hint strategy, Flink will choose the first 
matching table for a join. Conflict in different Join Hints strategies, Flink 
will choose the first matching hint for a join.
{quote}

However, I think having different behavior for the list option and KV options 
makes sense. For example, Java Map does not allow duplicate KVs, while the List 
is okay to have duplicated items.

> When kv hint and list hint handle duplicate query hints, the results are 
> different.
> -----------------------------------------------------------------------------------
>
>                 Key: FLINK-34034
>                 URL: https://issues.apache.org/jira/browse/FLINK-34034
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>            Reporter: xuyang
>            Assignee: xuyang
>            Priority: Minor
>
> When there are duplicate keys in the kv hint, calcite will overwrite the 
> previous value with the later value.
> {code:java}
> @TestTemplate
> def test(): Unit = {
>   val sql =
>     "SELECT /*+ LOOKUP('table'='D', 'retry-predicate'='lookup_miss', 
> 'retry-strategy'='fixed_delay', 'fixed-delay'='10s','max-attempts'='3', 
> 'max-attempts'='4') */ * FROM MyTable AS T JOIN LookupTable " +
>       "FOR SYSTEM_TIME AS OF T.proctime AS D ON T.a = D.id"
>   util.verifyExecPlan(sql)
> } {code}
> {code:java}
> Calc(select=[a, b, c, PROCTIME_MATERIALIZE(proctime) AS proctime, rowtime, 
> id, name, age]) 
>   +- LookupJoin(table=[default_catalog.default_database.LookupTable], 
> joinType=[InnerJoin], lookup=[id=a], select=[a, b, c, proctime, rowtime, id, 
> name, age], retry=[lookup_miss, FIXED_DELAY, 10000ms, 4]) 
>     +- DataStreamScan(table=[[default_catalog, default_database, MyTable]], 
> fields=[a, b, c, proctime, rowtime])
> {code}
> But when a list hint is duplicated (such as a join hint), we will choose the 
> first one as the effective hint.
>  



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

Reply via email to