CN111382185B - 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 PDF

Info

Publication number
CN111382185B
CN111382185B CN201811619139.9A CN201811619139A CN111382185B CN 111382185 B CN111382185 B CN 111382185B CN 201811619139 A CN201811619139 A CN 201811619139A CN 111382185 B CN111382185 B CN 111382185B
Authority
CN
China
Prior art keywords
mobile phone
partition
phone number
value
counting
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.)
Active
Application number
CN201811619139.9A
Other languages
Chinese (zh)
Other versions
CN111382185A (en
Inventor
徐文平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuxi Heming Network Technology Co ltd
Original Assignee
Wuxi Heming Network Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Wuxi Heming Network Technology Co ltd filed Critical Wuxi Heming Network Technology Co ltd
Priority to CN201811619139.9A priority Critical patent/CN111382185B/en
Publication of CN111382185A publication Critical patent/CN111382185A/en
Application granted granted Critical
Publication of CN111382185B publication Critical patent/CN111382185B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention provides a method for counting and applying mobile phone numbers by adopting partition positioning, which comprises the following steps: s1, initializing a system; s2, setting a statistic value; s3, acquiring a statistic value, and dynamically increasing a memory required by statistics according to requirements in the process of counting mass mobile phone numbers due to the multi-stage partitioning; especially when the mobile phone numbers of all the number segments are counted, compared with the bitmap mode, when the number needing to be counted is not available, the corresponding memory value is not consumed, and the extra huge expense caused by the hashmap mode can be avoided; when the statistics is carried out in the mode of the invention, when the occurrence times of each number of 40 hundred million numbers are required to be counted, only about 3870MB of memory is consumed, which is 10 times of that of the hashmap mode, if the number quantity is increased or decreased, the memory is not increased or decreased continuously in the mode of the invention, and the memory is increased or decreased continuously in other modes; because the statistics and the acquired values are obtained by simple calculation and positioning, the requirement of quick operation can be met.

Description

Method for counting and applying mobile phone numbers by adopting partition positioning
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 type data in the memory.
Background
In the information processing system related to mobile phone numbers, when the service system carries out related statistics on mobile phone numbers and carries out application processing according to the statistics result, if only statistics on whether the mobile phone numbers appear or not, at present, all mobile phone numbers in China should be about 40 hundred million, the optimal mode of the prior art generally adopts a bitmap mode for processing, and the bitmap mode needs to construct one or more very suitable mapping functions to ensure that 40 hundred million numbers in a suitable bitmap, extremely preferably 40 hundred million mobile phone numbers just fill the whole bitmap and do not exceed one bit, at this time, a bitmap container with the size of 477MB is needed to be adequately accommodated, and at the extreme worst, the number (70 hundred million numbers) of all number segments needs to be constructed, at this time, the bitmap container with the size of 835MB needs to be adequately accommodated. Due to randomness of the statistics of the mobile phone numbers, the memory required to be consumed by the final statistics result is often close to the worst case.
The above method simply counts whether the mobile phone number appears or not, and once the business needs to count the number of times that all the mobile phone numbers appear in the business, the bitmap method cannot be used. The conventional method is to process in a hashmap mode, wherein the hashmap key is a counted mobile phone number, and the value is the number of times of occurrence of the mobile phone number, and the hashmap key is recorded in this mode, even if the key occupies only 4 bytes (40 hundred million values are total, and the minimum 4 bytes are required to represent the completion), the value occupies only 1 byte, and then 40 hundred million mobile phone numbers require up to 19074MB of memory consumption, and if the additional auxiliary overhead necessary for hasmap is added, the whole memory consumption is not bearable.
Because the statistics and application processing of mobile phone numbers are needed in the internal memory in the business, and because of the randomness of the mobile phone numbers, the expression processing cannot be performed in a sequential manner in the statistics, if the conventional statistics recording modes such as hashmap are adopted in the case that the business needs to be rapidly counted, huge internal memory consumption is needed when the statistics of massive mobile phone numbers is needed. And if handled in other ways, the traffic requirements are not met in terms of statistics and acquisition performance.
Disclosure of Invention
The invention aims to provide a method for carrying out statistics and application of mobile phone numbers by adopting partition positioning, which is used for carrying out rapid index statistics on massive mobile phone numbers in a memory with a small amount of memory consumption and utilizing statistical results, and is used for rapidly counting the total occurrence times of each mobile phone number for the massive mobile phone numbers; and the method can be further expanded into a method for carrying out rapid index statistics and utilization on massive digital type data.
In order to achieve the above purpose, the following technical scheme is adopted: according to the characteristics of the mobile phone numbers, carrying out multi-level partition division on all possible mobile phone numbers so as to ensure that all legal mobile phone numbers are contained in one partition in the whole partition division, wherein the number of partition stages and the number of each partition are fixed by a determined partition mode;
each specific partition is dynamically generated when the partition has data to be recorded, and if the partition has no statistical data record, the partition is empty, so that specific memory space is not consumed. The specific record value in the subarea is determined by adopting recording modes such as bit, byte and the like according to the number of each mobile phone number which needs to be counted, for example, if only the mobile phone number is counted, the subarea value is bit, if the counted possible number of times of each mobile phone number is not more than 256, the subarea value is recorded by adopting Byte.
Giving a mobile phone number to be counted, and calculating a partition where the mobile phone number should be according to a partition definition mode by the mobile phone number; 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 subarea according to the mobile phone number, judging the value of the internal position of the subarea, setting a required value at the position if no value exists, and setting the original value and adding the value required to be newly set at the position if the value exists.
When the statistic value of a given mobile phone number is obtained, calculating a partition where the mobile phone number should be according to the definition of the partition, judging whether the partition exists or not, if not, judging that the mobile phone number does not have the statistic value, and if so, calculating the position inside the partition according to the mobile phone number to obtain the value at the corresponding position inside the partition, wherein the value at the internal position is the statistic value of the required given mobile phone number.
For example, the mobile phone numbers in China start with 1, the first-level partition division can be performed by using the second bit of the mobile phone number, and numbers with the second bit of 0, 1 and 2 (the numbers should be numbers which do not occur in a positive way) are removed, so that the first-level partition of all the mobile phone numbers can be divided into 7 partitions in total; and then according to the characteristics of the mobile phone number, each primary partition is subjected to secondary partition according to the 3 rd bit to the 7 th bit of the number, so that 100000 secondary partitions are arranged under each primary partition, and no partition is performed under each secondary partition, so that 10000 positions are arranged under each secondary partition.
Giving any mobile phone number, calculating which primary partition the primary partition belongs to according to the second bit of the mobile phone number, then calculating the secondary partition in the primary partition according to the 3-7 bits of the mobile phone number, determining whether the secondary partition exists, then carrying out return value or dynamically generating the secondary partition according to the required operation, then calculating the position of the mobile phone number in the secondary partition according to the 8-11 bits of the mobile phone number, and further obtaining the corresponding value of the mobile phone number or setting the corresponding value.
The invention has the beneficial effects that: by adopting the invention, the memory required by statistics can be dynamically increased according to the needs in the statistics of mass mobile phone numbers due to the multi-level partitioning; especially when the mobile phone numbers of all the number segments are counted, compared with the bitmap mode, when the number needing to be counted is not available, the corresponding memory value is not consumed, and the extra huge expense caused by the hashmap mode can be avoided; when counting the occurrence times of each number of 40 hundred million numbers in the way of the invention, only about 3870MB of memory is consumed, which is 10 times of that of hashmap; because the statistics and the acquired values are obtained by simple calculation 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 application with respect to setting statistics;
FIG. 3 is a flow chart of the present application for obtaining statistics;
fig. 4 is a flow chart of the present application for setting statistics and obtaining statistics simultaneously.
In this patent application, bit: one bit of computer binary; byte: one byte in the computer, one byte has 8 bits; MB: megabytes; bitmap: a mapping method based on binary bits; hashmap: a fast key/value pair access method.
Detailed Description
Other advantages and effects of the present invention will become apparent to those skilled in the art from the following disclosure, which describes the embodiments of the present invention with reference to specific examples. The invention may be practiced or carried out in other embodiments and details within the scope and range of equivalents of the specific features disclosed herein are capable of modifications and variations in various respects, all without departing from the spirit of the present patent application.
The method comprises the following steps: s1, initializing a system; s2, setting a statistic value; s3, obtaining a statistic value.
As shown in FIG. 1, in S1, preferably, an integral partition object is constructed, 7 primary partition objects are pre-constructed, and different partition objects have different definitions; the primary partition object is a set of a plurality of secondary partition objects contained in one object, and the secondary partition object is a set of corresponding mobile phone numbers needing statistics contained in one partition object.
Preferably, in S1, the secondary partition object in each primary partition object is empty, here represented by an empty byte array, and the whole statistical partition object is in an initial state.
In the preferred embodiment shown in fig. 2, in S2, a first partition corresponding to a mobile phone number and a corresponding statistical value to be added are 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 the secondary partition object in the position exists or not; if not, generating the secondary object, and initializing values in all positions in 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 immediately before, acquiring the value in the position index, adding the acquired value (the newly generated secondary object does not have the value) and a new value needing to be statistically increased, and storing the result to the index position of the secondary partition, wherein the statistical new value is increased.
By statistics that should be increased is meant: the value that should be added is the value that needs to be set at the time of a specific statistical application, such as when a certain phone number appears, the value that should be added is 1 when the application needs to be statistically 1, and is added to 2 when a certain special requirement needs to be statistically 2 at this time.
The location index is the location value of the mobile phone number in the partition object.
Preferably, in S2, according to the mobile phone number, the first partition corresponding to the mobile phone number is calculated from the 2 nd bit of the mobile phone number.
Preferably, in S2, the location index of the mobile phone number in the primary partition object is calculated according to the 3 rd to 7 th bits 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 bits of the mobile phone number, and one simple way to calculate the partition is as follows: the position index in the secondary object= (((handset number-13000000000)/1000000000) takes remainder/10000) takes remainder.
In the preferred embodiment shown in fig. 3, in S3, a mobile phone number to be obtained is given, according to the mobile phone number, the first partition corresponding to the mobile phone number is calculated from the 2 nd bit of the mobile phone number, 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 according to the 3 rd to 7 th positions of the mobile phone number; judging whether the secondary partition object in the position exists or not; if not, returning to the statistic value of 0, namely that the mobile phone number has no statistic 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 obtaining the value in the position index, wherein the value is the required statistic value.
As shown in fig. 4, preferably, S2 and S3 may be performed simultaneously, a mobile phone number to be processed is given, and according to the 2 nd bit of the mobile phone number, 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 according to the 3 rd to 7 th positions of the mobile phone number; judging whether the secondary partition object in the position exists or not; if not, generating the secondary object, and initializing values in all positions in 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 immediately before, acquiring the value in the position index, judging whether the value reaches the limiting condition, and directly returning to the limiting condition, otherwise, adding 1 to the acquired value, and storing the result in the index position of the secondary partition for subsequent service processing.
By adopting the method, the mobile phone number is subjected to partition positioning, and a small amount of memory is consumed for quick statistics and application; and carrying out partition positioning on the digital type data with large value range, and consuming a small amount of memory for quick statistics and application.
The above-described embodiments are merely illustrative of the principles of the present application and their effectiveness, and are not intended to limit the present application. Modifications and variations may be made to the above-described embodiments by those skilled in the art without departing from the spirit and scope of the present application. Accordingly, it is intended that all equivalent modifications and variations which a person having ordinary skill in the art would accomplish without departing from the spirit and technical spirit disclosed in the present patent application shall be covered by the claims of the present patent application.

Claims (6)

1. The method for counting the mobile phone numbers by adopting partition positioning is characterized by comprising the following steps: s1, initializing a system; s2, setting a statistic value; s3, obtaining a statistical value; s1, constructing an integral partition object, and then pre-constructing a first-level partition object; s1, a secondary partition object in each primary partition object is empty; s2, a mobile phone number and a corresponding statistical value to be added 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 the secondary partition object in the position exists or not; if not, generating the secondary object, and initializing values in all positions in 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 immediately before, acquiring the value in the position index, and adding the acquired value and a new value needing to be statistically increased to the new value which is not acquired by the new secondary object, and storing the result to the index position of the secondary partition, wherein the statistical new value is increased.
2. The method for counting mobile phone numbers by adopting partition positioning according to claim 1, wherein in S2, according to the mobile phone number, a first partition corresponding to the mobile phone number is calculated from the 2 nd bit of the mobile phone number; the way this partition is calculated is: the first partition value= ((handset number-13000000000)/1000000000) is an integer.
3. The method for counting mobile phone numbers by partition positioning according to claim 1, wherein 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 positions of the mobile phone number; the way this partition is calculated is: the position index= (((handset number-13000000000)/1000000000) takes remainder/10000) in the first partition object is an integer.
4. The method for counting mobile phone numbers by partition positioning according to claim 1, wherein in S2, the position index of the mobile phone number in the secondary object is calculated according to the 8 th to 11 th positions of the mobile phone number.
5. The method for counting mobile phone numbers by partition positioning according to claim 1, wherein in the step S3, a mobile phone number requiring to obtain a statistics value is given, a first partition corresponding to the mobile phone number is calculated according to the mobile phone number by the 2 nd bit of the mobile phone number, 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 according to the 3 rd to 7 th positions of the mobile phone number; judging whether the secondary partition object in the position exists or not; if not, returning to the statistic value of 0, namely that the mobile phone number has no statistic 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 obtaining the value in the position index, wherein the value is the required statistic value.
6. The method for counting mobile phone numbers by partition positioning according to claim 5, wherein S2 and S3 are 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 bit of the mobile phone number, 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 according to the 3 rd to 7 th positions of the mobile phone number; judging whether the secondary partition object in the position exists or not; if not, generating the secondary object, and initializing values in all positions in 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 immediately before, acquiring the value in the position index, judging whether the value reaches the limiting condition, and directly returning to the limiting condition, otherwise, adding 1 to the acquired value, and storing the result in the index position of the secondary partition for subsequent service processing.
CN201811619139.9A 2018-12-28 2018-12-28 Method for counting and applying mobile phone numbers by adopting partition positioning Active CN111382185B (en)

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 CN111382185A (en) 2020-07-07
CN111382185B true 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)

* Cited by examiner, † Cited by third party
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

Patent Citations (10)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
Title
《云计算:系统实例与研究现状》;陈康;《软件学报》;第1337-1348页 *

Also Published As

Publication number Publication date
CN111382185A (en) 2020-07-07

Similar Documents

Publication Publication Date Title
CN108255958B (en) Data query method, device and storage medium
CN110399104B (en) Data storage method, data storage device, electronic apparatus, and storage medium
CN106202280B (en) Information processing method and server
CN111061758B (en) Data storage method, device and storage medium
CN109801693B (en) Medical records grouping method and device, terminal and computer readable storage medium
WO2017020735A1 (en) Data processing method, backup server and storage system
CN106503008A (en) File memory method and device and file polling method and apparatus
WO2020000486A1 (en) Data processing method and device
CN112163299A (en) Excavator oil consumption prediction method and system and electronic equipment
CN111382185B (en) Method for counting and applying mobile phone numbers by adopting partition positioning
CN111752987A (en) Database access method and device, storage medium and computer equipment
CN112286930A (en) Method, device, storage medium and electronic equipment for resource sharing of redis business side
CN110008020B (en) Memory management method, memory management device, electronic equipment and computer readable storage medium
CN111538730B (en) Data statistics method and system based on Hash bucket algorithm
CN112380004B (en) Memory management method, memory management device, computer readable storage medium and electronic equipment
CN114297318A (en) Data processing method and device
CN113763034A (en) Advertisement data processing method and device
CN110633388B (en) Real-time index generation method, system and storage medium based on communication XDR
CN114595215A (en) Data processing method and device, electronic equipment and storage medium
CN112835867A (en) Data preprocessing method and device
CN113297107A (en) Data processing method and device and electronic equipment
CN105468603A (en) Data selection method and apparatus
CN111782645A (en) Data processing method and device
CN112612415B (en) Data processing method and device, electronic equipment and storage medium
CN112799978B (en) Cache design management method, device, equipment and computer readable storage medium

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