felipecrv commented on issue #43733:
URL: https://github.com/apache/arrow/issues/43733#issuecomment-2296811299

   In SQL, NULL (when in a boolean context) is considered falsy.
   
   ```sql
   D SELECT CASE WHEN NULL THEN 'N' ELSE 'ELSE' END;
   ┌──────────────────────────────────────────────┐
   │ CASE  WHEN (NULL) THEN ('N') ELSE 'ELSE' END │
   │                   varchar                    │
   ├──────────────────────────────────────────────┤
   │ ELSE                                         │
   └──────────────────────────────────────────────┘
   ```
   
   But in grouping (where the row encoded seems to be used), the null is its 
own value:
   
   ```sql
   D select * from test1;
   ┌───────┬─────────┐
   │   a   │    b    │
   │ int32 │ boolean │
   ├───────┼─────────┤
   │     1 │         │
   │     2 │ true    │
   │     3 │ false   │
   └───────┴─────────┘
   D select b, count(*) from test1 group by b;
   ┌─────────┬──────────────┐
   │    b    │ count_star() │
   │ boolean │    int64     │
   ├─────────┼──────────────┤
   │ false   │            1 │
   │ true    │            1 │
   │         │            1 │
   └─────────┴──────────────┘
   ```
   
   So yes, looks like a bug 🤔 


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

Reply via email to