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

   ## 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 type `Struct` type for `approx_distinct`
   
   ## What changes are included in this PR?
   
   - Enable `HLLAccumulator` and `HllGroupsAccumulator` to support `Struct`
   - Tests for the non-grouped and grouped path as part of `aggregate.slt` 
   
   ## Are these changes tested?
   
   Yes and  results are compared to DuckDB: 
   
   ```
   D CREATE TABLE approx_distinct_struct_test AS SELECT * FROM (VALUES
       (1, {'a': 1, 'b': 2}), (1, {'a': 1, 'b': 2}), (1, {'a': 3, 'b': 3}),
       (2, {'a': 4, 'b': 4}), (2, NULL),
       (3, NULL), (3, NULL),
       (4, {'a': 5, 'b': 5})
     ) AS t(g, s);
                  
   D SELECT approx_count_distinct(s) FROM approx_distinct_struct_test WHERE g = 
1;
   ┌──────────────────────────┐
   │ approx_count_distinct(s) │
   │          int64           │
   ├──────────────────────────┤
   │            2             │
   └──────────────────────────┘
   D SELECT g, approx_count_distinct(s) FROM approx_distinct_struct_test GROUP 
BY g ORDER BY g;
   ┌───────┬──────────────────────────┐
   │   g   │ approx_count_distinct(s) │
   │ int32 │          int64           │
   ├───────┼──────────────────────────┤
   │     1 │                        2 │
   │     2 │                        1 │
   │     3 │                        0 │
   │     4 │                        1 │
   └───────┴──────────────────────────┘
   D SELECT approx_count_distinct(s) FROM approx_distinct_struct_test;
   ┌──────────────────────────┐
   │ approx_count_distinct(s) │
   │          int64           │
   ├──────────────────────────┤
   │            4             │
   ```
   
   ## Are there any user-facing changes?
   
   Yes, `approx_distinct` supports now `Struct` 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