You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2023/11/29 16:12:35 UTC
(arrow-datafusion) branch main updated: Minor: Add DataFrame test (#8341)
This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new d22403a062 Minor: Add DataFrame test (#8341)
d22403a062 is described below
commit d22403a062e9d1f0cdb89b0e80cc05d6318b4e12
Author: Andrew Lamb <an...@nerdnetworks.org>
AuthorDate: Wed Nov 29 11:12:29 2023 -0500
Minor: Add DataFrame test (#8341)
* Minor: restore DataFrame test
* Move test to a better location
* simplify test
---
datafusion/core/src/physical_planner.rs | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/datafusion/core/src/physical_planner.rs b/datafusion/core/src/physical_planner.rs
index 09f0e11dc2..e0f1201aea 100644
--- a/datafusion/core/src/physical_planner.rs
+++ b/datafusion/core/src/physical_planner.rs
@@ -2540,6 +2540,27 @@ mod tests {
Ok(())
}
+ #[tokio::test]
+ async fn aggregate_with_alias() -> Result<()> {
+ let schema = Arc::new(Schema::new(vec![
+ Field::new("c1", DataType::Utf8, false),
+ Field::new("c2", DataType::UInt32, false),
+ ]));
+
+ let logical_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 physical_plan = plan(&logical_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()
+ );
+ Ok(())
+ }
+
#[tokio::test]
async fn test_explain() {
let schema = Schema::new(vec![Field::new("id", DataType::Int32, false)]);