Skip to content

Enforce the uniqueness of map key name for the map/make_map function #11437

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
Tracked by #11429
goldmedal opened this issue Jul 12, 2024 · 3 comments · Fixed by #12153
Closed
Tracked by #11429

Enforce the uniqueness of map key name for the map/make_map function #11437

goldmedal opened this issue Jul 12, 2024 · 3 comments · Fixed by #12153
Labels
enhancement New feature or request

Comments

@goldmedal
Copy link
Contributor

Is your feature request related to a problem or challenge?

In most databases, the map type only allows unique keys. Refer to the behavior of DuckDB:

D select map {'1':1, '1':2};
Invalid Input Error: Map keys must be unique.

However, the specification of MapArray states:

/// In this layout, the keys and values are each respectively contiguous. We do
/// not constrain the key and value types, so the application is responsible
/// for ensuring that the keys are hashable and unique. Whether the keys are sorted
/// may be set in the metadata for this field.

MapArray is not responsible for ensuring the uniqueness of keys. Therefore, we should ensure the keys are unique on the application side (DataFusion).

Describe the solution you'd like

We can check the keys are distinct when invoking the map and make_map functions.

Describe alternatives you've considered

No response

Additional context

No response

@dharanad
Copy link
Contributor

take

@Weijun-H
Copy link
Member

Hi @dharanad, if you're no longer working on this ticket, I can take over.

@dharanad
Copy link
Contributor

Hi @dharanad, if you're no longer working on this ticket, I can take over.

Hey, please feel free to take it

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants