mkleen opened a new pull request, #23526:
URL: https://github.com/apache/datafusion/pull/23526

   ## Which issue does this PR close?
   
   - Relates to https://github.com/apache/datafusion/issues/22989 but does not 
close it. More types are coming.
   
   
   ## Rationale for this change
   
   - Support the Arrow types `Map` type for `approx_distinct`
   
   ## What changes are included in this PR?
   
   - Enable `HLLAccumulator` and `HllGroupsAccumulator` to support `Map`
   - Tests for the non-grouped and grouped path as part of `aggregate.slt` 
   
   ## Are these changes tested?
   
   Yes and compared to DuckDB: 
   
   ```
   D CREATE TABLE approx_distinct_map_test AS SELECT * FROM (VALUES
       (1, MAP {'a': 1, 'b': 2}), (1, MAP {'a': 1, 'b': 2}), (1, MAP {'c': 3}),
       (2, MAP {'d': 4}), (2, NULL),
       (3, NULL), (3, NULL),
       (4, MAP {'e': 5})
     ) AS t(g, m);
   
   D SELECT approx_count_distinct(m) FROM approx_distinct_map_test WHERE g = 1;
   ┌──────────────────────────┐
   │ approx_count_distinct(m) │
   │          int64           │
   ├──────────────────────────┤
   │            2             │
   └──────────────────────────┘
   
   D SELECT g, approx_count_distinct(m) FROM approx_distinct_map_test GROUP BY 
g ORDER BY g;
   ┌───────┬──────────────────────────┐
   │   g   │ approx_count_distinct(m) │
   │ int32 │          int64           │
   ├───────┼──────────────────────────┤
   │     1 │                        2 │
   │     2 │                        1 │
   │     3 │                        0 │
   │     4 │                        1 │
   └───────┴──────────────────────────┘
   
   D SELECT approx_count_distinct(m) FROM approx_distinct_map_test;
   ┌──────────────────────────┐
   │ approx_count_distinct(m) │
   │          int64           │
   ├──────────────────────────┤
   │            4             │
   └──────────────────────────┘
   ```
   
   ## Are there any user-facing changes?
   
   Yes, `approx_distinct` supports now `Map` but no breaking changes.
   
   


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