From 89e918b38784884bad9acda5b01158355fde1839 Mon Sep 17 00:00:00 2001 From: Adam Gutglick Date: Fri, 2 Aug 2024 10:59:45 +0100 Subject: [PATCH] Rename the pushdown config into a positive boolean value (#537) --- bench-vortex/benches/datafusion_benchmark.rs | 4 ++-- bench-vortex/benches/tpch_benchmark.rs | 4 ++-- bench-vortex/src/bin/tpch_benchmark.rs | 2 +- bench-vortex/src/tpch/mod.rs | 10 +++++----- vortex-datafusion/src/lib.rs | 10 +++++----- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/bench-vortex/benches/datafusion_benchmark.rs b/bench-vortex/benches/datafusion_benchmark.rs index a828cd702a..85494de987 100644 --- a/bench-vortex/benches/datafusion_benchmark.rs +++ b/bench-vortex/benches/datafusion_benchmark.rs @@ -158,13 +158,13 @@ fn bench_arrow(mut group: BenchmarkGroup, session: &SessionCo fn bench_vortex( mut group: BenchmarkGroup, 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); diff --git a/bench-vortex/benches/tpch_benchmark.rs b/bench-vortex/benches/tpch_benchmark.rs index c08f76d8d8..5a6b900941 100644 --- a/bench-vortex/benches/tpch_benchmark.rs +++ b/bench-vortex/benches/tpch_benchmark.rs @@ -13,7 +13,7 @@ fn benchmark(c: &mut Criterion) { .block_on(load_datasets( &data_dir, Format::Vortex { - disable_pushdown: true, + enable_pushdown: false, }, )) .unwrap(); @@ -21,7 +21,7 @@ fn benchmark(c: &mut Criterion) { .block_on(load_datasets( &data_dir, Format::Vortex { - disable_pushdown: false, + enable_pushdown: true, }, )) .unwrap(); diff --git a/bench-vortex/src/bin/tpch_benchmark.rs b/bench-vortex/src/bin/tpch_benchmark.rs index 90f392caad..d7665bad56 100644 --- a/bench-vortex/src/bin/tpch_benchmark.rs +++ b/bench-vortex/src/bin/tpch_benchmark.rs @@ -20,7 +20,7 @@ async fn main() { Format::Arrow, Format::Parquet, Format::Vortex { - disable_pushdown: false, + enable_pushdown: true, }, ]; diff --git a/bench-vortex/src/tpch/mod.rs b/bench-vortex/src/tpch/mod.rs index 03ba5cb96b..fc81921483 100644 --- a/bench-vortex/src/tpch/mod.rs +++ b/bench-vortex/src/tpch/mod.rs @@ -22,7 +22,7 @@ pub enum Format { Csv, Arrow, Parquet, - Vortex { disable_pushdown: bool }, + Vortex { enable_pushdown: bool }, } // Generate table dataset. @@ -51,14 +51,14 @@ pub async fn load_datasets>( 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 } @@ -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( @@ -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(()) diff --git a/vortex-datafusion/src/lib.rs b/vortex-datafusion/src/lib.rs index af4cd1be7f..34fc60e848 100644 --- a/vortex-datafusion/src/lib.rs +++ b/vortex-datafusion/src/lib.rs @@ -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 } } @@ -248,7 +248,7 @@ impl TableProvider for VortexMemTable { ) -> DFResult> { // 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) @@ -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();