Merge pull request #742 from CartoDB/fix-histogram-out-of-range

Fix out of range bug in date histograms
This commit is contained in:
Ivan Malagon 2017-09-07 10:49:49 +02:00 committed by GitHub
commit 69f110e037
4 changed files with 24 additions and 3 deletions

View File

@ -1,5 +1,11 @@
# Changelog
## 3.12.8
Released 2017-mm-dd
Bug fixes:
- Integer out of range in date histograms. (https://github.com/CartoDB/support/issues/962)
## 3.12.7
Released 2017-09-01

View File

@ -198,8 +198,8 @@ var dateBasicsQueryTpl = dot.template([
var dateOverrideBasicsQueryTpl = dot.template([
'__cdb_basics AS (',
' SELECT',
' max({{=it._end}}) AS __cdb_max_val,',
' min({{=it._start}}) AS __cdb_min_val,',
' max({{=it._end}})::float AS __cdb_max_val,',
' min({{=it._start}})::float AS __cdb_min_val,',
' avg(date_part(\'epoch\', {{=it._column}})) AS __cdb_avg_val,',
' min(',
' date_trunc(',

View File

@ -1,7 +1,7 @@
{
"private": true,
"name": "windshaft-cartodb",
"version": "3.12.7",
"version": "3.12.8",
"description": "A map tile server for CartoDB",
"keywords": [
"cartodb"

View File

@ -332,6 +332,21 @@ describe('histogram-dataview for date column type', function() {
});
});
it('should cast overridden start and end to float to avoid out of range errors ' + test.desc, function (done) {
var params = {
start: -2145916800,
end: 1009843199
};
this.testClient = new TestClient(mapConfig, 1234);
this.testClient.getDataview(test.dataviewId, params, function (err, dataview) {
assert.ok(!err, err);
assert.equal(dataview.type, 'histogram');
assert.ok(dataview.bin_width > 0, 'Unexpected bin width: ' + dataview.bin_width);
done();
});
});
it('should return same histogram ' + test.desc, function (done) {
var params = {