You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "gaoxinge (via GitHub)" <gi...@apache.org> on 2023/02/04 02:07:33 UTC

[GitHub] [arrow-datafusion] gaoxinge opened a new issue, #5174: cast expression may cause duplicate column name error

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

   **Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
   
   This problem origin from https://github.com/dask-contrib/dask-sql/issues/948, which can be minimally reproduced by 
   
   ```sql
   SELECT 10, cast(10 as tinyint)
   ```
   
   The sql above will cause the duplicate column name error. And this is because 
   
   - cast use the expr as column name
   
   https://github.com/apache/arrow-datafusion/blob/224c682101949da57aebc36e92e5a881ef3040d4/datafusion/expr/src/expr.rs#L1203-L1210
   
   - same column name is not valid
   
   https://github.com/apache/arrow-datafusion/blob/224c682101949da57aebc36e92e5a881ef3040d4/datafusion/expr/src/logical_plan/builder.rs#L925-L948
   
   **Describe the solution you'd like**
   
   There are two soluntions here:
   
   1. rename the column name of cast expression
   
   For example, mysql use the whole cast expression as column name, like `CAST(Int64(10) AS Int8)` instead of `Int64(10)`. In this way, the column name of cast expression will be more precise, and also this can bypass the duplicate column name error.
   
   2. remove the unique column name validation
   
   In mysql and sql server, query support same column name. So I think we can remove the unique column name validation to make same column name coexist.
   


-- 
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: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] comphead commented on issue #5174: cast expression may cause duplicate column name error

Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on issue #5174:
URL: https://github.com/apache/arrow-datafusion/issues/5174#issuecomment-1416873162

   Thanks @gaoxinge for reporting this, I'm planning to start work on this as @andygrove agreed here https://github.com/apache/arrow-datafusion/issues/3990#issuecomment-1370083263


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on issue #5174: cast expression may cause duplicate column name error

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #5174:
URL: https://github.com/apache/arrow-datafusion/issues/5174#issuecomment-1416845441

   Also, possibly related -- https://github.com/apache/arrow-datafusion/issues/4723 from @comphead 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on issue #5174: cast expression may cause duplicate column name error

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #5174:
URL: https://github.com/apache/arrow-datafusion/issues/5174#issuecomment-1416845313

   I think @andygrove  and @xudong963  may have had thoughts on this topic previously


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] gaoxinge commented on issue #5174: cast expression may cause duplicate column name error

Posted by "gaoxinge (via GitHub)" <gi...@apache.org>.
gaoxinge commented on issue #5174:
URL: https://github.com/apache/arrow-datafusion/issues/5174#issuecomment-1418362919

   @alamb @comphead Thx for reply, and I see the progress and direction of this issue.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] gaoxinge closed issue #5174: cast expression may cause duplicate column name error

Posted by "gaoxinge (via GitHub)" <gi...@apache.org>.
gaoxinge closed issue #5174: cast expression may cause duplicate column name error
URL: https://github.com/apache/arrow-datafusion/issues/5174


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org