Skip to content

Commit

Permalink
Rename the pushdown config into a positive boolean value (#537)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamGS authored Aug 2, 2024
1 parent f5a5466 commit 89e918b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions bench-vortex/benches/datafusion_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ fn bench_arrow<M: Measurement>(mut group: BenchmarkGroup<M>, session: &SessionCo
fn bench_vortex<M: Measurement>(
mut group: BenchmarkGroup<M>,
session: &SessionContext,
disable_pushdown: bool,
enable_pushdown: bool,
compress: bool,
) {
let vortex_dataset = toy_dataset_vortex(compress);
let vortex_table = Arc::new(VortexMemTable::new(
vortex_dataset,
VortexMemTableOptions::default().with_disable_pushdown(disable_pushdown),
VortexMemTableOptions::default().with_pushdown(enable_pushdown),
));

measure_provider(&mut group, session, vortex_table);
Expand Down
4 changes: 2 additions & 2 deletions bench-vortex/benches/tpch_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ fn benchmark(c: &mut Criterion) {
.block_on(load_datasets(
&data_dir,
Format::Vortex {
disable_pushdown: true,
enable_pushdown: false,
},
))
.unwrap();
let vortex_ctx = runtime
.block_on(load_datasets(
&data_dir,
Format::Vortex {
disable_pushdown: false,
enable_pushdown: true,
},
))
.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion bench-vortex/src/bin/tpch_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async fn main() {
Format::Arrow,
Format::Parquet,
Format::Vortex {
disable_pushdown: false,
enable_pushdown: true,
},
];

Expand Down
10 changes: 5 additions & 5 deletions bench-vortex/src/tpch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub enum Format {
Csv,
Arrow,
Parquet,
Vortex { disable_pushdown: bool },
Vortex { enable_pushdown: bool },
}

// Generate table dataset.
Expand Down Expand Up @@ -51,14 +51,14 @@ pub async fn load_datasets<P: AsRef<Path>>(
register_parquet(&context, stringify!($name), &$name, $schema).await
}
Format::Vortex {
disable_pushdown, ..
enable_pushdown, ..
} => {
register_vortex(
&context,
stringify!($name),
&$name,
$schema,
disable_pushdown,
enable_pushdown,
)
.await
}
Expand Down Expand Up @@ -172,7 +172,7 @@ async fn register_vortex(
name: &str,
file: &Path,
schema: &Schema,
disable_pushdown: bool,
enable_pushdown: bool,
) -> anyhow::Result<()> {
let record_batches = session
.read_csv(
Expand Down Expand Up @@ -201,7 +201,7 @@ async fn register_vortex(
session.register_vortex_opts(
name,
chunked_array,
VortexMemTableOptions::default().with_disable_pushdown(disable_pushdown),
VortexMemTableOptions::default().with_pushdown(enable_pushdown),
)?;

Ok(())
Expand Down
10 changes: 5 additions & 5 deletions vortex-datafusion/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ const SUPPORTED_BINARY_OPS: &[Operator] = &[
/// Optional configurations to pass when loading a [VortexMemTable].
#[derive(Default, Debug, Clone)]
pub struct VortexMemTableOptions {
pub disable_pushdown: bool,
pub enable_pushdown: bool,
}

impl VortexMemTableOptions {
pub fn with_disable_pushdown(mut self, disable_pushdown: bool) -> Self {
self.disable_pushdown = disable_pushdown;
pub fn with_pushdown(mut self, enable_pushdown: bool) -> Self {
self.enable_pushdown = enable_pushdown;
self
}
}
Expand Down Expand Up @@ -248,7 +248,7 @@ impl TableProvider for VortexMemTable {
) -> DFResult<Vec<TableProviderFilterPushDown>> {
// In the case the caller has configured this provider with filter pushdown disabled,
// do not attempt to apply any filters at scan time.
if self.options.disable_pushdown {
if !self.options.enable_pushdown {
return Ok(filters
.iter()
.map(|_| TableProviderFilterPushDown::Unsupported)
Expand Down Expand Up @@ -548,7 +548,7 @@ mod test {
presidents_array(),
// Disable pushdown. We run this test to make sure that the naive codepath also
// produces correct results and does not panic anywhere.
VortexMemTableOptions::default().with_disable_pushdown(true),
VortexMemTableOptions::default().with_pushdown(false),
)
.unwrap();

Expand Down

0 comments on commit 89e918b

Please sign in to comment.