# US 2022/0292101 A1 · Efficient set operation execution on streaming data using sketches

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

- Number: US 2022/0292101 A1
- Document ID: US20220292101A1
- Status: Published application
- Kind: A1
- Application number: 17/201,451
- Filed: 2021-03-15
- Published: 2022-09-15
- Earliest claimed: 2021-03-15
- Assignees: Adobe Inc.
- Applicants: Adobe Inc.
- Inventors: TUNG MAI; Anup Rao; Yeshwanth Vijayakumar
- Web page: https://patentgrep.com/patent/US20220292101A1

## CPC

- G06F 16/24568: {Data stream processing; Continuous queries}
- G06F 16/2255: {Hash tables}
- G06F 16/2365: {Ensuring data consistency and integrity}
- G06F 16/24539: {using cached or materialised query results}
- G06F 16/24554: {Unary operations; Data partitioning operations}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The present disclosure relates to method for responding to a query requesting an intersection being performed. The method includes receiving a query referencing a first set, a second set, and a desired quantile related to the first set from among a plurality of quantiles; generating a data structure including a bottom-k sketch of user identifiers (ids) of the first set and corresponding numerical values of the first data; partitioning the data structure into a plurality of sketches to correspond to the quantiles, respectively; determining an intersection of one of the sketches associated with the desired quantile and a sketch of the second set; and responding to the query based on the intersection.

## Claims

### Claim 1

A computer-implemented method for responding to a database query, the method comprising:
receiving the database query referencing a first set, a second set, and a desired quantile related to the first set from among a plurality of quantiles;
generating a data structure including a bottom-k sketch of user identifiers (ids) of the first set and corresponding numerical values of the first set;
partitioning the data structure into a plurality of sketches to correspond to the quantiles, respectively;
determining an intersection of one of the sketches associated with the desired quantile and a sketch of the second set; and
responding to the database query based on a cardinality of the intersection.

### Claim 2 (depends on 1)

The computer-implemented method of claim 1, wherein generating the data structure comprise:
hashing each of the user ids to a random value between 0 and 1 to generate hash values;
selecting the k lowest hash values; and
creating a plurality of entries, where each entry includes one of the selected hash values and a corresponding one of the numerical values.

### Claim 3 (depends on 2)

The computer-implemented method of claim 2, wherein the partitioning comprises:
determining a plurality of ranges of the numerical values, where each range is associated with a different one of the quantiles; and
determining the entries having the numerical values in one of the ranges; and
assigning the determined entries to one of the sketches associated with the quantile of the one range.

### Claim 4 (depends on 2)

The computer-implemented method of claim 2, wherein the partitioning comprises:
determining a plurality of ranges of the numerical values, where each range is associated with a different one of the quantiles; and
determining the entries having the numerical values in one of the ranges; and
assigning the hash values of the determined entries to one of the sketches associated with the quantile of the one range.

### Claim 5 (depends on 1)

The computer-implemented method of claim 1, wherein the partitioning comprises:
determining a t-digest sketch of the first set; and
estimating the quantiles from the t-digest sketch.

### Claim 6 (depends on 1)

The computer-implemented method of claim 1, wherein the second set indicates user ids of users in one of a plurality of different categories.

### Claim 7 (depends on 1)

The computer-implemented method of claim 1, wherein the second set includes second numerical values of a plurality of second user ids.

### Claim 8 (depends on 7)

The computer-implemented method of claim 7, wherein the determining of the sketch of the second set comprises:
hashing each of the second user ids to a random value between 0 and 1 to generate hash values;
selecting the k lowest hash values; and
creating a plurality of entries, where each entry includes one of the selected hash values and a corresponding one of the second numerical values.

### Claim 9

A system for responding to a database query, the system comprising:
a client device comprising a graphical user interface configured to enable a user to enter a database query referencing first and second sets and a quantile associated with the first set, and a computer program configured to output the database query over a computer network; and
a server configured to generate a data structure including a bottom-k sketch of the first set and corresponding numerical values of the first set, determine a subset of the bottom-k sketch whose numerical values correspond to the quantile, and transmit a computer message over the computer network to the client device including an answer to the database query based on an intersection of the subset and a sketch of the second set.

### Claim 10 (depends on 9)

The system of claim 9, wherein the answer includes a cardinality of the intersection.

### Claim 11 (depends on 9)

The system of claim 9, wherein the database query further references a third set and the server determines the intersection of the subset, the sketch of the second set, and a sketch of the third set.

### Claim 12 (depends on 9)

The system of claim 9, wherein the server generates the bottom-k sketch by hashing user ids of the first set to random values between 0 and 1 and retaining the k lowest values, where k is at least 2.

### Claim 13 (depends on 12)

The system of claim 12, wherein the server determines the subset of the bottom-k sketch whose numerical values correspond to the quantile by determining a range of the numerical values of the first set that correspond to the quantile, and selecting entries of the bottom-k sketch whose numerical values fall within the range.

### Claim 14 (depends on 13)

The system of claim 13, wherein the server is configured to receive a data stream and update the range when a data point of the data stream references a same numerical field as the first set.

### Claim 15 (depends on 13)

The system of claim 13, wherein the range is determined from a t-digest sketch of the first set.

### Claim 16 (depends on 9)

The system of claim 9, wherein the server is configured to receive a data stream and update the bottom-k sketch when a data point of the data stream references a same numerical field as the first set.

### Claim 17 (depends on 16)

The system of claim 16, wherein the server determines a second subset from the updated bottom-k sketch to correspond to the quantile and provides a second computer message over the computer network to the client device, upon receiving a second database query referencing the same first and second sets, the second computer message including an answer to the second database query based on an intersection of the subset and a sketch of the second set.

### Claim 18

A computer-implemented method for updating a database to store streaming data, the method comprising:
receiving a data stream comprising a data point including a user identifier (id) among a plurality of user ids and a numerical value for a numerical field;
determining whether a data structure including a bottom-k sketch for the numerical field is present in the database;
updating the data structure based on the user id and the numerical field, when it is determined that the data structure is present; and
creating the data structure from the data point for storage in the database, when it is determined that the data structure is not present.

### Claim 19 (depends on 18)

The computer-implemented method of claim 18, wherein the updating comprises:
hashing the user id to a random value between 0 and 1 to generate a hash value;
replacing an entry of the bottom-k sketch with an entry including the hash value and the numerical value when the hash value is one of k lowest hash values among other hash values in the bottom-k sketch; and
maintaining the bottom-k sketch when the hash value is not one of the k lowest hash values.

### Claim 20 (depends on 18)

The computer-implemented method of claim 18, further comprising:
updating quantiles associated with the data structure based on the numerical value, when it is determined that the data structure is present,
wherein the quantiles are used along with the data structure to respond to a database query associated with the numerical field.
