You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "milevin (via GitHub)" <gi...@apache.org> on 2023/03/09 22:21:32 UTC

[GitHub] [arrow-datafusion] milevin opened a new issue, #5538: Cannot compare two arrays of different types is thrown on a simple two-statement query

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

   **Problem Statement**
   
   This statement works:
   ```
   select CASE 10.5 WHEN 0 THEN null ELSE 10 END as col;
   ```
   
   This list of two statements don't:
   
   ```
   create table res as 
      select CASE 10.5 WHEN 0 THEN null ELSE 10 END as col;
   
   select * from res
   ```
   
   **To Reproduce**
   Place the above statements into any of the .sql files in datafusion/core/tests/tpc-ds/ (e.g. 1.sql). Run the corresponding test (e.g. tpcds_logical_q1. 
   
   **Expected behavior**
   The statements should succeed because they seem to be valid SQL and because the single statement succeeds.
   
   **Additional context**
   We hit this in SDF because we tend to generate multi-statement queries in which all dependent tables are explicitly "create"-d in a statement.


-- 
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] Jefffrey commented on issue #5538: Cannot compare two arrays of different types is thrown on a simple two-statement query

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

   Note that the SQL itself actually doesn't work, but the explain for it does (which is what the tpc-ds logical tests are checking). On latest main:
   
   ```sql
   DataFusion CLI v19.0.0
   ❯ select CASE 10.5 WHEN 0 THEN null ELSE 10 END as col;
   Arrow error: Cast error: Cannot compare two arrays of different types (Int64 and Float64)
   ❯ explain select CASE 10.5 WHEN 0 THEN null ELSE 10 END as col;
   +---------------+-------------------------------------------------------------------------------------------------+
   | plan_type     | plan                                                                                            |
   +---------------+-------------------------------------------------------------------------------------------------+
   | logical_plan  | Projection: CASE Float64(10.5) WHEN Int64(0) THEN CAST(NULL AS Int64) ELSE Int64(10) END AS col |
   |               |   EmptyRelation                                                                                 |
   | physical_plan | ProjectionExec: expr=[CASE 10.5 WHEN 0 THEN CAST(NULL AS Int64) ELSE 10 END as col]             |
   |               |   EmptyExec: produce_one_row=true                                                               |
   |               |                                                                                                 |
   +---------------+-------------------------------------------------------------------------------------------------+
   2 rows in set. Query took 0.004 seconds.
   ❯
   ```
   
   This bug seems separate from what #5343 addresses, and seems likely due to a type coercion bug is my guess.


-- 
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 closed issue #5538: Cannot compare two arrays of different types is thrown on a simple two-statement query comparing floats and ints

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #5538: Cannot compare two arrays of different types is thrown on a simple two-statement query comparing floats and ints
URL: https://github.com/apache/arrow-datafusion/issues/5538


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