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_pop_back function #6997

Closed
izveigor opened this issue Jul 17, 2023 · 5 comments · Fixed by #7348
Closed

Implement array_pop_back function #6997

izveigor opened this issue Jul 17, 2023 · 5 comments · Fixed by #7348
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_pop_back
Aliases: list_pop_back
Original function?: No
Function Description: ClickHouse: Removes the last item from the array.
DuckDB: Returns the list without the last element.
Sources: Concept DuckDB ClickHouse

Examples:

D select array_pop_back([1, 2, 3, 4]);
┌─────────────────────────────────────────────┐
│ array_pop_back(main.list_value(1, 2, 3, 4)) │
│                   int32[]                   │
├─────────────────────────────────────────────┤
│ [1, 2, 3]                                   │
└─────────────────────────────────────────────┘
D select array_pop_back([[1, 2], [3, 4], [4, 2]]);
┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ array_pop_back(main.list_value(main.list_value(1, 2), main.list_value(3, 4), main.list_value(4, 2))) │
│                                              int32[][]                                               │
├──────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ [[1, 2], [3, 4]]                                                                                     │
└──────────────────────────────────────────────────────────────────────────────────────────────────────┘

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

@tanruixiang
Copy link
Member

Hi, I'm interested in this issue, can I give it a try?

@izveigor
Copy link
Contributor Author

izveigor commented Aug 6, 2023

Hello, @tanruixiang!
Yes, you can give it. It seems to me that the implementation is to use array_slice function, like array_slice(array, 0, len(array)-1).

@tanruixiang
Copy link
Member

Hello, @tanruixiang! Yes, you can give it. It seems to me that the implementation is to use array_slice function, like array_slice(array, 0, len(array)-1).

Thank you very much for your advice.❤️

@jayzhan211
Copy link
Contributor

@tanruixiang Also ping me when you are ready for review.

@tanruixiang
Copy link
Member

@izveigor @jayzhan211 I apologize for the longer delay in this issue due to some other things. It is now ready for REVIEW.

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.

3 participants