alamb commented on code in PR #8341:
URL: https://github.com/apache/arrow-datafusion/pull/8341#discussion_r1408359226
##########
datafusion/core/src/physical_planner.rs:
##########
@@ -2540,6 +2540,27 @@ mod tests {
Ok(())
}
+ #[tokio::test]
+ async fn aggregate_with_alias() -> Result<()> {
Review Comment:
I found a better place for this test (with the other tests that are checking
things about the physical plans)
##########
datafusion/core/tests/dataframe/mod.rs:
##########
@@ -1597,3 +1597,28 @@ async fn test_array_agg() -> Result<()> {
Ok(())
}
+
+#[tokio::test]
+async fn aggregate_with_alias() -> Result<()> {
+ let ctx = SessionContext::new();
+ let state = ctx.state();
+
+ let schema = Arc::new(Schema::new(vec![
+ Field::new("c1", DataType::Utf8, false),
+ Field::new("c2", DataType::UInt32, false),
+ ]));
+
+ let plan = scan_empty(None, schema.as_ref(), None)?
+ .aggregate(vec![col("c1")], vec![sum(col("c2"))])?
+ .project(vec![col("c1"), sum(col("c2")).alias("total_salary")])?
+ .build()?;
+
+ let plan = state.optimize(&plan)?;
+ let physical_plan = state.create_physical_plan(&Arc::new(plan)).await?;
+ assert_eq!("c1", physical_plan.schema().field(0).name().as_str());
+ assert_eq!(
+ "total_salary",
+ physical_plan.schema().field(1).name().as_str()
Review Comment:
Moved in
[2ea11a0](https://github.com/apache/arrow-datafusion/pull/8341/commits/2ea11a064b5ae7bb22b6a0e757382dee06e864e4)
--
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]