Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions datafusion/physical-plan/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ tokio = { workspace = true }
criterion = { workspace = true, features = ["async_futures"] }
datafusion-functions-aggregate = { workspace = true }
datafusion-functions-window = { workspace = true }
insta = { workspace = true }
rand = { workspace = true }
rstest = { workspace = true }
rstest_reuse = "0.7.0"
Expand Down
382 changes: 200 additions & 182 deletions datafusion/physical-plan/src/aggregates/mod.rs

Large diffs are not rendered by default.

53 changes: 23 additions & 30 deletions datafusion/physical-plan/src/aggregates/topk/priority_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ mod tests {
};
use arrow::datatypes::{Field, Schema, SchemaRef};
use arrow::util::pretty::pretty_format_batches;
use insta::assert_snapshot;
use std::sync::Arc;

#[test]
Expand Down Expand Up @@ -180,15 +181,15 @@ mod tests {
let cols = agg.emit()?;
let batch = RecordBatch::try_new(test_schema(), cols)?;
let actual = format!("{}", pretty_format_batches(&[batch])?);
let expected = r#"

assert_snapshot!(actual, @r#"
+----------+--------------+
| trace_id | timestamp_ms |
+----------+--------------+
| 1 | 1 |
+----------+--------------+
"#
.trim();
assert_eq!(actual, expected);
);

Ok(())
}
Expand All @@ -205,15 +206,15 @@ mod tests {
let cols = agg.emit()?;
let batch = RecordBatch::try_new(test_schema(), cols)?;
let actual = format!("{}", pretty_format_batches(&[batch])?);
let expected = r#"

assert_snapshot!(actual, @r#"
+----------+--------------+
| trace_id | timestamp_ms |
+----------+--------------+
| 1 | 1 |
+----------+--------------+
"#
.trim();
assert_eq!(actual, expected);
);

Ok(())
}
Expand All @@ -230,15 +231,14 @@ mod tests {
let cols = agg.emit()?;
let batch = RecordBatch::try_new(test_schema(), cols)?;
let actual = format!("{}", pretty_format_batches(&[batch])?);
let expected = r#"
assert_snapshot!(actual, @r#"
+----------+--------------+
| trace_id | timestamp_ms |
+----------+--------------+
| 2 | 2 |
+----------+--------------+
"#
.trim();
assert_eq!(actual, expected);
);

Ok(())
}
Expand All @@ -255,15 +255,14 @@ mod tests {
let cols = agg.emit()?;
let batch = RecordBatch::try_new(test_schema(), cols)?;
let actual = format!("{}", pretty_format_batches(&[batch])?);
let expected = r#"
assert_snapshot!(actual, @r#"
+----------+--------------+
| trace_id | timestamp_ms |
+----------+--------------+
| 1 | 1 |
+----------+--------------+
"#
.trim();
assert_eq!(actual, expected);
);

Ok(())
}
Expand All @@ -280,15 +279,14 @@ mod tests {
let cols = agg.emit()?;
let batch = RecordBatch::try_new(test_schema(), cols)?;
let actual = format!("{}", pretty_format_batches(&[batch])?);
let expected = r#"
assert_snapshot!(actual, @r#"
+----------+--------------+
| trace_id | timestamp_ms |
+----------+--------------+
| 1 | 2 |
+----------+--------------+
"#
.trim();
assert_eq!(actual, expected);
);

Ok(())
}
Expand All @@ -305,15 +303,14 @@ mod tests {
let cols = agg.emit()?;
let batch = RecordBatch::try_new(test_schema(), cols)?;
let actual = format!("{}", pretty_format_batches(&[batch])?);
let expected = r#"
assert_snapshot!(actual, @r#"
+----------+--------------+
| trace_id | timestamp_ms |
+----------+--------------+
| 1 | 1 |
+----------+--------------+
"#
.trim();
assert_eq!(actual, expected);
);

Ok(())
}
Expand All @@ -330,15 +327,14 @@ mod tests {
let cols = agg.emit()?;
let batch = RecordBatch::try_new(test_schema(), cols)?;
let actual = format!("{}", pretty_format_batches(&[batch])?);
let expected = r#"
assert_snapshot!(actual, @r#"
+----------+--------------+
| trace_id | timestamp_ms |
+----------+--------------+
| 2 | 2 |
+----------+--------------+
"#
.trim();
assert_eq!(actual, expected);
);

Ok(())
}
Expand All @@ -355,15 +351,14 @@ mod tests {
let cols = agg.emit()?;
let batch = RecordBatch::try_new(test_schema(), cols)?;
let actual = format!("{}", pretty_format_batches(&[batch])?);
let expected = r#"
assert_snapshot!(actual, @r#"
+----------+--------------+
| trace_id | timestamp_ms |
+----------+--------------+
| 1 | 1 |
+----------+--------------+
"#
.trim();
assert_eq!(actual, expected);
);

Ok(())
}
Expand All @@ -380,15 +375,14 @@ mod tests {
let cols = agg.emit()?;
let batch = RecordBatch::try_new(test_schema(), cols)?;
let actual = format!("{}", pretty_format_batches(&[batch])?);
let expected = r#"
assert_snapshot!(actual, @r#"
+----------+--------------+
| trace_id | timestamp_ms |
+----------+--------------+
| 1 | 2 |
+----------+--------------+
"#
.trim();
assert_eq!(actual, expected);
);

Ok(())
}
Expand All @@ -406,16 +400,15 @@ mod tests {
let cols = agg.emit()?;
let batch = RecordBatch::try_new(test_schema(), cols)?;
let actual = format!("{}", pretty_format_batches(&[batch])?);
let expected = r#"
assert_snapshot!(actual, @r#"
+----------+--------------+
| trace_id | timestamp_ms |
+----------+--------------+
| | 3 |
| 1 | 1 |
+----------+--------------+
"#
.trim();
assert_eq!(actual, expected);
);

Ok(())
}
Expand Down
30 changes: 15 additions & 15 deletions datafusion/physical-plan/src/joins/cross_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,9 @@ mod tests {
use crate::common;
use crate::test::build_table_scan_i32;

use datafusion_common::{assert_batches_sorted_eq, assert_contains};
use datafusion_common::{assert_contains, test_util::batches_to_sort_string};
use datafusion_execution::runtime_env::RuntimeEnvBuilder;
use insta::assert_snapshot;

async fn join_collect(
left: Arc<dyn ExecutionPlan>,
Expand Down Expand Up @@ -829,20 +830,19 @@ mod tests {
let (columns, batches) = join_collect(left, right, task_ctx).await?;

assert_eq!(columns, vec!["a1", "b1", "c1", "a2", "b2", "c2"]);
let expected = [
"+----+----+----+----+----+----+",
"| a1 | b1 | c1 | a2 | b2 | c2 |",
"+----+----+----+----+----+----+",
"| 1 | 4 | 7 | 10 | 12 | 14 |",
"| 1 | 4 | 7 | 11 | 13 | 15 |",
"| 2 | 5 | 8 | 10 | 12 | 14 |",
"| 2 | 5 | 8 | 11 | 13 | 15 |",
"| 3 | 6 | 9 | 10 | 12 | 14 |",
"| 3 | 6 | 9 | 11 | 13 | 15 |",
"+----+----+----+----+----+----+",
];

assert_batches_sorted_eq!(expected, &batches);

assert_snapshot!(batches_to_sort_string(&batches), @r#"
+----+----+----+----+----+----+
| a1 | b1 | c1 | a2 | b2 | c2 |
+----+----+----+----+----+----+
| 1 | 4 | 7 | 10 | 12 | 14 |
| 1 | 4 | 7 | 11 | 13 | 15 |
| 2 | 5 | 8 | 10 | 12 | 14 |
| 2 | 5 | 8 | 11 | 13 | 15 |
| 3 | 6 | 9 | 10 | 12 | 14 |
| 3 | 6 | 9 | 11 | 13 | 15 |
+----+----+----+----+----+----+
"#);

Ok(())
}
Expand Down
Loading