# US 10,503,731 B2 · Efficient analysis of distinct aggregations

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 10,503,731 B2
- Document ID: US10503731B2
- Status: Granted
- Kind: B2
- Application number: 15/290,065
- Filed: 2016-10-11
- Published: 2018-04-12
- Granted: 2019-12-10
- Earliest claimed: 2016-10-11
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Ronald J. Barber; Ioana M. Delaney; Mir H. Pirahesh; Vijayshankar Raman
- Web page: https://patentgrep.com/patent/US10503731B2

## CPC

- G06F 16/2452: Query translation
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## 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).

## Claims

### Claim 1

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.

### Claim 2 (depends on 1)

The system of claim 1, further comprising the translator to create a non-distinct record for any non-distinct aggregate based on an associated at least one attribute.

### Claim 3 (depends on 1)

The system of claim 1, wherein the translation utilizes a NULL value to indicate an absence of a value.

### Claim 4 (depends on 1)

The system of claim 1, wherein the translated query is processed local to a data provider.

### Claim 5 (depends on 1)

The system of claim 1, wherein the translation is performed by an intermediate entity between an application and a data provider.

### Claim 6

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.

### Claim 7 (depends on 6)

The computer program product of claim 6, further comprising program code to create a non-distinct record for any non-distinct aggregate based on an associated at least one attribute.

### Claim 8 (depends on 6)

The computer program product of claim 6, wherein each record contains a NULL value to indicate an absence of a value.

### Claim 9 (depends on 6)

The computer program product of claim 6, wherein the translated query is processed local to a data provider.

### Claim 10 (depends on 6)

The computer program product of claim 6, wherein the translation is performed by an intermediate entity between an application and a data provider.

### Claim 11

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.

### Claim 12 (depends on 11)

The method of claim 11, further comprising creating a non-distinct record for any non-distinct aggregate based on an associated at least one attribute.

### Claim 13 (depends on 11)

The method of claim 11, wherein each record contains a NULL value to indicate an absence of a value.

### Claim 14 (depends on 11)

The method of claim 11, wherein the translated query is processed local to a data provider.

### Claim 15 (depends on 11)

The method of claim 11, wherein the translating is performed by an intermediate entity between an application and a data provider.
