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

xuyang commented on FLINK-34034:
--------------------------------

Hi, [~qingyue]

Our documentation currently seems not to expose whether table hints and join 
hints are kv hints or list hints. I believe that further exposing to users 
whether a certain type of query hint is a list or kv hint is not beneficial, as 
it would then need to tell users about their different behaviors: in case of a 
conflict, a list hint will choose the first one, whereas a kv hint, processed 
by Calcite, will select the last one when their keys are the same one. I prefer 
to let the framework ensure the consistency of these behaviors. WDYT?

> 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