[
https://issues.apache.org/jira/browse/FLINK-14613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16969194#comment-16969194
]
hailong wang commented on FLINK-14613:
--------------------------------------
Hi [~jark], you are right. I have some misunderstanding before. There are two
situation:
(1) Join condition has an UDF in temporal join key and other equi-conditions.
Example as following:
{code:java}
INSERT INTO A
SELECT B.amount, B.currency, C.amount, C.product
FROM B join C FOR SYSTEM_TIME AS OF B.proctime
on B.amount = cancat(C.amount, 'r') and C.product = '1'
{code}
For now, the program runs normally. But the join condition of ' B.amount =
cancat(C.amount, 'r')' is ignored, and the final condition is 'C.product = '1'.
So the result is error. So we should add 'B.amount = cancat(C.amount, 'r')' to
remainingJoinCondition.
(2) Join condition only has an UDF in temporal join key. Example as following:
{code:java}
INSERT INTO A SELECT B.amount, B.currency, C.amount, C.product FROM B join C
FOR SYSTEM_TIME AS OF B.proctime on B.amount = cancat(C.amount, 'r')
{code}
It will throw error:
{code:java}
Temporal table join requires an equality condition on fields of table ……
{code}
I think it's reasonable.
If we want to fix this, I think we should lookup the all rows from Temporal
Table, and add remainingJoinCondition in JoinCollector.
In conclusion, we should fix the first situation by adding 'B.amount =
cancat(C.amount, 'r')' to remainingJoinCondition.
Thanks you.
> Add validation check when applying UDF to tempral table key in Temporal
> Table Join condition
> -----------------------------------------------------------------------------------------------
>
> Key: FLINK-14613
> URL: https://issues.apache.org/jira/browse/FLINK-14613
> Project: Flink
> Issue Type: Improvement
> Components: Table SQL / Planner
> Affects Versions: 1.9.1
> Reporter: hailong wang
> Priority: Major
> Fix For: 1.10.0
>
>
> In Temporal Table Join, We don't support using UDF in tempral table join
> key. For we can't analyze LookupKeys when call is an expression. When users
> use like this, the program run normally, and the result will be wrong. So we
> should add validation to prevent it.
> The SQL as following:
> {code:java}
> INSERT INTO A
> SELECT B.amount, B.currency, C.amount, C.product
> FROM B join C FOR SYSTEM_TIME AS OF B.proctime
> on B.amount = cancat(C.amount, 'r') and C.product = '1'
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)