CN111382185A - Method for counting and applying mobile phone numbers by adopting partition positioning - Google Patents
Method for counting and applying mobile phone numbers by adopting partition positioning Download PDFInfo
- Publication number
- CN111382185A CN111382185A CN201811619139.9A CN201811619139A CN111382185A CN 111382185 A CN111382185 A CN 111382185A CN 201811619139 A CN201811619139 A CN 201811619139A CN 111382185 A CN111382185 A CN 111382185A
- Authority
- CN
- China
- Prior art keywords
- mobile phone
- phone number
- partition
- value
- position index
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000005192 partition Methods 0.000 title claims abstract description 110
- 238000000034 method Methods 0.000 title claims abstract description 36
- 238000012545 processing Methods 0.000 claims description 7
- 230000003247 decreasing effect Effects 0.000 abstract 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 238000000638 solvent extraction Methods 0.000 description 3
- 238000013507 mapping Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000007796 conventional method Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
Images
Abstract
The invention provides a method for counting and applying mobile phone numbers by adopting partition positioning, which comprises the following steps: s1, initializing the system; s2, setting a statistic value; s3, obtaining a statistical value, wherein by adopting the method, due to the multi-stage partition, the required memory can be dynamically increased and counted according to the requirement when the mass mobile phone numbers are counted; particularly, when the mobile phone numbers of not all number sections are counted, corresponding memory values cannot be consumed when no number needs to be counted is available in a bitmap mode, and extra huge expenses caused by a hashmap mode can be avoided; the method is used for counting, when the number of times of occurrence of each 40 hundred million numbers needs to be counted, only about 3870MB of memory needs to be consumed, which is 10 times of that of a hashmap, if the number quantity is increased or decreased, the method adopted by the invention cannot cause the memory to be increased or decreased, and other methods can cause the memory to be increased or decreased continuously; because the statistics and the obtained values are obtained by simply calculating and positioning, the requirement of quick operation can be met.
Description
Technical Field
The invention relates to the technical field of memory data access processing, in particular to a method for counting and applying mobile phone numbers by adopting partition positioning, which is a method for counting mass mobile phone numbers in a memory and utilizing a counting result and can be further expanded into a method for counting and utilizing mass digital data in the memory.
Background
In an information processing system related to a mobile phone number, when a service system performs relevant statistics on the mobile phone number and performs application processing according to a statistical result, if only whether the mobile phone number appears is counted, all the mobile phone numbers in China at present have about 40 hundred million pieces, the optimal mode in the prior art generally adopts a bitmap mode for processing, and the bitmap mode needs to construct one or more very proper mapping functions to ensure that 40 hundred million numbers are in a proper bitmap, at the extreme best, 40 hundred million mobile phone numbers just fill the whole bitmap but not more than one number, at the moment, a bitmap container with the size of 477MB is enough to be accommodated, at the extreme worst, numbers (70 hundred million numbers) of all number segments need to be constructed, and at the moment, a bitmap container with the size of 835MB is enough to be accommodated. Due to the randomness of the statistical mobile phone number, the memory consumed by the final statistical result is close to the worst case.
The above method is only to count whether the mobile phone number appears, and once the service needs to count the times of all the mobile phone numbers in the service, the bitmap method cannot be used. According to the conventional method, processing is carried out in a hashmap and other manners, keys of the hashmap are statistical mobile phone numbers, the values of the keys are the times of occurrence of the mobile phone numbers, and in this manner, even if the keys only occupy 4 bytes (total 40 hundred million values, and at least 4 bytes are needed to represent the complete state), and the values only occupy 1 byte, the memory consumption of 19074MB is required for 40 hundred million mobile phone numbers, and if the additional auxiliary overhead necessary for the hashmap is added, the whole memory consumption cannot be borne.
Because the statistics and application processing of the mobile phone numbers need to be carried out in the memory in the service, and because the mobile phone numbers are random, the statistics cannot be carried out in a sequential mode, and if the conventional statistical recording modes such as hashmap and the like are adopted under the condition that the service needs to be rapidly counted, huge memory consumption is needed when the statistics of massive mobile phone numbers needs to be carried out. And if processed in other ways, the service requirements cannot be met in terms of statistics and acquisition performance.
Disclosure of Invention
The invention aims to provide a method for counting and applying mobile phone numbers by adopting partition positioning, which is a method for quickly indexing and counting mass mobile phone numbers in a memory by using a small amount of memory consumption and utilizing a counting result, and quickly counting the total occurrence frequency of each mobile phone number for the mass mobile phone numbers; and the method can be expanded to a method for quickly indexing, counting and utilizing massive digital data.
In order to achieve the purpose, the following technical scheme is adopted: according to the characteristics of the mobile phone numbers, all possible mobile phone numbers are divided into multiple stages in a partitioning mode, so that all legal mobile phone numbers can be contained in one partition in the whole partitioning mode, and the number of the stages of the partitions and the number of the partitions in each stage are fixed in a determined partitioning mode;
each specific partition is dynamically generated when data needs to be recorded in the partition, and if no statistical data record exists in the partition, the partition is empty and does not consume a specific memory space. And determining the specific recorded values in the partitions by adopting recording modes such as bit and Byte according to the number of each mobile phone number to be counted, for example, only counting whether the mobile phone number appears, wherein the partition value is bit, and if the maximum value of the counted possible times of each mobile phone number is not more than 256, the partition value is recorded by Byte.
A mobile phone number to be counted is given, and a partition where the mobile phone number should be located is calculated by the mobile phone number according to a partition defining mode; judging whether the partition exists or not, and if not, immediately generating the partition; and calculating the internal position of the mobile phone number in the partition according to the mobile phone number, judging the value of the internal position of the partition, setting a required value at the position if no value exists originally, and setting an original value and a value required to be newly set at the position if the value exists already.
When obtaining the statistic value of a given mobile phone number, calculating the partition where the mobile phone number should be according to the partition definition, judging whether the partition exists, if not, judging that the mobile phone number has no statistic value, if so, calculating the position in the partition according to the mobile phone number, and obtaining the value of the corresponding position in the partition, wherein the value of the position in the inner part is the needed statistic value of the given mobile phone number.
For example, if the mobile phone numbers in China all start with 1, the first-level partition division can be performed by using the second digit of the mobile phone numbers, and the numbers with the second digits being 0, 1 and 2 are removed (the number should be a number which cannot be generated certainly), so that the first-level partitions of all the mobile phone numbers can be divided into 7 partitions in total; and according to the characteristics of the mobile phone number, performing secondary partition on each primary partition according to the 3 rd bit to the 7 th bit of the number, wherein 100000 secondary partitions are arranged under each primary partition, and 10000 positions are arranged under each secondary partition.
Giving any mobile phone number, calculating which primary partition the first primary partition belongs to according to the second position of the mobile phone number, then calculating a secondary partition in the primary partition according to 3 to 7 positions of the mobile phone number, determining whether the secondary partition exists, further performing a return value or dynamically generating the secondary partition according to a required operation, then calculating the position of the mobile phone number in the secondary partition according to 8 to 11 positions of the mobile phone number, and further acquiring a corresponding value of the mobile phone number or setting a corresponding value.
The invention has the beneficial effects that: by adopting the invention, due to the multi-stage partition, the required memory can be dynamically increased and counted according to the requirement when the mass mobile phone numbers are counted; particularly, when the mobile phone numbers of not all number sections are counted, corresponding memory values cannot be consumed when no number needs to be counted is available in a bitmap mode, and extra huge expenses caused by a hashmap mode can be avoided; the statistics is carried out in the mode of the invention, when the occurrence frequency of each number of all 40 hundred million numbers needs to be counted, only about 3870MB of memory needs to be consumed, which is one 10 times of that of the hash map mode; because the statistics and the obtained values are obtained by simply calculating and positioning, the requirement of quick operation can be met.
Drawings
FIG. 1 is a flow chart of the present patent application with respect to system initialization;
FIG. 2 is a flow chart of the present patent application with respect to setting statistics;
FIG. 3 is a flow chart of the present patent application with respect to obtaining statistics;
fig. 4 is a flow chart of the present patent application regarding setting statistics and obtaining statistics simultaneously.
In this patent application, bit: one bit of the computer binary; byte: one byte in the computer, wherein one byte has 8 bits; MB: megabytes; a bitmap: a binary bit based mapping method; hashmap: a fast key/value pair access scheme.
Detailed Description
The embodiments of the present invention are described below with reference to specific embodiments, and other advantages and effects of the present invention will be easily understood by those skilled in the art from the disclosure of the present specification. The invention may be embodied or carried out in various other specific embodiments, and various modifications and changes may be made in the details within the description and the drawings without departing from the spirit of the invention.
The method comprises the following steps: s1, initializing the system; s2, setting a statistic value; and S3, obtaining the statistic value.
As shown in fig. 1, preferably, in S1, an overall partition object is constructed, and then 7 primary partition objects are constructed in advance, where different partition objects have different definitions; the primary partition object is a set containing a plurality of secondary partition objects in one object, and the secondary objects are sets containing corresponding mobile phone numbers to be counted in one partition object.
Preferably, in S1, the secondary partition object in the primary partition object is empty, which is represented by an empty byte array, and the whole statistical partition object is in the initial state.
As shown in fig. 2, preferably, in S2, a mobile phone number and a statistical value corresponding to the mobile phone number are given, a first partition corresponding to the mobile phone number is calculated, and the first-level partition object is obtained from the whole partition object; calculating the position index of the mobile phone number in the primary partition object; judging whether a secondary partition object in the position exists or not; if not, generating the secondary object, and initializing the values in all positions of the secondary object to be initial 0 values; and calculating the position index of the mobile phone number in the secondary object, if the secondary object is not the object generated in the previous step, acquiring the value in the position index, adding the acquired value (the newly generated secondary object does not have the value) and the new value needing to be counted and increased, storing the result in the index position of the secondary partition, and counting the completion of the new value-added increase.
The statistical values that should be increased mean: the value to be added is a value that needs to be set when a specific statistical application is performed, for example, if a certain mobile phone number appears and the application needs to be counted as 1, the value to be added is 1, and if a certain special need needs to be counted as 2, the value to be added is 2.
The position index is the position value of the mobile phone number in the partition object.
Preferably, in S2, according to the mobile phone number, the 2 nd position of the mobile phone number is used to calculate the first partition corresponding to the mobile phone number.
Preferably, in S2, the position index of the mobile phone number in the primary partition object is calculated according to the 3 rd to 7 th digits of the mobile phone number.
10. Preferably, in S2, the position index of the mobile phone number in the secondary object is calculated according to the 8 th to 11 th digits of the mobile phone number, and a simple way to calculate the partition is as follows: the remainder is taken when the position index in the secondary object is (((mobile phone number-13000000000)/1000000000) remainder/10000).
As shown in fig. 3, preferably, in S3, a mobile phone number for which statistics needs to be obtained is given, a first partition corresponding to the mobile phone number is calculated according to the mobile phone number and the 2 nd digit of the mobile phone number, and the first-level partition object is obtained from the whole partition object; according to the 3 rd to 7 th positions of the mobile phone number, calculating the position index of the mobile phone number in the primary partition object; judging whether a secondary partition object in the position exists or not; if not, returning the statistical value as 0, namely the mobile phone number has no statistical value, otherwise, calculating the position index of the mobile phone number in the secondary object according to the 8 th to 11 th positions of the mobile phone number, and acquiring the value in the position index, wherein the value is the required statistical value.
As shown in fig. 4, preferably, S2 and S3 may be performed simultaneously, a mobile phone number to be processed is given, a first partition corresponding to the mobile phone number is calculated according to the 2 nd digit of the mobile phone number, and the first-level partition object is obtained from the whole partition object; according to the 3 rd to 7 th positions of the mobile phone number, calculating the position index of the mobile phone number in the primary partition object; judging whether a secondary partition object in the position exists or not; if not, generating the secondary object, and initializing the values in all positions of the secondary object to be initial 0 values; and calculating the position index of the mobile phone number in the secondary object according to the 8 th to 11 th positions of the mobile phone number, if the secondary object is not the object generated in the previous step, acquiring the value in the position index, judging whether the value reaches the limiting condition or not, directly returning, and if not, adding 1 to the acquired value, and storing the result to the index position of the secondary partition for subsequent service processing.
By adopting the invention, the mobile phone number is positioned in a partitioned way, and a small amount of memory is consumed for quick statistics and application; and (3) carrying out partition positioning on the digital type data with a large value range, and consuming a small amount of memory to carry out rapid statistics and application.
The above-described embodiments are merely illustrative of the principles and utilities of the present patent application and are not intended to limit the present patent application. Modifications and variations can be made to the above-described embodiments by those skilled in the art without departing from the spirit and scope of this patent application. Accordingly, it is intended that all equivalent modifications or changes which can be made by those skilled in the art without departing from the spirit and technical concepts disclosed in the present application shall be covered by the claims of the present application.
Claims (9)
1. A method for counting and applying mobile phone numbers by adopting partition positioning is characterized in that: the method comprises the following steps: s1, initializing the system; s2, setting a statistic value; and S3, obtaining the statistic value.
2. The method for mobile phone number statistics and application by partition positioning according to claim 1, wherein the method comprises the following steps: in S1, an entire partition object is constructed, and a primary partition object is constructed in advance.
3. The method for mobile phone number statistics and application by partition positioning according to claim 2, wherein the method comprises the following steps: in S1, the secondary partition object in the primary partition object is empty.
4. The method for mobile phone number statistics and application by partition positioning according to claim 3, wherein the method comprises the following steps: in S2, a mobile phone number and a corresponding statistical value to be increased are given, a first partition corresponding to the mobile phone number is calculated, and a first-level partition object is obtained from an overall partition object; calculating the position index of the mobile phone number in the primary partition object; judging whether a secondary partition object in the position exists or not; if not, generating the secondary object, and initializing the values in all positions of the secondary object to be initial 0 values; and calculating the position index of the mobile phone number in the secondary object, if the secondary object is not the object generated in the previous step, acquiring the value in the position index, adding the acquired value (the newly generated secondary object does not have the value) and the new value needing to be counted and increased, storing the result in the index position of the secondary partition, and counting the completion of the new value-added increase.
5. The method for mobile phone number statistics and application by partition positioning according to claim 4, wherein the method comprises the following steps: in S2, according to the mobile phone number, the 2 nd position of the mobile phone number is used to calculate the first partition corresponding to the mobile phone number. One way to simply compute the partition is to: the first partition value ((mobile phone number-13000000000)/1000000000) is an integer.
6. The method for mobile phone number statistics and application by partition positioning according to claim 4, wherein the method comprises the following steps: in S2, according to the 3 rd to 7 th digits of the mobile phone number, the position index of the mobile phone number in the primary partition object is calculated. One way to simply compute the partition is to: the position index in the first partition object is an integer (((mobile phone number-13000000000)/1000000000) remainder/10000).
7. The method for mobile phone number statistics and application by partition positioning according to claim 4, wherein the method comprises the following steps: in S2, the position index of the mobile phone number in the secondary object is calculated according to the 8 th to 11 th digits of the mobile phone number.
8. The method for mobile phone number statistics and application by partition positioning according to claim 3, wherein the method comprises the following steps: in S3, a mobile phone number needing to obtain a statistic value is given, a first partition corresponding to the mobile phone number is calculated according to the mobile phone number and the 2 nd position of the mobile phone number, and the first-level partition object is obtained from the whole partition object; according to the 3 rd to 7 th positions of the mobile phone number, calculating the position index of the mobile phone number in the primary partition object; judging whether a secondary partition object in the position exists or not; if not, returning the statistical value as 0, namely the mobile phone number has no statistical value, otherwise, calculating the position index of the mobile phone number in the secondary object according to the 8 th to 11 th positions of the mobile phone number, and acquiring the value in the position index, wherein the value is the required statistical value.
9. The method for mobile phone number statistics and application by using partition positioning according to claim 8, wherein the method comprises the following steps: s2 and S3 can be carried out simultaneously, a mobile phone number to be processed is given, a first partition corresponding to the mobile phone number is calculated according to the 2 nd position of the mobile phone number, and the first-level partition object is obtained from the whole partition object; according to the 3 rd to 7 th positions of the mobile phone number, calculating the position index of the mobile phone number in the primary partition object; judging whether a secondary partition object in the position exists or not; if not, generating the secondary object, and initializing the values in all positions of the secondary object to be initial 0 values; and calculating the position index of the mobile phone number in the secondary object according to the 8 th to 11 th positions of the mobile phone number, if the secondary object is not the object generated in the previous step, acquiring the value in the position index, judging whether the value reaches the limiting condition or not, directly returning, and if not, adding 1 to the acquired value, and storing the result to the index position of the secondary partition for subsequent service processing.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811619139.9A CN111382185B (en) | 2018-12-28 | 2018-12-28 | Method for counting and applying mobile phone numbers by adopting partition positioning |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811619139.9A CN111382185B (en) | 2018-12-28 | 2018-12-28 | Method for counting and applying mobile phone numbers by adopting partition positioning |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111382185A true CN111382185A (en) | 2020-07-07 |
CN111382185B CN111382185B (en) | 2024-01-26 |
Family
ID=71216668
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811619139.9A Active CN111382185B (en) | 2018-12-28 | 2018-12-28 | Method for counting and applying mobile phone numbers by adopting partition positioning |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111382185B (en) |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20010067989A (en) * | 2001-04-12 | 2001-07-13 | 이상철 | Method for divisional billing and device thereof |
CN101087203A (en) * | 2006-06-11 | 2007-12-12 | 上海全成通信技术有限公司 | A statistical method of high magnitude of data |
CN101572762A (en) * | 2009-02-25 | 2009-11-04 | 南京联创科技股份有限公司 | Method for realizing combination of mass tickets by statistic based storage management and quick indexing |
CN201465178U (en) * | 2009-06-05 | 2010-05-12 | 魏建军 | Searching and trading system for cellphone number |
CN102375853A (en) * | 2010-08-24 | 2012-03-14 | 中国移动通信集团公司 | Distributed database system, method for building index therein and query method |
CN102984396A (en) * | 2012-12-25 | 2013-03-20 | 广州从兴电子开发有限公司 | Statistical method and device of number of active users |
CN103354576A (en) * | 2013-06-28 | 2013-10-16 | 贵阳朗玛信息技术股份有限公司 | Mobile phone, and methods for storing and searching for mobile phone number attribution information |
CN105335463A (en) * | 2015-09-23 | 2016-02-17 | 广州市中崎商业机器股份有限公司 | Data storage method and quick reading method for cash register |
CN106326500A (en) * | 2016-10-26 | 2017-01-11 | 北京微网通联股份有限公司 | Quick filtering method for phone number blacklist |
CN108011976A (en) * | 2017-12-26 | 2018-05-08 | 福建星瑞格软件有限公司 | A kind of recognition methods of access terminals model and computer equipment |
-
2018
- 2018-12-28 CN CN201811619139.9A patent/CN111382185B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20010067989A (en) * | 2001-04-12 | 2001-07-13 | 이상철 | Method for divisional billing and device thereof |
CN101087203A (en) * | 2006-06-11 | 2007-12-12 | 上海全成通信技术有限公司 | A statistical method of high magnitude of data |
CN101572762A (en) * | 2009-02-25 | 2009-11-04 | 南京联创科技股份有限公司 | Method for realizing combination of mass tickets by statistic based storage management and quick indexing |
CN201465178U (en) * | 2009-06-05 | 2010-05-12 | 魏建军 | Searching and trading system for cellphone number |
CN102375853A (en) * | 2010-08-24 | 2012-03-14 | 中国移动通信集团公司 | Distributed database system, method for building index therein and query method |
CN102984396A (en) * | 2012-12-25 | 2013-03-20 | 广州从兴电子开发有限公司 | Statistical method and device of number of active users |
CN103354576A (en) * | 2013-06-28 | 2013-10-16 | 贵阳朗玛信息技术股份有限公司 | Mobile phone, and methods for storing and searching for mobile phone number attribution information |
CN105335463A (en) * | 2015-09-23 | 2016-02-17 | 广州市中崎商业机器股份有限公司 | Data storage method and quick reading method for cash register |
CN106326500A (en) * | 2016-10-26 | 2017-01-11 | 北京微网通联股份有限公司 | Quick filtering method for phone number blacklist |
CN108011976A (en) * | 2017-12-26 | 2018-05-08 | 福建星瑞格软件有限公司 | A kind of recognition methods of access terminals model and computer equipment |
Non-Patent Citations (1)
Title |
---|
陈康: "《云计算:系统实例与研究现状》", 《软件学报》, pages 1337 - 1348 * |
Also Published As
Publication number | Publication date |
---|---|
CN111382185B (en) | 2024-01-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108255958B (en) | Data query method, device and storage medium | |
CN110413611B (en) | Data storage and query method and device | |
CN107807982B (en) | Consistency checking method and device for heterogeneous database | |
US11762828B2 (en) | Cuckoo filters and cuckoo hash tables with biasing, compression, and decoupled logical sparsity | |
US10489403B2 (en) | Embracing and exploiting data skew during a join or groupby | |
CN106326475B (en) | Efficient static hash table implementation method and system | |
CN106407207B (en) | Real-time newly-added data updating method and device | |
CN111079917A (en) | Tensor data block access method and device | |
CN109801693B (en) | Medical records grouping method and device, terminal and computer readable storage medium | |
CN108427736B (en) | Method for querying data | |
WO2020000486A1 (en) | Data processing method and device | |
WO2017020735A1 (en) | Data processing method, backup server and storage system | |
CN112765163A (en) | Data index storage method, system and device capable of extending dimensionality at will | |
CN112434085B (en) | Roaring Bitmap-based user data statistical method | |
CN103780263B (en) | Device and method of data compression and recording medium | |
US10698608B2 (en) | Method, apparatus and computer storage medium for data input and output | |
CN116610731B (en) | Big data distributed storage method and device, electronic equipment and storage medium | |
CN111382185A (en) | Method for counting and applying mobile phone numbers by adopting partition positioning | |
CN104077272A (en) | Method and device for compressing dictionary | |
CN111538730B (en) | Data statistics method and system based on Hash bucket algorithm | |
CN104636474A (en) | Method and equipment for establishment of audio fingerprint database and method and equipment for retrieval of audio fingerprints | |
CN114595215A (en) | Data processing method and device, electronic equipment and storage medium | |
CN112380004B (en) | Memory management method, memory management device, computer readable storage medium and electronic equipment | |
CN107992555B (en) | Method for storing and reading raster data | |
CN105468603A (en) | Data selection method and apparatus |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |