Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Implement array_distinct function #7289

Closed
izveigor opened this issue Aug 15, 2023 · 2 comments · Fixed by #8268
Closed

Implement array_distinct function #7289

izveigor opened this issue Aug 15, 2023 · 2 comments · Fixed by #8268
Assignees
Labels
enhancement New feature or request

Comments

@izveigor
Copy link
Contributor

Is your feature request related to a problem or challenge?

Summary

Characteristic Description
Function name: array_distinct
Aliases: list_distinct
Original function?: No
Function Description: DuckDB: Removes all duplicates and NULLs from a list. Does not preserve the original order.
Azure DataBricks: Removes duplicate values from array.
SQL Spark: Return distinct values from the array after removing duplicates.
Sources: Concept DuckDB Azure Spark

Examples:

D select array_distinct([1, 3, 2, 3, 1, 2, 4]);
┌──────────────────────────────────────────────────────┐
│ array_distinct(main.list_value(1, 3, 2, 3, 1, 2, 4)) │
│                       int32[]                        │
├──────────────────────────────────────────────────────┤
│ [4, 2, 3, 1]                                         │
└──────────────────────────────────────────────────────┘
D select array_distinct(['a', 'b', 'c', 'd']);
┌─────────────────────────────────────────────────────┐
│ array_distinct(main.list_value('a', 'b', 'c', 'd')) │
│                      varchar[]                      │
├─────────────────────────────────────────────────────┤
│ [b, d, c, a]                                        │
└─────────────────────────────────────────────────────┘

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

@my-vegetable-has-exploded
Copy link
Contributor

May I try this issue?

@my-vegetable-has-exploded
Copy link
Contributor

Shall we preserve the original order here?

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

Successfully merging a pull request may close this issue.

2 participants