[ https://issues.apache.org/jira/browse/FLINK-25699?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17482313#comment-17482313 ]
Sergey Nuyanzin edited comment on FLINK-25699 at 1/26/22, 7:59 AM: ------------------------------------------------------------------- thanks for your comments. Regarding comparison {{actual vs expected }} instead of toString comparison it is also possible to compare the result of {{MAP[]}}}} and cardinality. It will allow to independent on string representation (may be except maps with cardinality less than 2). The drawback is that for one map need to write more tests e.g. {code:scala} testAllApis( map(1, 2L , 3, 4L).at(1), "map(1, 2L, 3, 4L).at(1)", "MAP[1, CAST(2 AS BIGINT), 3, CAST(4 AS BIGINT)][1]", "2") testAllApis( map(1, 2L , 3, 4L).at(3), "map(1, 2L, 3, 4L).at(3)", "MAP[1, CAST(2 AS BIGINT), 3, CAST(4 AS BIGINT)][3]", "4") testAllApis( map(1, 2L , 3, 4L).cardinality(), "map(1, 2L, 3, 4L).cardinality()", "CARDINALITY(MAP[1, CAST(2 AS BIGINT), 3, CAST(4 AS BIGINT)])", "2") {code} was (Author: sergey nuyanzin): thanks for your comments. Regarding comparison {{actual vs expected }} instead of toString comparison it is also possible to compare the result of {{MAP[]}} and cardinality. It will allow to independent on string representation (may be except maps with cardinality less than 2). The drawback is that for one map need to write more tests e.g. {code:scala} testAllApis( map(1, 2L , 3, 4L).at(1), "map(1, 2L, 3, 4L).at(1)", "MAP[1, CAST(2 AS BIGINT), 3, CAST(4 AS BIGINT)][1]", "2") testAllApis( map(1, 2L , 3, 4L).at(3), "map(1, 2L, 3, 4L).at(3)", "MAP[1, CAST(2 AS BIGINT), 3, CAST(4 AS BIGINT)][3]", "4") testAllApis( map(1, 2L , 3, 4L).cardinality(), "map(1, 2L, 3, 4L).cardinality()", "CARDINALITY(MAP[1, CAST(2 AS BIGINT), 3, CAST(4 AS BIGINT)])", "2") {code} > Use HashMap for MAP value constructors > -------------------------------------- > > Key: FLINK-25699 > URL: https://issues.apache.org/jira/browse/FLINK-25699 > Project: Flink > Issue Type: Sub-task > Components: Table SQL / Runtime > Reporter: Timo Walther > Assignee: Sergey Nuyanzin > Priority: Major > > Currently, the usage of maps is inconsistent. It is not ensured that > duplicate keys get eliminated. For CAST and output conversion this is solved. > However, we should have a similar implementation in MAP value constructor > like in CAST. -- This message was sent by Atlassian Jira (v8.20.1#820001)