You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MIN and MAX compare through the comparison module, and SUM over no rows is NULL, with a dialect keeping the old rules #2696
After #2660 every aggregate is an object with init, step and result. MIN and MAX accept only numbers, bigints, Date objects and objects that convert to a number. Text is left out, and so is a DATE column, which holds text by default.
alasql('SELECT MAX(s) AS m, COUNT(*) AS c FROM ?',[[{s: 'b'},{s: 'a'}]]);// [{c: 2}] SQLite gives m = 'b'
SUM over no rows gives 0. SQLite gives NULL for SUM and 0 for TOTAL.
With alasql/dialect/v4 every aggregate gives the 4.x result.
In the default, MIN and MAX over text and DATE columns return a value, and SUM over no rows returns NULL.
Done when
A new test file named after this issue covers MIN and MAX over text, over a DATE column, over Date objects, over a mix of numbers and text, and with NULLs before a 0. It covers SUM and TOTAL over no rows and over only NULLs, each also with alasql/dialect/v4.
The GROUP BY matrix in the dialect test against SQLite covers these aggregates over text and over no rows, and their expected differences are removed.
The full test suite and the CI checks (dialect test, parity check, run-state check, binding check) pass, and the pull request lists every parity difference.
changed the title [-]Review #2156 for code improvements: MIN and MAX accept types from a list per aggregate[/-][+]MIN and MAX compare through the comparison module, and SUM over no rows is NULL, with a dialect keeping the old rules[/+]on Nov 26, 2026
Activity
[-]Review #2156 for code improvements: MIN and MAX accept types from a list per aggregate[/-][+]MIN and MAX compare through the comparison module, and SUM over no rows is NULL, with a dialect keeping the old rules[/+]