Closed mapleFU closed 1 month ago
@felipecrv @zanmato1984 would you mind take a look? I'm a bit confused here
You mean a null
boolean scalar will be encoded as a valid false
?
If so, this looks like a bug to me.
You mean a null boolean scalar will be encoded as a valid false?
Yes, seems like it is :-(
In SQL, NULL (when in a boolean context) is considered falsy.
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:
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 🤔
Aha, I've tried to fix that
Issue resolved by pull request 43734 https://github.com/apache/arrow/pull/43734
Describe the enhancement requested
I'm current learning the code of
compute::RowEncoder
. I found that inFixedWidthKeyEncoder
, Scalar detectsis_valid
:However, in BooleanKeyEncoder, this is not handled:
Is this expected?
Component(s)
C++