Skip to content

Commit

Permalink
feat: impl Compaction
Browse files Browse the repository at this point in the history
  • Loading branch information
KKould committed Jul 18, 2024
1 parent 6cd34f1 commit 4eb9c44
Show file tree
Hide file tree
Showing 15 changed files with 924 additions and 40 deletions.
29 changes: 16 additions & 13 deletions src/arrows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,31 +61,34 @@ where
R: Record,
{
let (lower_key, lower_cmp) = get_range_bound_fn::<R>(range.0);
let (upper_key, upper_cmp) = get_range_bound_fn::<R>(range.0);
let (upper_key, upper_cmp) = get_range_bound_fn::<R>(range.1);

let predictions: Vec<Box<dyn ArrowPredicate>> = vec![
Box::new(ArrowPredicateFn::new(
let mut predictions: Vec<Box<dyn ArrowPredicate>> = vec![Box::new(ArrowPredicateFn::new(
ProjectionMask::roots(schema_descriptor, [1]),
move |record_batch| lt_eq(record_batch.column(0), &ts.to_arrow_scalar() as &dyn Datum),
))];
if let Some(lower_key) = lower_key {
predictions.push(Box::new(ArrowPredicateFn::new(
ProjectionMask::roots(schema_descriptor, [2]),
move |record_batch| {
lower_cmp(
record_batch.column(0),
&lower_key.unwrap().to_arrow_datum() as &dyn Datum,
&lower_key.to_arrow_datum() as &dyn Datum,
)
},
)),
Box::new(ArrowPredicateFn::new(
)));
}
if let Some(upper_key) = upper_key {
predictions.push(Box::new(ArrowPredicateFn::new(
ProjectionMask::roots(schema_descriptor, [2]),
move |record_batch| {
upper_cmp(
record_batch.column(0),
&upper_key.unwrap().to_arrow_datum() as &dyn Datum,
&upper_key.to_arrow_datum() as &dyn Datum,
)
},
)),
Box::new(ArrowPredicateFn::new(
ProjectionMask::roots(schema_descriptor, [1]),
move |record_batch| lt_eq(record_batch.column(0), &ts.to_arrow_scalar() as &dyn Datum),
)),
];
)));
}

RowFilter::new(predictions)
}
Loading

0 comments on commit 4eb9c44

Please sign in to comment.