MCPcopy Create free account
hub / github.com/apache/datafusion / test_aggregate_alias

Function test_aggregate_alias

datafusion/core/tests/dataframe/mod.rs:1013–1042  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1011
1012#[tokio::test]
1013async fn test_aggregate_alias() -> Result<()> {
1014 let df = test_table().await?;
1015
1016 let df = df
1017 // GROUP BY `c2 + 1`
1018 .aggregate(vec![col("c2") + lit(1)], vec![])?
1019 // SELECT `c2 + 1` as c2
1020 .select(vec![(col("c2") + lit(1)).alias("c2")])?
1021 // GROUP BY c2 as "c2" (alias in expr is not supported by SQL)
1022 .aggregate(vec![col("c2").alias("c2")], vec![])?;
1023
1024 let df_results = df.collect().await?;
1025
1026 assert_snapshot!(
1027 batches_to_sort_string(&df_results),
1028 @r"
1029 +----+
1030 | c2 |
1031 +----+
1032 | 2 |
1033 | 3 |
1034 | 4 |
1035 | 5 |
1036 | 6 |
1037 +----+
1038 "
1039 );
1040
1041 Ok(())
1042}
1043
1044#[tokio::test]
1045async fn test_aggregate_with_union() -> Result<()> {

Callers

nothing calls this directly

Calls 4

test_tableFunction · 0.85
collectMethod · 0.80
aggregateMethod · 0.45
selectMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…