# US 2015/0178336 A1 · Method, device and storage medium for providing data statistics

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

- Number: US 2015/0178336 A1
- Document ID: US20150178336A1
- Status: Published application
- Kind: A1
- Application number: 14/615,865
- Filed: 2015-02-06
- Published: 2015-06-25
- Earliest claimed: 2013-07-18
- Assignees: Tencent Technology (Shenzhen) Company Limited
- Applicants: Tencent Technology (Shenzhen) Company Limited
- Inventors: CAI PING WANG
- Web page: https://patentgrep.com/patent/US20150178336A1

## CPC

- G06F 16/2228: {Indexing structures}
- G06F 16/2237: {Vectors, bitmaps or matrices}
- G06F 16/2465: {Query processing support for facilitating data mining operations in structured databases}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The present disclosure relates to a method, a device and a storage medium for providing data statistics in a computer. The method may include: obtaining a data collection from a server, wherein the data collection comprises a plurality of records, and each of the records comprise a target data field; obtaining an index number of each target data field according to the records respectively; obtaining a bitmap comprising a plurality of bitmap units, each bitmap unit having a unique index number; searching and locating a bitmap unit in the bitmap, and writing a predetermined data into the located bitmap unit, wherein the unique index number of the located bitmap unit corresponds to the index number of each target data field; and determining the bitmap unit having a same data with the predetermined data by traversing the bitmap, and counting a total number of the determined bitmap units.

## Claims

### Claim 1

A method for providing data statistics in a computer, the computer comprising a processor operating in conjunction with a memory, the method comprising:
obtaining a data collection from a server, wherein the data collection comprises a plurality of records, and each of the records comprise a target data field;
obtaining an index number of each target data field according to the records respectively;
obtaining a bitmap comprising a plurality of bitmap units, each bitmap unit having a unique index number;
searching and locating a bitmap unit in the bitmap, and writing a predetermined data into the located bitmap unit, wherein the unique index number of the located bitmap unit corresponds to the index number of each target data field; and
determining the bitmap unit having a same data with the predetermined data by traversing the bitmap, and counting a total number of the determined bitmap units.

### Claim 2 (depends on 1)

The method as claimed in claim 1, wherein, the step of obtaining an index number of each target data field according to the records respectively comprises: determining whether the target data field is an unsigned int;
if the target data field is an unsigned integer, obtaining the value of the target data field as the index number of the target data field; otherwise, converting the value of the target data field into an unsigned integer, and obtaining the converted value of the target data field as the index number of the target data field.

### Claim 3 (depends on 1)

The method as claimed in claim 1, wherein, the step of obtaining the bitmap comprises:
creating a bitmap, wherein a total number of the bitmap units in the bitmap is equal to or greater than a maximum possible number of the value of the target data field.

### Claim 4 (depends on 1)

The method as claimed in claim 1, wherein, the step of obtaining the bitmap comprises:
according to the index number (N) of each target data field and a predetermined segment length (L), calculating a corresponding segment index number k, wherein k=round(N/L);
determining whether a bitmap segment having the segment index number k has been created; and
if so, obtaining the bitmap segment having the segment index number k as the bitmap;
if not, creating a bitmap segment within a predetermined space, marking a segment index number of the bitmap segment as k, and recording a creation order index number of the bitmap segment as n.

### Claim 5 (depends on 4)

The method as claimed in claim 4, wherein, the step of searching and locating a bitmap unit in the bitmap, and writing a predetermined data into the located bitmap unit comprises:
according to the index number (N) of each target data field and the predetermined segment length (L), calculating an offset, wherein the offset=(N % L);
obtaining an address of the located bitmap unit by a formula: address=(S0L*n+offset), wherein S0 is a starting address for the predetermined space; and
according to the address of the located bitmap unit, writing the predetermined data into the bitmap unit.

### Claim 6

A device for providing data statistics in a computer, the device comprises a processor operating in conjunction with a memory and a plurality of modules, the plurality of modules comprises:
a first obtaining module, configured to obtain a data collection from a server, wherein the data collection comprises a plurality of records, and each of the records comprise a target data field;
a second obtaining module, configured to obtain an index number of each target data field according to the records respectively;
a third obtaining module, configured to obtain a bitmap comprising a plurality of bitmap units, each bitmap unit having a unique index number;
a writing module, configured to search and locate a bitmap unit in the bitmap, and write a predetermined data into the located bitmap unit, wherein the unique index number of the located bitmap unit corresponds to the index number of each target data field; and
a statistics module, configured to determine the bitmap unit having a same data with the predetermined data by traversing the bitmap, and count a total number of the determined bitmap units.

### Claim 7 (depends on 6)

The device as claimed in claim 6, wherein, the second obtaining module comprises:
a determining unit, configured to determine whether is target data field is an unsigned int;
a first obtaining unit, if the target data field is an unsigned integer, configured to obtain the value of the target data field as the index number of the target data field;
a second obtaining unit, if the target data field is not an unsigned integer, configured to convert the value of the target data field into an unsigned integer, and obtain the converted value of the target data field as the index number of the target data field.

### Claim 8 (depends on 6)

The device as claimed in claim 6, wherein, the third obtaining module configured to create a bitmap, wherein a total number of the bitmap units in the bitmap is equal to or greater than a maximum possible number of the value of the target data field.

### Claim 9 (depends on 6)

The device as claimed in claim 6, wherein, the third obtaining module comprises:
a index number obtaining unit, configured to according to the index number (N) of each target data field and a predetermined segment length (L), calculate a corresponding segment index number k, wherein k=round(N/L);
a segment obtaining unit, configured to determine whether a bitmap segment having the segment index number k has been created, and if the bitmap segment having the segment index number k has been created, the segment obtaining unit is configured to obtain the bitmap segment having the segment index number k as the bitmap, if the bitmap segment not having the segment index number k has been created, the segment obtaining unit is configured to create a bitmap segment within a predetermined space, mark a segment index number of the bitmap segment as k, and record a creation order index number of the bitmap segment as n.

### Claim 10 (depends on 9)

The device as claimed in claim 9, wherein, the writing module comprises:
an offset obtaining unit, configured to according to the index number (N) of each target data field and the predetermined segment length (L), calculate an offset, wherein the offset=(N % L);
an address obtaining unit, configured to obtain an address of the located bitmap unit by a formula: address=(S0+L*n+offset), wherein S0is a starting address for the predetermined space; and
a writing unit, configured to according to the address of the located bitmap unit, write the predetermined data into the bitmap unit.

### Claim 11

A non-transitory computer-readable storage medium storing instructions for providing data statistics in a computer, the computer comprising a processor operating in conjunction with a memory, the instructions comprising:
obtaining a data collection from a server, wherein the data collection comprises a plurality of records, and each of the records comprise a target data field;
obtaining an index number of each target data field according to the records respectively;
obtaining a bitmap comprising a plurality of bitmap units, each bitmap unit having a unique index number;
searching and locating a bitmap unit in the bitmap, and writing a predetermined data into the located bitmap unit, wherein the unique index number of the located bitmap unit corresponds to the index number of each target data field; and
determining the bitmap unit having a same data with the predetermined data by traversing the bitmap, and counting a total number of the determined bitmap units.

### Claim 12 (depends on 11)

The computer-readable storage medium as claimed in claim 11, wherein, the step of obtaining an index number of each target data field according to the records respectively comprises:
if the target data field is an unsigned integer, obtaining the value of the target data field as the index number of the target data field; otherwise,
converting the value of the target data field into an unsigned integer, and obtaining the converted value of the target data field as the index number of the target data field.

### Claim 13 (depends on 11)

The computer-readable storage medium as claimed in claim 11, wherein, the step of obtaining the bitmap comprises:
creating a bitmap, wherein a total number of the bitmap units in the bitmap is equal to or greater than a maximum possible number of the value of the target data field.

### Claim 14 (depends on 11)

The computer-readable storage medium as claimed in claim 11, wherein, the step of obtaining the bitmap comprises:
according to the index number (N) of each target data field and a predetermined segment length (L), calculating a corresponding segment index number k, wherein k=round(N/L);
determining whether a bitmap segment having the segment index number k has been created; and
if so, obtaining the bitmap segment having the segment index number k as the bitmap;
if not, creating a bitmap segment within a predetermined space, marking a segment index number of the bitmap segment as k, and recording a creation order index number of the bitmap segment as n.

### Claim 15 (depends on 14)

The computer-readable storage medium as claimed in claim 14, wherein, the step of writing a predetermined data into the located bitmap unit comprises:
according to the index number (N) of each target data field and the predetermined segment length (L), calculating an offset, wherein the offset=(N % L);
obtaining an address of the located bitmap unit by a formula: S0+L*n+offset corresponds to the index number of each target data field to be the following equation to obtain the index corresponding to the statistical data field bitmap unit: S0+L*n+offset, wherein S0is a starting address for the predetermined space; and
according to the address of the located bitmap unit, writing the predetermined data into the bitmap unit.
