Apache Pinot Docs
Search…
latest
mode
This section contains reference documentation for the mode function.
Get the most frequent value in a group. When multiple modes are present it gives the minimum of all the modes. This behavior can be overridden to get the maximum or the average mode.

Signature

MODE(colName, [reducerType])

Usage Examples

These examples are based on the Batch Quick Start.
1
select mode(yearID) AS value
2
from baseballStats
3
WHERE AtBatting != 0 AND yearID > 2001
Copied!
value
2008
1
select mode(yearID, 'AVG') AS value
2
from baseballStats
3
WHERE AtBatting != 0 AND yearID > 2001
Copied!
value
2010
1
select mode(yearID, 'MIN') AS value
2
from baseballStats
3
WHERE AtBatting != 0 AND yearID > 2001
Copied!
value
2008
1
select mode(yearID, 'MAX') AS value
2
from baseballStats
3
WHERE AtBatting != 0 AND yearID > 2001
Copied!
value
2012
Last modified 1mo ago
Copy link