andygrove opened a new issue, #3326:
URL: https://github.com/apache/arrow-datafusion/issues/3326

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   
   DataFusion differs from Spark and Postgres in the naming of CAST 
expressions. Spark and Postgres casts do not rename the column.
   
   ## 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
   ```
   
   ## DataFusion
   
   ```
   ❯ select id*2, cast(id as varchar(12)), name from test;
   +---------------------------+-----------------------+-------+
   | test.id Multiply Int64(2) | CAST(test.id AS Utf8) | name  |
   +---------------------------+-----------------------+-------+
   | 2                         | 1                     | hello |
   +---------------------------+-----------------------+-------+
   ```
   
   **Describe the solution you'd like**
   cast should not change expression name in results
   
   **Describe alternatives you've considered**
   None
   
   **Additional context**
   None
   


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