datafusion icon indicating copy to clipboard operation
datafusion copied to clipboard

feat: Enforce the uniqueness of map key name for the map/make_map function

Open Weijun-H opened this issue 1 year ago • 2 comments

Which issue does this PR close?

Closes #11437

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

Weijun-H avatar Aug 25 '24 08:08 Weijun-H

Thanks @Weijun-H overall LGTM. I also tested some cases for nested type as the key. They work well. 👍

# Test duplicate keys
query error DataFusion error: Execution error: map key must be unique, duplicate key found: \[1, 2\]
SELECT MAP([[1,2], [1,2], []], [41, 33, null]);

# Test duplicate keys
query error DataFusion error: Execution error: map key must be unique, duplicate key found: \[\{1:1\}\]
SELECT MAP([Map {1:'1'}, Map {1:'1'}, Map {2:'2'}], [41, 33, null]);

Nice catch! I added them to the tests

Weijun-H avatar Aug 26 '24 15:08 Weijun-H

I plan to review this today

dharanad avatar Aug 27 '24 10:08 dharanad

@jayzhan211 do you have some time to review this pr?

Weijun-H avatar Sep 01 '24 08:09 Weijun-H

Thank you @dharanad @goldmedal @jayzhan211

Weijun-H avatar Sep 04 '24 09:09 Weijun-H