You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "byteink (via GitHub)" <gi...@apache.org> on 2023/05/11 08:24:39 UTC

[GitHub] [arrow-datafusion] byteink opened a new issue, #6333: Case expression incorrectly handles nulls

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

   ### Describe the bug
   
   When evaluating a case expression, the result is incorrect when null is involved.
   
   ### To Reproduce
   
   ```SQL
   SELECT CASE a 
      WHEN NULL THEN 1 
      WHEN a THEN 2 
      ELSE 3 END 
   FROM (VALUES (100)) AS t(a);
   ```
   ```shell
   DataFusion CLI v24.0.0
   ❯ SELECT CASE a WHEN NULL THEN 1 WHEN a THEN 2 ELSE 3 END FROM (VALUES (100)) AS t(a);
   
   +-----------------------------------------------------------------------+
   | CASE a WHEN NULL THEN Int64(1) WHEN a THEN Int64(2) ELSE Int64(3) END |
   +-----------------------------------------------------------------------+
   | 3                                                                     |
   +-----------------------------------------------------------------------+
   ```
   
   ### Expected behavior
   
   The calculation result of 2 is more reasonable.
   ```
   +-----------------------------------------------------------------------+
   | CASE a WHEN NULL THEN Int64(1) WHEN a THEN Int64(2) ELSE Int64(3) END |
   +-----------------------------------------------------------------------+
   | 2                                                                     |
   +-----------------------------------------------------------------------+
   ```
   
   ### Additional context
   
   _No response_


-- 
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] alamb closed issue #6333: Case expression incorrectly handles nulls

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #6333: Case expression incorrectly handles nulls
URL: https://github.com/apache/arrow-datafusion/issues/6333


-- 
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 #6333: Case expression incorrectly handles nulls

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

   2 is what matches postgres as well
   
   ```
   postgres=# SELECT CASE a
      WHEN NULL THEN 1
      WHEN a THEN 2
      ELSE 3 END
   FROM (VALUES (100)) AS t(a);
    case
   ------
       2
   (1 row)
   
   postgres=#
   ```


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