[
https://issues.apache.org/jira/browse/FLINK-41321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18137799#comment-18137799
]
sepuri sai krishna commented on FLINK-41321:
--------------------------------------------
Correction to the join example above.
I rechecked it against the planner output and both VALUES queries are constant
folded, so neither
of them runs a join. The map form optimises to Join(joinType=[InnerJoin],
where=[true]) over two
COUNT(*) subplans, which is why it answers 1. The array form optimises to
Values(tuples=[[{ 0 }]]),
the join is gone entirely, which is why it answers 0.
Read from a table source instead of literals, both forms return no rows. So the
"same join, two
answers" contrast does not hold, and that part of the description should come
out.
The rest is unchanged and still reproduces over real columns. With m1 and m2
read from a CSV table,
m1 = m2 is TRUE and ARRAY[m1] = ARRAY[m2] is FALSE.
A join on a plain MAP key returning no rows is a separate problem, filed as
FLINK-41328.
> A join on an ARRAY<MAP> key returns no rows, although the same two maps
> compare equal with =
> --------------------------------------------------------------------------------------------
>
> Key: FLINK-41321
> URL: https://issues.apache.org/jira/browse/FLINK-41321
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Planner
> Affects Versions: 2.4.0
> Reporter: sepuri sai krishna
> Priority: Major
>
> Two maps holding the same entries in a different order compare equal.
> Wrapping each one in an array
> reverses the answer, and a join on such a column returns no rows.
> {code:sql}
> SELECT MAP['a',1,'b',2] = MAP['b',2,'a',1]; -- TRUE
> SELECT ARRAY[MAP['a',1,'b',2]] = ARRAY[MAP['b',2,'a',1]]; -- FALSE
> SELECT COUNT(*)
> FROM (VALUES (ARRAY[MAP['a',1,'b',2]])) AS l(m)
> JOIN (VALUES (ARRAY[MAP['b',2,'a',1]])) AS r(m) ON l.m = r.m; -- 0
> {code}
> The same join on the maps themselves returns 1. Same data, same join, two
> answers depending on
> whether the key is a map or an array of maps, with no error and no warning.
> Also reproduced with
> both values arriving from a table source rather than as literals.
> Not FLINK-41013: that one's wrong results are all the sign of zero, and there
> is no FLOAT or DOUBLE
> in this query.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)