Skip to content

Commit

Permalink
[BLAZE-804] Support statistics of ExecutionPlan for SortExec
Browse files Browse the repository at this point in the history
  • Loading branch information
SteNicholas committed Jan 30, 2025
1 parent f6452a7 commit 8636195
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions native-engine/datafusion-ext-plans/src/sort_exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl ExecutionPlan for SortExec {
}

fn statistics(&self) -> Result<Statistics> {
todo!()
Statistics::with_fetch(self.input.statistics()?, self.schema(), self.fetch, 0, 1)
}
}

Expand Down Expand Up @@ -1393,9 +1393,9 @@ mod fuzztest {
record_batch::RecordBatch,
};
use datafusion::{
common::Result,
common::{stats::Precision, Result},
physical_expr::{expressions::Column, PhysicalSortExpr},
physical_plan::memory::MemoryExec,
physical_plan::{memory::MemoryExec, ExecutionPlan},
prelude::{SessionConfig, SessionContext},
};

Expand Down Expand Up @@ -1462,6 +1462,7 @@ mod fuzztest {
let sort = Arc::new(SortExec::new(input, sort_exprs.clone(), None));
let output = datafusion::physical_plan::collect(sort, task_ctx.clone()).await?;
let a = concat_batches(&schema, &output)?;
let a_row_count = sort.statistics()?.num_rows;

Check failure on line 1465 in native-engine/datafusion-ext-plans/src/sort_exec.rs

View workflow job for this annotation

GitHub Actions / Test spark-3.2 / Build Blaze JAR

borrow of moved value: `sort`

Check failure on line 1465 in native-engine/datafusion-ext-plans/src/sort_exec.rs

View workflow job for this annotation

GitHub Actions / Test spark-3.3 / Build Blaze JAR

borrow of moved value: `sort`

Check failure on line 1465 in native-engine/datafusion-ext-plans/src/sort_exec.rs

View workflow job for this annotation

GitHub Actions / Test spark-3.0 / Build Blaze JAR

borrow of moved value: `sort`

Check failure on line 1465 in native-engine/datafusion-ext-plans/src/sort_exec.rs

View workflow job for this annotation

GitHub Actions / Test spark-3.1 / Build Blaze JAR

borrow of moved value: `sort`

Check failure on line 1465 in native-engine/datafusion-ext-plans/src/sort_exec.rs

View workflow job for this annotation

GitHub Actions / Test spark-3.4 / Build Blaze JAR

borrow of moved value: `sort`

Check failure on line 1465 in native-engine/datafusion-ext-plans/src/sort_exec.rs

View workflow job for this annotation

GitHub Actions / Test spark-3.5 / Build Blaze JAR

borrow of moved value: `sort`

let input = Arc::new(MemoryExec::try_new(
&[batches.clone()],
Expand All @@ -1474,8 +1475,11 @@ mod fuzztest {
));
let output = datafusion::physical_plan::collect(sort, task_ctx.clone()).await?;
let b = concat_batches(&schema, &output)?;
let b_row_count = sort.statistics()?.num_rows;

Check failure on line 1478 in native-engine/datafusion-ext-plans/src/sort_exec.rs

View workflow job for this annotation

GitHub Actions / Test spark-3.2 / Build Blaze JAR

borrow of moved value: `sort`

Check failure on line 1478 in native-engine/datafusion-ext-plans/src/sort_exec.rs

View workflow job for this annotation

GitHub Actions / Test spark-3.3 / Build Blaze JAR

borrow of moved value: `sort`

Check failure on line 1478 in native-engine/datafusion-ext-plans/src/sort_exec.rs

View workflow job for this annotation

GitHub Actions / Test spark-3.0 / Build Blaze JAR

borrow of moved value: `sort`

Check failure on line 1478 in native-engine/datafusion-ext-plans/src/sort_exec.rs

View workflow job for this annotation

GitHub Actions / Test spark-3.1 / Build Blaze JAR

borrow of moved value: `sort`

Check failure on line 1478 in native-engine/datafusion-ext-plans/src/sort_exec.rs

View workflow job for this annotation

GitHub Actions / Test spark-3.4 / Build Blaze JAR

borrow of moved value: `sort`

Check failure on line 1478 in native-engine/datafusion-ext-plans/src/sort_exec.rs

View workflow job for this annotation

GitHub Actions / Test spark-3.5 / Build Blaze JAR

borrow of moved value: `sort`

assert_eq!(a.num_rows(), b.num_rows());
assert_eq!(a_row_count, b_row_count);
assert_eq!(a_row_count, Precision::Exact(n));
assert!(a == b);
Ok(())
}
Expand Down

0 comments on commit 8636195

Please sign in to comment.