forked from AlaSQL/alasql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for aggregate functions applied to empty sets (AlaSQL#964)
* Return undefined from aggregate functions when the accumulator is undefined (fixes AlaSQL#917) * Build from src
- Loading branch information
1 parent
b3e6f13
commit dbcbedc
Showing
7 changed files
with
68 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
if(typeof exports === 'object') { | ||
var assert = require("assert"); | ||
var alasql = require('..'); | ||
}; | ||
|
||
/* | ||
Test for issue #917 | ||
*/ | ||
|
||
var test = 619; | ||
|
||
describe('Test '+test+' calling aggregate functions on empty sets', function() { | ||
|
||
before(function(){ | ||
alasql('CREATE DATABASE test'+test+';USE test'+test); | ||
}); | ||
|
||
after(function(){ | ||
alasql('DROP DATABASE test'+test); | ||
}); | ||
|
||
it('1. Should always return undefined', function(){ | ||
res = alasql('SELECT STDDEV(col) AS Result FROM ? WHERE 1=0', [[{col:1},{col:2}]]); | ||
assert.equal(res[0]['Result'], undefined); | ||
}) | ||
}); |