Efficient analysis of distinct aggregations
AssigneeInternational Business Machines Corporation
InventorsRonald J. Barber, Ioana M. Delaney, Mir H. Pirahesh, Vijayshankar Raman
Life of this patent
Estimating the term…
Abstract
Embodiments relate to aggregation operations. More specifically, embodiments relate to translating a query involving a distinct aggregate(s) into a query that does not involve a distinct aggregate. The translation involves a transformation effectively rewriting the original query containing the distinct aggregate including removal of the distinct aggregate from the query. The translated query enables the query to perform a non-distinct aggregation that effectively provides the results of the removed distinct aggregate(s).
Claims15
A computer system comprising:
- a memory;
- a processing unit operatively coupled to the memory;
- and
- a translator in communication with the processing unit to re-organize a query containing at least two distinct aggregates, including:
- identify the query having the at least two distinct aggregates each distinct aggregate having at least one associated attribute;
- translate the query, including:
- introduce a transformation to create at least one record for each distinct aggregate based on at least one associated distinct aggregate attribute and input data, wherein the created at least one record is subject to an organization which employs an attribute selected from a group consisting of:
- a GROUPBY clause, a JOIN clause, and a list of data-reduction attributes;
- remove the at least two distinct aggregates from the query;
- add an additional organization to the query, wherein the additional organization refers to the at least one associated distinct aggregate attribute;
- introduce an organization of the at least one associated attribute based on the removed at least two distinct aggregates;
- and
- return the translated query to perform a non-distinct aggregation providing a result of the at least two distinct aggregates.
A computer program product for re-organizing a query containing at least two distinct aggregates, the computer program product comprising a computer readable storage memory having program code embodied therewith, the program code executable by a processing unit to:
- identify the query having the at least two distinct aggregates each distinct aggregate having at least one associated attribute;
- translate the query, including program code to:
- introduce a transformation to create at least one record for each distinct aggregate based on at least one associated distinct aggregate attribute and input data, wherein the created at least one record is subject to an organization which employs an attribute selected from a group consisting of:
- a GROUPBY clause, a JOIN clause, and a list of data-reduction attributes;
- remove the at least two distinct aggregates from the query;
- add an additional organization to the query, wherein the additional organization refers to the at least one associated distinct aggregate attribute;
- introduce an organization of the at least one associated attribute based on the removed at least two distinct aggregates;
- and
- return the translated query to perform a non-distinct aggregation providing a result of the at least two distinct aggregates.
A method to re-organize a query containing at least two distinct aggregates comprising:
- identifying, by a computer, the query having the at least two distinct aggregates each distinct aggregate having at least one associated attribute;
- translating, by the computer, the query, wherein the translation includes:
- introducing a transformation including creating at least one record for each distinct aggregate based on at least one associated distinct aggregate attribute and input data, wherein the created at least one record is subject to an organization which employs an attribute selected from a group consisting of:
- a GROUPBY clause, a JOIN clause, and a list of data-reduction attributes;
- removing, by the computer, the at least two distinct aggregates from the query;
- add an additional organization to the query, wherein the additional organization refers to the at least one associated distinct aggregate attribute;
- introducing, by the computer, an organization of the at least one associated attribute based on the removed at least two distinct aggregates;
- and
- returning, by the computer, the translated query to perform a non-distinct aggregation providing a result of the least two distinct aggregates.
Dependencies are inferred from the claim text.