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

Panic with struct function with arguments intermixed arrays / scalar #9773

Closed
alamb opened this issue Mar 24, 2024 · 0 comments · Fixed by #9775
Closed

Panic with struct function with arguments intermixed arrays / scalar #9773

alamb opened this issue Mar 24, 2024 · 0 comments · Fixed by #9775
Assignees
Labels
bug Something isn't working

Comments

@alamb
Copy link
Contributor

alamb commented Mar 24, 2024

Describe the bug

struct works fine if all arguments are scalars, or all arguments are arrays, but panic's if some arguments are scalars and some are arrays

To Reproduce

❯ create table t(x int) as values (1), (2), (3);
0 rows in set. Query took 0.014 seconds.

❯ select struct(x, 25) from t;
thread 'main' panicked at /Users/andrewlamb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/arrow-array-51.0.0/src/array/struct_array.rs:90:46:
called Result::unwrap() on an Err value: InvalidArgumentError("Incorrect array length for StructArray field "c1", expected 3 got 1")
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace


### Expected behavior

The query should not panic and should return three rows

### Additional context

When reviewing https://github.com/apache/arrow-datafusion/pull/9743 (which is awesome) I wrote up a test case in terms of `struct` and it actually panic'd on me

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.

1 participant