Skip to content

Support entropy in Aggregation function #12247

@Weijun-H

Description

@Weijun-H

Is your feature request related to a problem or challenge?

Calculates Shannon entropy of a column of values.

Describe the solution you'd like

D CREATE TABLE entropy (vals UInt32,strings String);
D INSERT INTO entropy VALUES (1, 'A'), (1, 'A'), (1,'A'), (1,'A'), (2,'B'), (2,'B'), (2,'C'), (2,'D');
D
D SELECT entropy(vals), entropy(strings) FROM entropy;
┌───────────────┬──────────────────┐
│ entropy(vals) │ entropy(strings) │
│    double     │      double      │
├───────────────┼──────────────────┤
│           1.0 │             1.75 │
└───────────────┴──────────────────┘

Describe alternatives you've considered

No response

Additional context

https://duckdb.org/docs/sql/functions/aggregates#entropyx
https://clickhouse.com/docs/en/sql-reference/aggregate-functions/reference/entropy

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions