Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAST should not change the name of an expression #3326

Closed
andygrove opened this issue Sep 1, 2022 · 0 comments · Fixed by #3222
Closed

CAST should not change the name of an expression #3326

andygrove opened this issue Sep 1, 2022 · 0 comments · Fixed by #3222
Assignees
Labels
enhancement New feature or request

Comments

@andygrove
Copy link
Member

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

@andygrove andygrove added the enhancement New feature or request label Sep 1, 2022
@andygrove andygrove self-assigned this Sep 3, 2022
@andygrove andygrove changed the title Change physical expression name for CAST expressions CAST should not change the name of an expression Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant