Skip to content

feat: add MODE aggregate function (#2482) - #2519

Open
Abhirup0 wants to merge 1 commit into
AlaSQL:developfrom
Abhirup0:feat/add-mode-aggregate-function
Open

feat: add MODE aggregate function (#2482)#2519
Abhirup0 wants to merge 1 commit into
AlaSQL:developfrom
Abhirup0:feat/add-mode-aggregate-function

Conversation

@Abhirup0

Copy link
Copy Markdown

Closes #2482

Summary

Adds the MODE() aggregate function to AlaSQL as requested in #2482.

Details

  • Implemented aggregate function alasql.aggr.MODE (and alias alasql.aggr.mode) in src/55functions.js.
  • Ignores NULL and undefined values during aggregation.
  • Accumulates frequency counts via Map.
  • Resolves ties by returning the smallest value (ANSI SQL semantics).
  • Added test suite test/test999_mode.js covering numbers, strings, tie-breaking, GROUP BY, and empty sets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Add MODE function

1 participant