Doradus Spider allows the aggregate query grouping parameter to consist of multiple grouping sets. Each grouping set is enclosed in a GROUP function; multiple grouping sets are separated by commas. This feature is known as compound grouping. The general syntax is:Each <expression n> parameter must use one of the following forms:
• A “*” can be used to compute a global aggregate (i.e., GROUP(*)). The metric function is computed for all selected objects just as in an aggregate query with no grouping parameter. The GROUP(*) function should be specified at most once since there is only one metric value for a global aggregate.
•
• A multi-level grouping expression, consisting of a comma-separated list of scalar fields and/or field paths (e.g., GROUP(TRUNCATE(SendDate,DAY),Tags)).GET /Msgs/Message/_aggregate?m=MAX(Size)
&cf=GROUP(*),GROUP(TRUNCATE(SendDate,WEEK)),GROUP(TOP(2,TERMS(Subject)),Tags)
&q=SendDate > 2013-10-15This compound grouping aggregate query selects messages whose SendDate is >= 2013-10-15, and it computes the following:
•
• The maximum Size of selected messages grouped by SendDate truncated to WEEK granularity (GROUP(TRUNCATE(SendDate,WEEK))).
• The maximum Size of selected messages grouped first by the top 2 terms used in the Subject field and then by the Tags field (GROUP(TOP(2,TERMS(Subject)),Tags)). Because composite grouping was requested (&cf), this multi-level grouping expression uses the composite grouping technique."group": " TOP(2,TERMS(Subject)),Tags ",}},}},}},
• As with all aggregate queries, the outer results element contains an aggregate element that confirms the aggregate query parameters.
• The results element also contains a groupsets element, which contains one groupset element per grouping set, that is, for each GROUP function.
• The contents of each groupset element follows the format applicable for global, single-level, or multi-level aggregate queries, except that they do not contain an aggregate element.
• As with all grouped aggregate queries, each groupset and each non-leaf group contains a summary value.
• Only multi-level grouping sets can contain a composite group, denoted by a composite=true element and a field value of “*”.