Skip to content

Commit

Permalink
Use prune with get item, not column (#1976)
Browse files Browse the repository at this point in the history
This will enable chunk layout the prune chunks with stats.

I will follow up with a PR which converts this logic to use a visitor.
  • Loading branch information
joseph-isaacs authored Jan 16, 2025
1 parent f7b6d42 commit 2c5b11e
Show file tree
Hide file tree
Showing 5 changed files with 264 additions and 159 deletions.
6 changes: 5 additions & 1 deletion vortex-expr/src/get_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use vortex_dtype::FieldName;
use vortex_error::{vortex_err, VortexResult};

use crate::field::DisplayFieldName;
use crate::{ExprRef, VortexExpr};
use crate::{ident, ExprRef, VortexExpr};

#[derive(Debug, Clone, Eq, Hash)]
#[allow(clippy::derived_hash_with_manual_eq)]
Expand Down Expand Up @@ -38,6 +38,10 @@ pub fn get_item(field: impl Into<FieldName>, child: ExprRef) -> ExprRef {
GetItem::new_expr(field, child)
}

pub fn get_item_scope(field: impl Into<FieldName>) -> ExprRef {
GetItem::new_expr(field, ident())
}

impl Display for GetItem {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "{}.{}", self.child, DisplayFieldName(&self.field))
Expand Down
12 changes: 7 additions & 5 deletions vortex-expr/src/pack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,13 @@ impl PartialEq<dyn Any> for Pack {

impl Display for Pack {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut f = f.debug_struct("Pack");
for (name, value) in self.names.iter().zip_eq(self.values.iter()) {
f.field(name, value);
}
f.finish()
f.write_str("{")?;
self.names
.iter()
.zip(&self.values)
.format_with(", ", |(name, expr), f| f(&format_args!("{name}: {expr}")))
.fmt(f)?;
f.write_str("}")
}
}

Expand Down
Loading

0 comments on commit 2c5b11e

Please sign in to comment.