Nuria has uploaded a new change for review.
https://gerrit.wikimedia.org/r/314284
Change subject: Bringing master up to date with aqs-new-cluster branch
......................................................................
Bringing master up to date with aqs-new-cluster branch
Map null values to zeros in output in per-article endpoint
View counts for an article that are equal to 0 in any of
the dimensions are being stored as 'null' in cassandra, aqs code
should do the translation from one to the other.
Bug: T144521
Change-Id: I3497542e8b08edd7cdce52661f5f4c441c09998e
---
M sys/pageviews.js
M test/aqs_test_module.yaml
M test/features/pageviews/pageviews.js
3 files changed, 15 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/analytics/aqs
refs/changes/84/314284/1
diff --git a/sys/pageviews.js b/sys/pageviews.js
index 3adf08b..9c37a4a 100644
--- a/sys/pageviews.js
+++ b/sys/pageviews.js
@@ -48,7 +48,6 @@
{ attribute: 'granularity', type: 'hash' },
{ attribute: 'timestamp', type: 'range', order: 'asc' },
]
- }
},
project: {
table: tables.project,
@@ -166,6 +165,10 @@
item.access = rp.access;
item.agent = rp.agent;
item.views = item[viewKey(rp.access, rp.agent)];
+ // map null to zero for view counts, we store null in
cassandra for efficiency
+ if (item.views === null) {
+ item.views = 0;
+ }
removeDenormalizedColumns(item);
});
}
diff --git a/test/aqs_test_module.yaml b/test/aqs_test_module.yaml
index fa93af9..f5f9af7 100644
--- a/test/aqs_test_module.yaml
+++ b/test/aqs_test_module.yaml
@@ -30,7 +30,7 @@
da: '{{request.params.views}}5'
db: '{{request.params.views}}6'
ds: '{{request.params.views}}7'
- du: '{{request.params.views}}8'
+ du: null
maa: '{{request.params.views}}9'
mab: '{{request.params.views}}10'
mas: '{{request.params.views}}11'
diff --git a/test/features/pageviews/pageviews.js
b/test/features/pageviews/pageviews.js
index ea5f20b..72a1f7f 100644
--- a/test/features/pageviews/pageviews.js
+++ b/test/features/pageviews/pageviews.js
@@ -15,6 +15,7 @@
// NOTE: this tests using the projects/aqs_default.yaml config, so
// it doesn't know about the /metrics root like the prod config does
var articleEndpoint =
'/pageviews/per-article/en.wikipedia/desktop/spider/one/daily/20150701/20150703';
+ var articleEndpointMobile =
'/pageviews/per-article/en.wikipedia/desktop/user/one/daily/20150701/20150703';
var projectEndpoint =
'/pageviews/aggregate/en.wikipedia/all-access/all-agents/hourly/1969010100/1971010100';
var topsEndpoint =
'/pageviews/top/en.wikipedia/mobile-web/2015/01/all-days';
var projectEndpointStrip =
'/pageviews/aggregate/www.en.wikipedia.org/all-access/all-agents/hourly/1969010100/1971010100';
@@ -71,6 +72,15 @@
});
});
+ it('should return integer zero if view count is null', function () {
+ return preq.get({
+ uri: server.config.aqsURL + articleEndpointMobile
+
+ }).then(function (res) {
+ assert.deepEqual(res.body.items.length, 1);
+ assert.deepEqual(res.body.items[0].views, 0);
+ });
+ });
function r(s, replaceSpaces) {
var weirdArticleTitle = 'dash - space : colon % percent / slash';
--
To view, visit https://gerrit.wikimedia.org/r/314284
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3497542e8b08edd7cdce52661f5f4c441c09998e
Gerrit-PatchSet: 1
Gerrit-Project: analytics/aqs
Gerrit-Branch: master
Gerrit-Owner: Nuria <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits