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

Fix StructArray::filter length calculation #769

Merged
merged 4 commits into from
Sep 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions vortex-array/src/array/struct_/compute.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use itertools::Itertools;
use vortex_error::VortexResult;
use vortex_error::{vortex_err, VortexResult};
use vortex_scalar::Scalar;

use crate::array::struct_::StructArray;
Expand Down Expand Up @@ -82,7 +82,10 @@ impl FilterFn for StructArray {
.children()
.map(|field| filter(&field, predicate))
.try_collect()?;
let length = fields.first().map(|a| a.len()).unwrap_or_default();
let length = fields
.first()
.map(|a| a.len())
.ok_or(vortex_err!("Struct arrays should have at least one field"))?;
AdamGS marked this conversation as resolved.
Show resolved Hide resolved

Self::try_new(
self.names().clone(),
Expand Down
Loading