Skip to content

Support mode in Aggregation function #12248

@Weijun-H

Description

@Weijun-H

Is your feature request related to a problem or challenge?

The most frequent value.

Describe the solution you'd like

D SELECT mode(col) FROM VALUES ([1, 2]), ([1, 2]), ([2, 3]) AS tab(col);
┌───────────┐
│ mode(col) │
│  varchar  │
├───────────┤
│ [1, 2]    │
└───────────┘

-- The function returns either 1 or 2, but not 3
> SELECT mode(col) FROM VALUES (1), (1), (2), (2), (3) AS tab(col);
 1

> SELECT mode(col) FROM VALUES (NULL), (NULL) AS tab(col);
 NULL

Describe alternatives you've considered

No response

Additional context

https://duckdb.org/docs/sql/functions/aggregates#modex
https://docs.databricks.com/en/sql/language-manual/functions/mode.html

Metadata

Metadata

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