()
| 1089 | |
| 1090 | #[tokio::test] |
| 1091 | async fn test_aggregate_subexpr() -> Result<()> { |
| 1092 | let df = test_table().await?; |
| 1093 | |
| 1094 | let group_expr = col("c2") + lit(1); |
| 1095 | let aggr_expr = sum(col("c3") + lit(2)); |
| 1096 | |
| 1097 | let df = df |
| 1098 | // GROUP BY `c2 + 1` |
| 1099 | .aggregate(vec![group_expr.clone()], vec![aggr_expr.clone()])? |
| 1100 | // SELECT `c2 + 1` as c2 + 10, sum(c3 + 2) + 20 |
| 1101 | // SELECT expressions contain aggr_expr and group_expr as subexpressions |
| 1102 | .select(vec![ |
| 1103 | group_expr.alias("c2") + lit(10), |
| 1104 | (aggr_expr + lit(20)).alias("sum"), |
| 1105 | ])?; |
| 1106 | |
| 1107 | let df_results = df.collect().await?; |
| 1108 | |
| 1109 | assert_snapshot!( |
| 1110 | batches_to_sort_string(&df_results), |
| 1111 | @r" |
| 1112 | +----------------+------+ |
| 1113 | | c2 + Int32(10) | sum | |
| 1114 | +----------------+------+ |
| 1115 | | 12 | 431 | |
| 1116 | | 13 | 248 | |
| 1117 | | 14 | 453 | |
| 1118 | | 15 | 95 | |
| 1119 | | 16 | -146 | |
| 1120 | +----------------+------+ |
| 1121 | " |
| 1122 | ); |
| 1123 | |
| 1124 | Ok(()) |
| 1125 | } |
| 1126 | |
| 1127 | #[tokio::test] |
| 1128 | async fn test_aggregate_name_collision() -> Result<()> { |
nothing calls this directly
no test coverage detected
searching dependent graphs…