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

feat: Support for extended array slicing with step #12405

Open
jetjinser opened this issue Sep 18, 2023 · 5 comments
Open

feat: Support for extended array slicing with step #12405

jetjinser opened this issue Sep 18, 2023 · 5 comments
Assignees

Comments

@jetjinser
Copy link
Contributor

jetjinser commented Sep 18, 2023

Is your feature request related to a problem? Please describe.

I think this feature will be helpful if I want to get a value from the array every few steps, or reverse the array.

Describe the solution you'd like

The array slicing syntax arr[lower-bound:upper-bound:step] is commonly used in many languages (e.g. python), where step is an integer that can be positive or negative. A step of -1 in particular is used to reverse the array.

This does not break compatibility, omitting step just treats it as a special case of 1.

By introducing this feature, we can benefit from the following:

  • Ability to extract every Nth element from an array, making data analysis and processing more efficient.
  • Convenient reversal of arrays by specifying a negative step.

btw, array_reverse is not implemented yet.

Describe alternatives you've considered

I haven't figured out how to do it yet.

Additional context

@github-actions github-actions bot added this to the release-1.3 milestone Sep 18, 2023
@lmatz
Copy link
Contributor

lmatz commented Sep 19, 2023

duckdb/duckdb#8087 duckDB also adds the step and negative reverse index

@fuyufjh
Copy link
Member

fuyufjh commented Oct 10, 2023

@lmatz Can you pls take a look?

@lmatz
Copy link
Contributor

lmatz commented Oct 10, 2023

@lmatz Can you pls take a look?

I have no bandwidth at the moment.

@jetjinser jin do you want to do it? It's ok if you also have no bandwidth at the moment.

@jetjinser
Copy link
Contributor Author

@jetjinser jin do you want to do it? It's ok if you also have no bandwidth at the moment.

No problem with me, I'll start soon after finishing what I'm currently working on.

Copy link
Contributor

This issue has been open for 60 days with no activity. Could you please update the status? Feel free to continue discussion or close as not planned.

@fuyufjh fuyufjh removed this from the release-1.5 milestone Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants