andygrove commented on code in PR #3222:
URL: https://github.com/apache/arrow-datafusion/pull/3222#discussion_r960575426


##########
datafusion/core/tests/sql/aggregates.rs:
##########
@@ -1815,11 +1815,11 @@ async fn aggregate_avg_add() -> Result<()> {
     assert_eq!(results.len(), 1);
 
     let expected = vec![
-        
"+--------------+----------------------------+----------------------------+----------------------------+",
-        "| AVG(test.c1) | AVG(test.c1) Plus Int64(1) | AVG(test.c1) Plus 
Int64(2) | Int64(1) Plus AVG(test.c1) |",
-        
"+--------------+----------------------------+----------------------------+----------------------------+",
-        "| 1.5          | 2.5                        | 3.5                     
   | 2.5                        |",
-        
"+--------------+----------------------------+----------------------------+----------------------------+",
+        
"+--------------+---------------------------------------------+---------------------------------------------+---------------------------------------------+",
+        "| AVG(test.c1) | AVG(test.c1) Plus CAST(Int64(1) AS Float64) | 
AVG(test.c1) Plus CAST(Int64(2) AS Float64) | CAST(Int64(1) AS Float64) Plus 
AVG(test.c1) |",

Review Comment:
   I looked at Spark and Postgres.
   
   Spark:
   
   ```
   scala> spark.sql("select id*2, cast(id as string), name from t").show()
   +--------+---+-----+
   |(id * 2)| id| name|
   +--------+---+-----+
   |       2|  1|hello|
   |       4|  2|    x|
   +--------+---+-----+
   ```
   
   Postgres:
   
   ```
   postgres=# select id*2, cast(id as varchar(12)), name from t1;
    ?column? | id | name 
   ----------+----+------
           2 | 1  | x
   ```
   
   In the case of `CAST`, neither changes the name of the resulting column. 
This makes sense to me and I will make that change here as well.



-- 
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]

Reply via email to