Nuria has uploaded a new change for review. https://gerrit.wikimedia.org/r/309604
Change subject: Map null count values to zeros in output ...................................................................... Map null count values to zeros in output 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. Changes on aqs-new-cluster branch, do not merge to master To push: git push origin HEAD:refs/for/new-aqs-cluster Bug: T144521 Change-Id: I49356d43db8b425a9c403154bd9b99b75116aeca --- M sys/pageviews.js M test/aqs_test_module.yaml M test/features/pageviews/pageviews.js 3 files changed, 15 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/analytics/aqs refs/changes/04/309604/1 diff --git a/sys/pageviews.js b/sys/pageviews.js index 3adf08b..d43b010 100644 --- a/sys/pageviews.js +++ b/sys/pageviews.js @@ -166,6 +166,10 @@ item.access = rp.access; item.agent = rp.agent; item.views = item[viewKey(rp.access, rp.agent)]; + // map null to zero for view counts + 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/309604 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I49356d43db8b425a9c403154bd9b99b75116aeca Gerrit-PatchSet: 1 Gerrit-Project: analytics/aqs Gerrit-Branch: new-aqs-cluster Gerrit-Owner: Nuria <nu...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits