piwik/piwik — pull request #6243 by diosmosis (2014-09-18 03:43:01+00:00)
Title: Adding new PivotByDimension DataTable filter that can pivot a report by (almost) any dimension.

Pull request for #6078.

Adds a new DataTable filter that can be invoked via query parameters. Filter allows pivoting a report by another dimension.

In the UI, feature can be accessed through cog option 'Pivot by subtable'.

Includes non-pivot related changes:

- change to CSV DataTable renderer so column names w/ commas & quotes can appear in text
- change to XML DataTable renderer so column names w/ invalid XML characters can be rendered (bit of an iffy change, XML format needs an overhaul I think)

Known limitations:

- in the UI can only pivot by subtable
- pivoting by segment is slow, will hopefully be improved in the future
- cannot fetch by segment for some reports, eg, UserCountry.getCity, since it would require setting other segments in addition to city=...
- the new filter does not play nice w/ queued filters. this is due to nature of queued filters and the complexity they impose on required filter order. after I refactor processed metrics, won't be an issue though.

Notes on tests:

Includes unit & integration tests. I did only some manual tests, too tired right now to do more.

UI tests will be added later.