lonless9 opened a new issue, #27121:
URL: https://github.com/apache/datafusion/issues/27121

   ### Describe the bug
   
   In 56.0.0-dev (1635ed947), floating-point IN lists containing two or three 
values distinguish -0.0 from +0.0. The same queries return correct results in 
55.2.0.
   
   ### To Reproduce
   
   Create zeros.csv:
   
    ```csv
      id,x
      1,-0.0
      2,0.0
    ```
   Run:
   
   ```sql
   CREATE EXTERNAL TABLE zeros (
     id BIGINT, x DOUBLE
   )
   STORED AS CSV LOCATION 'zeros.csv'
   OPTIONS ('has_header' 'true');
   
   SELECT
     id,
     x = CAST(0 AS DOUBLE) AS eq,
     x IN (CAST(0 AS DOUBLE), CAST(5 AS DOUBLE)) AS in_list,
     x NOT IN (CAST(0 AS DOUBLE), CAST(5 AS DOUBLE)) AS not_in_list
   FROM zeros
   ORDER BY id;
   ```
   
   Expected, and actual in 55.2.0:
   
   ```text
   id | eq   | in_list | not_in_list
   1  | true | true    | false
   2  | true | true    | false
   ```
   
   Actual in 56.0.0-dev:
   
   ```text
   id | eq   | in_list | not_in_list
   1  | true | false   | true
   2  | true | true    | false
   ```
   
   DF55 rewrites these short lists into equality/inequality chains. DF56 
retains membership expressions, exposing signed-zero behavior inconsistent with 
equality. Both Float32 and Float64 are affected.
   
   ### Expected behavior
   
   _No response_
   
   ### Additional context
   
   Longer lists and constant folding already exhibit this inconsistency in 
55.2.0:
   
    ```sql
      SELECT
          -CAST('0.0' AS DOUBLE) = CAST('0.0' AS DOUBLE) AS eq,
          -CAST('0.0' AS DOUBLE) IN (
              CAST('0.0' AS DOUBLE),
              CAST(5 AS DOUBLE),
              CAST(6 AS DOUBLE),
              CAST(7 AS DOUBLE)
          ) AS in_list;
    ```
   
    Expected: (true, true)
    Actual in both versions: (true, false)
   
   ### Willingness to contribute
   
   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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to