-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
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
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request