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

array_slice panics with stride=1 #10425

Closed
Tracked by #670
Michael-J-Ward opened this issue May 8, 2024 · 2 comments · Fixed by #10547
Closed
Tracked by #670

array_slice panics with stride=1 #10425

Michael-J-Ward opened this issue May 8, 2024 · 2 comments · Fixed by #10547
Assignees
Labels
bug Something isn't working

Comments

@Michael-J-Ward
Copy link
Contributor

Describe the bug

See reproduction for specific example that triggers the panic.

Some combination of a column with varying size arrays, a negative start index, a positive end index, and stride explicitly set to one triggers the panic.

To Reproduce

CREATE TEMPORARY VIEW data3 AS VALUES ([1.0, 2.0, 3.0, 3.0]), ([4.0, 5.0, 3.0]), ([6.0]);
❯ select * from data3;
+----------------------+
| column1              |
+----------------------+
| [1.0, 2.0, 3.0, 3.0] |
| [4.0, 5.0, 3.0]      |
| [6.0]                |
+----------------------+select array_slice(column1, -1, 2, 1) from data3;
thread 'main' panicked at /Users/andy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/arrow-data-51.0.0/src/transform/primitive.rs:31:43:
range end index 9 out of range for slice of length 8

Expected behavior

Doesn't panic. Works just like the stride=1 default.

+-----------------------------------------------+
| array_slice(data3.column1,Int64(-1),Int64(2)) |
+-----------------------------------------------+
| []                                            |
| []                                            |
| [6.0]                                         |

Additional context

This was found upgrading datafusion-python: apache/datafusion-python#669

@jonahgao
Copy link
Member

take

@jonahgao
Copy link
Member

I plan to work on this after #10424 is resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants