Skip to content

Commit 7ed8f94

Browse files
authored
Move RowFilter, PruningPredicate, and expr_project to vortex-expr (#1820)
1 parent 42dd747 commit 7ed8f94

File tree

13 files changed

+38
-34
lines changed

13 files changed

+38
-34
lines changed

pyvortex/src/dataset.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ use vortex::arrow::infer_schema;
1010
use vortex::dtype::field::Field;
1111
use vortex::dtype::DType;
1212
use vortex::error::VortexResult;
13+
use vortex::expr::RowFilter;
1314
use vortex::file::{
14-
read_initial_bytes, LayoutContext, LayoutDeserializer, Projection, RowFilter,
15-
VortexReadArrayStream, VortexReadBuilder, VortexRecordBatchReader,
15+
read_initial_bytes, LayoutContext, LayoutDeserializer, Projection, VortexReadArrayStream,
16+
VortexReadBuilder, VortexRecordBatchReader,
1617
};
1718
use vortex::io::{ObjectStoreReadAt, TokioFile, VortexReadAt};
1819
use vortex::sampling_compressor::ALL_ENCODINGS_CONTEXT;

vortex-datafusion/src/persistent/opener.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ use futures::{FutureExt as _, StreamExt, TryStreamExt};
99
use object_store::ObjectStore;
1010
use vortex_array::ContextRef;
1111
use vortex_expr::datafusion::convert_expr_to_vortex;
12-
use vortex_file::{LayoutContext, LayoutDeserializer, Projection, RowFilter, VortexReadBuilder};
12+
use vortex_expr::RowFilter;
13+
use vortex_file::{LayoutContext, LayoutDeserializer, Projection, VortexReadBuilder};
1314
use vortex_io::{IoDispatcher, ObjectStoreReadAt};
1415

1516
use super::cache::InitialReadCache;

vortex-expr/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ mod like;
1212
mod literal;
1313
mod not;
1414
mod operators;
15+
mod project;
16+
pub mod pruning;
17+
mod row_filter;
1518
mod select;
1619

1720
pub use binary::*;
@@ -21,6 +24,8 @@ pub use like::*;
2124
pub use literal::*;
2225
pub use not::*;
2326
pub use operators::*;
27+
pub use project::*;
28+
pub use row_filter::*;
2429
pub use select::*;
2530
use vortex_array::ArrayData;
2631
use vortex_dtype::field::Field;
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use std::sync::Arc;
22

33
use vortex_dtype::field::Field;
4-
use vortex_expr::{
5-
BinaryExpr, Column, ExprRef, Identity, Like, Literal, Not, Operator, Select, VortexExpr,
6-
};
74

8-
use crate::RowFilter;
5+
use crate::{
6+
BinaryExpr, Column, ExprRef, Identity, Like, Literal, Not, Operator, RowFilter, Select,
7+
VortexExpr,
8+
};
99

1010
/// Restrict expression to only the fields that appear in projection
1111
///
@@ -100,9 +100,9 @@ mod tests {
100100
use std::sync::Arc;
101101

102102
use vortex_dtype::field::Field;
103-
use vortex_expr::{BinaryExpr, Column, Identity, Literal, Not, Operator, Select, VortexExpr};
104103

105-
use crate::read::expr_project::expr_project;
104+
use super::*;
105+
use crate::{BinaryExpr, Column, Identity, Literal, Not, Operator, Select, VortexExpr};
106106

107107
#[test]
108108
fn project_and() {
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ use vortex_array::ArrayData;
1212
use vortex_dtype::field::Field;
1313
use vortex_dtype::Nullability;
1414
use vortex_error::{VortexExpect as _, VortexResult};
15-
use vortex_expr::{BinaryExpr, Column, ExprRef, Identity, Literal, Not, Operator};
1615
use vortex_scalar::Scalar;
1716

18-
use crate::RowFilter;
17+
use crate::{BinaryExpr, Column, ExprRef, Identity, Literal, Not, Operator, RowFilter};
1918

2019
#[derive(Debug, Clone)]
2120
pub struct Relation<K, V> {
@@ -34,6 +33,12 @@ impl<K: Display, V: Display> Display for Relation<K, V> {
3433
}
3534
}
3635

36+
impl<K: Hash + Eq, V: Hash + Eq> Default for Relation<K, V> {
37+
fn default() -> Self {
38+
Self::new()
39+
}
40+
}
41+
3742
impl<K: Hash + Eq, V: Hash + Eq> Relation<K, V> {
3843
pub fn new() -> Self {
3944
Relation {
@@ -441,11 +446,11 @@ mod tests {
441446
use vortex_array::aliases::hash_set::HashSet;
442447
use vortex_array::stats::Stat;
443448
use vortex_dtype::field::Field;
444-
use vortex_expr::{BinaryExpr, Column, Identity, Literal, Not, Operator};
445449

446450
use crate::pruning::{
447451
convert_to_pruning_expression, stat_column_field, FieldOrIdentity, PruningPredicate,
448452
};
453+
use crate::{BinaryExpr, Column, Identity, Literal, Not, Operator};
449454

450455
#[test]
451456
pub fn pruning_equals() {
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ use vortex_array::stats::ArrayStatistics;
1010
use vortex_array::{ArrayData, IntoArrayData};
1111
use vortex_dtype::field::Field;
1212
use vortex_error::{VortexExpect, VortexResult};
13-
use vortex_expr::{split_conjunction, unbox_any, ExprRef, VortexExpr};
1413

15-
use crate::read::expr_project::expr_project;
14+
use crate::{expr_project, split_conjunction, unbox_any, ExprRef, VortexExpr};
1615

1716
#[derive(Debug, Clone)]
1817
pub struct RowFilter {

vortex-file/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ mod read;
7070
mod write;
7171

7272
mod byte_range;
73-
mod pruning;
7473
#[cfg(test)]
7574
mod tests;
7675

vortex-file/src/read/builder/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ use std::sync::Arc;
33
use initial_read::read_initial_bytes;
44
use vortex_array::{ArrayDType, ArrayData};
55
use vortex_error::VortexResult;
6-
use vortex_expr::Select;
6+
use vortex_expr::{RowFilter, Select};
77
use vortex_io::{IoDispatcher, VortexReadAt};
88

99
use super::handle::VortexReadHandle;
1010
use super::InitialRead;
1111
use crate::read::cache::LayoutMessageCache;
1212
use crate::read::context::LayoutDeserializer;
13-
use crate::read::filtering::RowFilter;
1413
use crate::read::projection::Projection;
1514
use crate::read::{RowMask, Scan};
1615
use crate::LayoutPath;

vortex-file/src/read/layouts/chunked.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ use vortex_buffer::Buffer;
1111
use vortex_dtype::field::Field;
1212
use vortex_dtype::{DType, Nullability, StructDType};
1313
use vortex_error::{vortex_bail, vortex_err, vortex_panic, VortexExpect as _, VortexResult};
14+
use vortex_expr::pruning::PruningPredicate;
1415
use vortex_expr::Select;
1516
use vortex_flatbuffers::footer as fb;
1617

1718
use crate::layouts::RangedLayoutReader;
18-
use crate::pruning::PruningPredicate;
1919
use crate::read::mask::RowMask;
2020
use crate::{
2121
Layout, LayoutDeserializer, LayoutId, LayoutPartId, LayoutPath, LayoutReader, LazyDType,
@@ -429,7 +429,7 @@ mod tests {
429429
use vortex_array::{ArrayDType, ArrayLen, IntoArrayData, IntoArrayVariant};
430430
use vortex_buffer::Buffer;
431431
use vortex_dtype::PType;
432-
use vortex_expr::{BinaryExpr, Identity, Literal, Operator};
432+
use vortex_expr::{BinaryExpr, Identity, Literal, Operator, RowFilter};
433433
use vortex_flatbuffers::{footer, WriteFlatBuffer};
434434
use vortex_ipc::messages::{AsyncMessageWriter, EncoderMessage};
435435

@@ -438,7 +438,7 @@ mod tests {
438438
use crate::read::cache::LazyDType;
439439
use crate::read::layouts::test_read::{filter_read_layout, read_layout, read_layout_data};
440440
use crate::read::mask::RowMask;
441-
use crate::{write, LayoutDeserializer, LayoutMessageCache, LayoutPath, RowFilter, Scan};
441+
use crate::{write, LayoutDeserializer, LayoutMessageCache, LayoutPath, Scan};
442442

443443
async fn layout_and_bytes(
444444
scan: Scan,

vortex-file/src/read/layouts/columnar.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ use vortex_array::{ArrayData, IntoArrayData};
1010
use vortex_dtype::field::Field;
1111
use vortex_dtype::{FieldName, FieldNames};
1212
use vortex_error::{vortex_bail, vortex_err, vortex_panic, VortexExpect, VortexResult};
13-
use vortex_expr::{Column, Select, VortexExpr};
13+
use vortex_expr::{expr_project, Column, RowFilter, Select, VortexExpr};
1414
use vortex_flatbuffers::footer;
1515

1616
use crate::read::cache::LazyDType;
17-
use crate::read::expr_project::expr_project;
1817
use crate::read::mask::RowMask;
1918
use crate::{
2019
Layout, LayoutDeserializer, LayoutId, LayoutPath, LayoutReader, MessageCache, PollRead, Prune,
21-
RowFilter, Scan, COLUMNAR_LAYOUT_ID,
20+
Scan, COLUMNAR_LAYOUT_ID,
2221
};
2322

2423
#[derive(Debug)]
@@ -426,13 +425,12 @@ mod tests {
426425
use vortex_buffer::Buffer;
427426
use vortex_dtype::field::Field;
428427
use vortex_dtype::{DType, Nullability};
429-
use vortex_expr::{BinaryExpr, Column, Literal, Operator};
428+
use vortex_expr::{BinaryExpr, Column, Literal, Operator, RowFilter};
430429

431430
use crate::read::builder::initial_read::read_initial_bytes;
432431
use crate::read::layouts::test_read::{filter_read_layout, read_layout};
433432
use crate::{
434-
LayoutDeserializer, LayoutMessageCache, LayoutPath, LayoutReader, RowFilter, Scan,
435-
VortexFileWriter,
433+
LayoutDeserializer, LayoutMessageCache, LayoutPath, LayoutReader, Scan, VortexFileWriter,
436434
};
437435

438436
async fn layout_and_bytes(

0 commit comments

Comments
 (0)