coderfender commented on code in PR #1916:
URL:
https://github.com/apache/datafusion-ballista/pull/1916#discussion_r4171122993
##########
ballista/scheduler/src/state/execution_stage.rs:
##########
@@ -1509,6 +1544,88 @@ mod tests {
});
}
+ /// Build a running stage over a two-column schema plus a successful task
+ /// reporting the given per-column null counts.
+ fn stage_with_col_stats(tasks: Vec<Vec<TaskColumnStats>>) -> RunningStage {
+ use datafusion::arrow::datatypes::{DataType, Field, Schema};
+ let schema = Arc::new(Schema::new(vec![
+ Field::new("a", DataType::UInt32, true),
+ Field::new("b", DataType::UInt32, true),
+ ]));
+ let plan: Arc<dyn ExecutionPlan> = Arc::new(EmptyExec::new(schema));
+ let mut stage = RunningStage::new(
+ 1,
+ 0,
+ plan,
+ tasks.len(),
+ vec![],
+ HashMap::new(),
+ Arc::new(SessionConfig::default()),
+ );
+ for (task_id, task_column_stats) in tasks.into_iter().enumerate() {
+ stage.task_infos.push(TaskInfo {
+ task_id,
+ scheduled_time: 50,
+ launch_time: 100,
+ start_exec_time: 200,
+ end_exec_time: 300,
+ finish_time: 300,
+ task_status: task_status::Status::Successful(SuccessfulTask {
+ executor_id: "executor-1".to_string(),
+ partitions: vec![],
+ runtime_stats: vec![],
+ task_column_stats,
+ window_state: vec![],
+ }),
+ global_input_partition_ids: vec![task_id],
+ vcores_consumed: 1,
+ });
+ }
+ stage
+ }
+
+ fn col(column: u32, null_count: u64) -> TaskColumnStats {
+ TaskColumnStats {
+ column,
+ null_count,
+ sketches: vec![],
+ }
+ }
+
+ #[test]
+ fn test_to_successful_folds_column_null_counts_across_tasks() {
+ let stage = stage_with_col_stats(vec![
+ vec![col(0, 1), col(1, 2)],
+ vec![col(0, 3), col(1, 4)],
+ ]);
+ let successful = stage.to_successful();
+ assert_eq!(
+ successful.output_column_stats[0].null_count,
+ Precision::Exact(4)
+ );
+ assert_eq!(
+ successful.output_column_stats[1].null_count,
+ Precision::Exact(6)
+ );
+ }
+
+ #[test]
+ fn test_to_successful_marks_unreported_column_absent() {
Review Comment:
thank you . I pushed a commit to address this
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]