Skip to content
Merged
Changes from all commits
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
10 changes: 10 additions & 0 deletions vortex-array/src/expr/exprs/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::fmt::Formatter;
use itertools::Itertools;
use prost::Message;
use vortex_dtype::DType;
use vortex_dtype::FieldName;
use vortex_dtype::FieldNames;
use vortex_error::VortexExpect;
use vortex_error::VortexResult;
Expand Down Expand Up @@ -192,6 +193,15 @@ impl VTable for Select {
.is_nullable()
});

// If no fields are included, we can trivially simplify to a pack expression.
// NOTE(ngates): we do this knowing that our layout expression partitioning logic has
// special-casing for pack, but not for select. We will fix this up when we revisit the
// layout APIs.
if included_fields.is_empty() {
let empty: Vec<(FieldName, Expression)> = vec![];
return Ok(Some(expr::pack(empty, struct_nullability)));
}

// We cannot always convert a `select` into a `pack(get_item(f1), get_item(f2), ...)`.
// This is because `get_item` does a validity intersection of the struct validity with its
// fields, which is not the same as just "masking" out the unwanted fields (a selection).
Expand Down
Loading