CN102214360A - Bitmap constructing method and device, intersection method and intersection device - Google Patents

Bitmap constructing method and device, intersection method and intersection device Download PDF

Info

Publication number
CN102214360A
CN102214360A CN2010101417790A CN201010141779A CN102214360A CN 102214360 A CN102214360 A CN 102214360A CN 2010101417790 A CN2010101417790 A CN 2010101417790A CN 201010141779 A CN201010141779 A CN 201010141779A CN 102214360 A CN102214360 A CN 102214360A
Authority
CN
China
Prior art keywords
bitmap
level
section
sky
rheme
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
Application number
CN2010101417790A
Other languages
Chinese (zh)
Other versions
CN102214360B (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.)
Shenzhen Shiji Guangsu Information Technology Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN 201010141779 priority Critical patent/CN102214360B/en
Publication of CN102214360A publication Critical patent/CN102214360A/en
Application granted granted Critical
Publication of CN102214360B publication Critical patent/CN102214360B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a bitmap constructing method and a bitmap constructing device, an intersection method and an intersection device, belonging to the technical field of a computer. According to the embodiment of the invention, secondary bitmaps are added; and each bit in the secondary bitmaps is corresponding to at least two bits in primary bitmaps so that the primary bitmaps are segmented, all the empty segments in the primary bitmaps are deleted, and corresponding bits in the secondary bitmaps are identified. Thus, for sparse sets, one bit in the primary bitmaps represents a plurality of bits in the primary bitmaps so as to save storage space. When intersection is performed on more than two sets, bitwise 'and' operation is carried out on the secondary bitmaps so as to find out the bits of the secondary bitmaps which are not empty at the same time. When the same one bit in two or a plurality of secondary bitmaps is non-empty, the bits of the primary bitmaps corresponding to the non-empty bit are subjected to intersection so as to calculate the intersection of two or a plurality of sets. According to the embodiment of the invention, the operation amount is reduced when bitwise 'and' operation on intersection is performed.

Description

A kind of bitmap construction method and device, the method for asking friendship and device
Technical field
The present invention relates to a kind of field of computer technology, particularly a kind of bitmap construction method and device, the method for asking friendship and device.
Background technology
Asking friendship is a kind of set operation, and target is to obtain identical element in two or more set.For example set A=1,3,5,6}, set B=2,4,5,8}, then to ask the result after the friendship be { 5} for set A, set B.In the prior art method of asking friendship is mainly comprised: multidiameter delay asks friendship method, trial method, Bitmap (bitmap) to ask the friendship method.
Bitmap asks the friendship method to use Bitmap (bitmap) expression set, an element during each bit represents to gather, as certain set={ 1,4,5,7}, because element maximum in the set is 7, so need 8bit (1 byte) to represent that corresponding bitmap, each element occupy bit corresponding in the bitmap, promptly can be designated: 10110010.Be each to an element in should gathering, 10110010 from right to left respectively corresponding 0,1,2,3,4,5,6,7; If in this set respective element is arranged, then Bitmap corresponding positions value is 1; If do not have respective element in this set, then value is 0.
Because set uses binary bitmap to represent, then asking between the set hands over element can be converted into binary " step-by-step with " computing.With A={1,4,5,7}, B={0,3,5,6} is an example, both bitmaps are described and are respectively: 10110010 (16 systems are 0xB2), 01101001 (sexadecimal is 0x69), set are asked to hand over and are equivalent to 0xB2﹠amp; 0x69=0x20 (scale-of-two is 00100000), being reduced to the decimal system is 5, promptly asking and handing over the result is { 5}.
In realizing process of the present invention, the inventor finds that there is following problem at least in prior art:
When the element of existing Bitmap algorithm in set was more sparse, { 0,1,128} needed 128 bit to represent, but has only utilized 3 bit, can waste storage space like this as the expression set.
Summary of the invention
In order to solve the problem that can waste a large amount of spaces when the element of Bitmap algorithm in set is more sparse in the prior art, the embodiment of the invention has proposed a kind of bitmap construction method and device, the method for asking friendship and device.Described technical scheme is as follows:
The embodiment of the invention has proposed a kind of construction method of bitmap, comprising:
The one-level bitmap is set, and whether the one or more element of the corresponding set in the non-room of each of described one-level bitmap has in the described set and described non-room elements corresponding to identify;
The secondary bitmap is set, two positions or two position sections of the described one-level bitmap of each correspondence of described secondary bitmap with upper formation, when the position of institute's rheme section be when sky all, be designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described secondary bitmap; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described secondary bitmap was a non-NULL.
Preferred as technique scheme, in the described method, the length of the position section of the one-level bitmap that each of described secondary bitmap is corresponding is identical, or the length of the position section of each corresponding one-level bitmap of described secondary bitmap is inequality.
Preferred as technique scheme, described method also comprises:
N level bitmap is set, two positions or two position sections of the described previous stage bitmap of each correspondence of each grade bitmap in the described n level bitmap with upper formation, when the position of institute's rheme section be when sky all, be designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described n level bitmap; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described n level bitmap was a non-NULL; Wherein, n is more than or equal to 3.
The embodiment of the invention has also proposed a kind of construction device of bitmap, comprising:
Whether the one-level bitmap is provided with module, is used to be provided with the corresponding one or more element of gathering in each non-room of one-level bitmap, have in the described set and described non-room elements corresponding to identify;
The secondary bitmap is provided with module, is used to be provided with each of secondary bitmap and two positions or two corresponding relations with the position section of upper formation of described one-level bitmap; When the position of institute's rheme section be when sky all, be designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described secondary bitmap; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described secondary bitmap was a non-NULL.
Preferred as technique scheme, described secondary bitmap is provided with in the module, and the length of the position section of the one-level bitmap that each of described secondary bitmap is corresponding is identical, or the length of the position section of each corresponding one-level bitmap of described secondary bitmap is inequality.
Preferred as technique scheme, described device also comprises:
Senior bitmap is provided with module, be used to be provided with n level bitmap, two positions or two position sections of the described previous stage bitmap of each correspondence of each grade bitmap in the described n level bitmap with upper formation, when the position of institute's rheme section is sky all, be designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described n level bitmap; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described n level bitmap was a non-NULL; Wherein, n is more than or equal to 3.
The embodiment of the invention has also proposed a kind of method of asking friendship, comprising:
The one-level bitmap is set, and whether the one or more element of the corresponding set in the non-room of each of described one-level bitmap has in the described set and described non-room elements corresponding to identify;
The secondary bitmap is set, two positions or two position sections of the described one-level bitmap of each correspondence of described secondary bitmap with upper formation, when the position of institute's rheme section be when sky all, be designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described secondary bitmap; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described secondary bitmap was a non-NULL;
When two or more set being asked when handing over, earlier the corresponding secondary bitmap bits of described each set is asked friendship, to calculate the position that is non-NULL in the corresponding position in all secondary bitmaps;
According to the corresponding position that is non-NULL of described secondary bitmap, obtain the position section of one-level bitmap of each set of each correspondence, and respectively the position section of all set of each correspondence is asked friendship, calculate the intersection of sets collection.
Preferred as technique scheme, in the described method, the length of the position section of the one-level bitmap that each of described secondary bitmap is corresponding is identical, or the length of the position section of each corresponding one-level bitmap of described secondary bitmap is inequality.
Preferred as technique scheme describedly asked friendship to the corresponding secondary bitmap bits of described each set, and the position that is non-NULL in the corresponding position comprises in all secondary bitmaps to calculate:
Obtaining the corresponding secondary bitmap of each set, and all secondary bitmaps are carried out step-by-step and operation, is the corresponding positions of non-NULL to calculate described all secondary bitmaps simultaneously.
Preferred as technique scheme describedly asked friendship to described all sections, calculates the intersection of sets collection and comprises:
Corresponding positions in all sections is carried out step-by-step and operation, is the position of non-NULL in the corresponding positions to calculate in the one-level bitmap simultaneously;
Described one-level bitmap is reduced calculating for the position of non-NULL simultaneously, calculate this element value; Each corresponding one-level bitmap bits of sequence number * secondary bitmap of the secondary bitmap of this corresponding element value=affiliated length+this is positioned at the side-play amount of secondary bitmap.
The embodiment of the invention has also proposed a kind of device of asking friendship, comprising:
Whether the one-level bitmap is provided with module, is used to be provided with the corresponding one or more element of gathering in each non-room of one-level bitmap, have in the described set and described non-room elements corresponding to identify;
Two positions of the described one-level bitmap of each correspondence of described secondary bitmap or two position sections with upper formation when the position of institute's rheme section be sky all, are designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described secondary bitmap; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described secondary bitmap was a non-NULL;
The secondary bitmap is asked the friendship module, is used for earlier the corresponding secondary bitmap bits of described each set being asked friendship, to calculate the position that is non-NULL in the corresponding position in all secondary bitmaps when two or more set being asked when handing over;
The one-level bitmap is asked the friendship module, the position that is non-NULL in the corresponding position of secondary bitmap that is used for asking the friendship module to obtain according to described secondary bitmap, obtain the position section of one-level bitmap of each set of each correspondence, and respectively the position section of all set of each correspondence is asked friendship, calculate the intersection of sets collection.
Preferred as technique scheme, described secondary bitmap is provided with in the module, and the length of the position section of the one-level bitmap that each of described secondary bitmap is corresponding is identical, or the length of the position section of each corresponding one-level bitmap of described secondary bitmap is inequality.
Preferred as technique scheme, described secondary bitmap is asked and is handed over module to be used to obtain the corresponding secondary bitmap of each set, and all secondary bitmaps are carried out step-by-step and operation, is the corresponding positions of non-NULL simultaneously to calculate described all secondary bitmaps.
Preferred as technique scheme, described one-level bitmap is asked and is handed over module to comprise:
Step-by-step and operating unit are used for calculating one-level bitmap corresponding positions and carry out step-by-step and operation, are the position of non-NULL simultaneously in the corresponding positions to calculate in the one-level bitmap;
The element value computing unit is used for described one-level bitmap is reduced calculating for the position of non-NULL simultaneously, calculates this element value; Each corresponding one-level bitmap bits of sequence number * secondary bitmap of the secondary bitmap of this corresponding element value=affiliated length+this is positioned at the side-play amount of secondary bitmap.
The beneficial effect of the technical scheme that the embodiment of the invention provides is: the embodiment of the invention has proposed a kind of bitmap construction method and device, the method for asking friendship and device.The embodiment of the invention increases the secondary bitmap, and makes at least two of each corresponding one-level bitmap of secondary bitmap.So just the one-level bitmap can be carried out segmentation, and will all be empty section deletion in the one-level bitmap, and corresponding bit-identify comes out in the secondary bitmap.Can represent a plurality of positions of one-level bitmap by of secondary bitmap, to save storage space for sparse set like this.When two or more set being asked friendship, step-by-step and operation will be carried out earlier in the secondary bitmap, to find out the position of the secondary bitmap that is not sky simultaneously.Have only when two or more secondary bitmaps same to correspond to when all being non-NULL, then the position of the one-level bitmap of these correspondences is asked friendship again, can calculate two or more intersection of sets collection like this.The embodiment of the invention can reduce operand when the step-by-step of asking friendship and operation.
Description of drawings
In order to be illustrated more clearly in the technical scheme of the embodiment of the invention, to do one to the accompanying drawing that uses among the embodiment below introduces simply, apparently, below listed accompanying drawing only be some embodiments of the present invention, for those of ordinary skills, under the prerequisite of not paying creative work, can also obtain other accompanying drawing according to these accompanying drawings.
Fig. 1 is the schematic flow sheet of first embodiment of the invention;
Fig. 2 is the schematic flow sheet of second embodiment of the invention;
Fig. 3 is the structural representation of third embodiment of the invention;
Fig. 4 is the structural representation of fourth embodiment of the invention;
Fig. 5 is the schematic flow sheet of fifth embodiment of the invention;
Fig. 6 is the schematic flow sheet of sixth embodiment of the invention;
Fig. 7 is the structural representation of seventh embodiment of the invention;
Fig. 8 is the structural representation of eighth embodiment of the invention;
Fig. 9 is the corresponding relation synoptic diagram of secondary bitmap in the embodiment of the invention, one-level bitmap;
Figure 10 is the secondary bitmap of set A correspondence in the embodiment of the invention, the corresponding relation synoptic diagram of one-level bitmap;
Figure 11 is the secondary bitmap of set B correspondence in the embodiment of the invention, the corresponding relation synoptic diagram of one-level bitmap;
Figure 12 is the synoptic diagram that the secondary bitmap of Figure 10 and Figure 11 carries out step-by-step and operation;
Figure 13 is the synoptic diagram that the one-level bitmap of Figure 10 and Figure 11 carries out step-by-step and operation.
Embodiment
For making the purpose, technical solutions and advantages of the present invention clearer, embodiment of the present invention is described further in detail below in conjunction with accompanying drawing.
Embodiment 1
First embodiment of the invention has proposed a kind of construction method of bitmap, and its flow process comprises as shown in Figure 1:
Step 101, the one-level bitmap is set, whether the one or more element of the corresponding set in the non-room of each of described one-level bitmap has in the described set and described non-room elements corresponding to identify;
Step 102, the secondary bitmap is set, two positions or two position sections of the described one-level bitmap of each correspondence of described secondary bitmap with upper formation, when the position of institute's rheme section be when sky all, be designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described secondary bitmap; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described secondary bitmap was a non-NULL.
The embodiment of the invention increases the secondary bitmap, and makes at least two of each corresponding one-level bitmap of secondary bitmap.So just the one-level bitmap can be carried out segmentation, and will all be empty section deletion in the one-level bitmap, and corresponding bit-identify comes out in the secondary bitmap.Can represent a plurality of positions of one-level bitmap by of secondary bitmap, to save storage space for sparse set like this.Certainly, can also set up three grades of bitmaps, level Four bitmap as required, the embodiment of the invention is not as limit.These kinds mode has all comprised the secondary bitmap at least, therefore should be within protection domain of the present invention.Simultaneously, the embodiment of the invention does not limit the set number of one-level bitmap correspondence yet; An one-level bitmap can corresponding one or more set.
Embodiment 2
Second embodiment of the invention has proposed a kind of construction method of bitmap, and its flow process comprises as shown in Figure 2:
Step 201, the one-level bitmap is set, whether the one or more element of the corresponding set in the non-room of each of described one-level bitmap has in the described set and described non-room elements corresponding to identify.
In above-mentioned step 201, be with the corresponding set of an one-level bitmap (Bitmap) in the prior art, and an element of each corresponding set of one-level bitmap.When an element in the set was sky, the position of corresponding one-level bitmap was 0.When an element in set was non-NULL, the position of corresponding one-level bitmap was 1.Certainly adopt this mode in the embodiment of the invention, can certainly adopt in will gathering to the position in the corresponding one-level bitmap in empty position is 1, and be that the position of non-NULL is 0, the embodiment of the invention is not as limit.And the corresponded manner of one-level bitmap and set, can be as stated in the Background Art, each element of corresponding set also can adopt other modes from left to right, and for example by the right side each element to the corresponding set in a left side, the embodiment of the invention is not as limit.Simultaneously, do not limit the number of elements of the corresponding set in a position of one-level bitmap in the embodiment of the invention, the position of one-level bitmap can corresponding a plurality of elements.That is, the one-level bitmap can be as the prior art illustrated, an element in each corresponding set.Also can make a plurality of elements in each corresponding set of one-level bitmap, for example have regularly repeating set, for example gather C={1,1,2,2,3,3 ... N, N, N+1, N+1}.Set C just can make each corresponding two of gathering of one-level bitmap in this case.Simultaneously, the embodiment of the invention does not limit the set number of one-level bitmap correspondence yet; An one-level bitmap can corresponding one or more set.For example, when a plurality of set are identical, can be with the corresponding a plurality of set of an one-level bitmap.Certainly this just illustrates, and also can make a plurality of positions in the corresponding set of an one-level bitmap in other cases, the corresponding a plurality of set of one-level bitmap, and the embodiment of the invention is not as limit.
Step 202, the secondary bitmap is set, two positions or two position sections of the described one-level bitmap of each correspondence of described secondary bitmap with upper formation, when the position of institute's rheme section be when sky all, be designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described secondary bitmap; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described secondary bitmap was a non-NULL.
In above-mentioned step 202, whether the position that can adopt 0 and 1 the method for being designated in the step 201 to identify the secondary bitmap equally is empty.Certainly employing 0 and 1 just is used to indicate a kind of mode of secondary bitmap and one-level bitmap corresponding relation in the above-mentioned step 202, can also adopt other modes to indicate, the embodiment of the invention is not as limit.Simultaneously, in the embodiment of the invention, the length of the position section of the one-level bitmap that each of secondary bitmap is corresponding is identical, or the length of the position section of each corresponding one-level bitmap of described secondary bitmap is inequality.
The instantiation of the secondary bitmap that is an one-level bitmap and correspondence as described in Figure 9.Wherein, an element in the corresponding set of each of one-level bitmap; When this element in the set existed, then the bit-identify with this one-level bitmap was 1; When this element in the set did not exist, then the bit-identify with this one-level bitmap was 0.As shown in Figure 9, wherein lower frame is an one-level bitmap, the expression set 0,5,24,29,40,43,47,58,61,63}.Wherein, this one-level bitmap from right to left, element of each corresponding set.Because first element 0 of set exists, so the rightest value of one-level bitmap is 1.1,2,3,4 these three elements do not exist, thus the one-level bitmap begin by the right second, third, the 4th, the 5th value be 0.5 exist in the set, and therefore the 6th value that is begun by the right is 1, once analogizes.
Can see that the position of partial continuous (bit) is 0, form very big evacuated space.In order to save the space, set up the secondary bitmap shown in Fig. 3 upper ledge, 8 positions (bit) in each of secondary bitmap (bit) expression one-level bitmap.When 8 positions of one-level bitmap all were 0, the corresponding positions of secondary bitmap also was changed to 0.Space availability ratio rises to 10/ (8 * 5)=25% by original 10/ (8 * 8)=15.6%.In the actual items, the sparse degree of set is very high mostly, and according to this compression method, space availability ratio will effectively be promoted.
Because the embodiment of the invention can comprise multistage bitmap, therefore can after step 202, also comprise:
Step 203, three grades of bitmaps are set, two positions or two position sections of the described secondary bitmap of each correspondence of described three grades of bitmaps with upper formation, when the position of institute's rheme section be when sky all, be designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described three grades of bitmaps; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described three grades of bitmaps was a non-NULL.
Can also comprise level Four bitmap, Pyatyi bitmap are set ... step, do not give unnecessary details one by one at this.
The embodiment of the invention has proposed concrete grammar that one-level bitmap and secondary bitmap are identified, can identify corresponding element or whether the position section is sky in simple mode.Simultaneously, also proposed the construction method of multistage bitmap, can carry out multistage bitmap than higher set for complexity and make up, with the shared space of further attenuating storage.
Embodiment 3
Third embodiment of the invention has proposed a kind of construction device of bitmap, and its structure comprises as shown in Figure 3:
The one-level bitmap is provided with module 1, is used to be provided with the one-level bitmap, and whether the one or more element of the corresponding set in the non-room of each of described one-level bitmap has in the described set and described non-room elements corresponding to identify;
The secondary bitmap is provided with module 2, is used to be provided with each of secondary bitmap and two positions or two corresponding relations with the position section of upper formation of described one-level bitmap; When the position of institute's rheme section be when sky all, be designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described secondary bitmap; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described secondary bitmap was a non-NULL.
The embodiment of the invention increases the secondary bitmap, and makes at least two of each corresponding one-level bitmap of secondary bitmap.So just the one-level bitmap can be carried out segmentation, and will all be empty section deletion in the one-level bitmap, and corresponding bit-identify comes out in the secondary bitmap.Can represent a plurality of positions of one-level bitmap by of secondary bitmap, to save storage space for sparse set like this.Certainly, can also set up three grades of bitmaps, level Four bitmap as required, the embodiment of the invention is not as limit.These kinds mode has all comprised the secondary bitmap at least, therefore should be within protection domain of the present invention.Simultaneously, the embodiment of the invention does not limit the set number of one-level bitmap correspondence yet; An one-level bitmap can corresponding one or more set.
Embodiment 4
Fourth embodiment of the invention has proposed a kind of construction device of bitmap, and its structure comprises as shown in Figure 4:
The one-level bitmap is provided with module 1, and the one-level bitmap is set, and whether the one or more element of the corresponding set in the non-room of each of described one-level bitmap has in the described set and described non-room elements corresponding to identify;
Wherein the one-level bitmap is provided with module 1 and comprises:
First corresponding unit 11 is used to be provided with each of one-level bitmap and an element of gathering or the corresponding relation of an above element;
The first corresponding position is provided with unit 12, is used to be provided with each of described one-level bitmap; When the element in the corresponding set in the position in the described one-level bitmap was sky, the corresponding position that then identifies described one-level bitmap was 0; When the element in the corresponding set in the position in the described one-level bitmap all was not sky, the corresponding position that then identifies described one-level bitmap was 1.
The secondary bitmap is provided with module 2, is used to be provided with each of secondary bitmap and two positions or two corresponding relations with the position section of upper formation of described one-level bitmap; When the position of institute's rheme section when being 0 all, be designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described secondary bitmap; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described secondary bitmap was a non-NULL.
Be provided with in the module 2 at above-mentioned secondary bitmap, can adopt the one-level bitmap to be provided with whether the position that 0 and 1 the method for being designated in the module 1 identifies the secondary bitmap is empty equally.Certainly above-mentioned one-level bitmap is provided with a kind of mode that employing 0 and 1 just is used to indicate secondary bitmap and one-level bitmap corresponding relation in the module 1, can also adopt other modes to indicate, the embodiment of the invention is not as limit.The secondary bitmap is provided with in the module 2, and the length of the position section of the one-level bitmap that each of described secondary bitmap is corresponding is identical, or the length of the position section of each corresponding one-level bitmap of described secondary bitmap is inequality.
Because the embodiment of the invention can comprise multistage bitmap, but therefore the embodiment of the invention can also comprise:
Three grades of bitmaps are provided with module, are used to be provided with each of three grades of bitmaps and two positions or two corresponding relations with the position section of upper formation of described secondary bitmap; When the position of institute's rheme section be when sky all, be designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described three grades of bitmaps; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described three grades of bitmaps was a non-NULL.
Certainly, can also comprise and be provided with that the level Four bitmap is provided with module, the Pyatyi bitmap is provided with module ..., do not give unnecessary details one by one at this.
The embodiment of the invention has proposed concrete grammar that one-level bitmap and secondary bitmap are identified, can identify corresponding element or whether the position section is sky in simple mode.Simultaneously, also proposed the construction method of multistage bitmap, can carry out multistage bitmap than higher set for complexity and make up, with the shared space of further attenuating storage.
Embodiment 5
Fifth embodiment of the invention has proposed a kind of method of asking friendship, and its flow process comprises as shown in Figure 5:
Step 301, the one-level bitmap is set, whether the one or more element of the corresponding set in the non-room of each of described one-level bitmap has in the described set and described non-room elements corresponding to identify;
Step 302, the secondary bitmap is set, two positions or two position sections of the described one-level bitmap of each correspondence of described secondary bitmap with upper formation, when the position of institute's rheme section be when sky all, be designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described secondary bitmap; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described secondary bitmap was a non-NULL;
Step 303, when two or more set being asked when handing over, earlier the corresponding secondary bitmap bits of described each set is asked friendship, to calculate the position that is non-NULL in the corresponding position in all secondary bitmaps;
Step 304, according to the corresponding position that is non-NULL of described secondary bitmap, obtain the position section of one-level bitmap of each set of each correspondence, and respectively the position section of all set of each correspondence asked friendship, calculate the intersection of sets collection.
The embodiment of the invention increases the secondary bitmap, and makes at least two of each corresponding one-level bitmap of secondary bitmap.So just the one-level bitmap can be carried out segmentation, and will all be empty section deletion in the one-level bitmap, and corresponding bit-identify comes out in the secondary bitmap.Can represent a plurality of positions of one-level bitmap by of secondary bitmap, to save storage space for sparse set like this.Certainly, can also set up three grades of bitmaps, level Four bitmap as required ..., the embodiment of the invention is not as limit.These kinds mode has all comprised the secondary bitmap at least, therefore should be within protection domain of the present invention.When two or more set being asked friendship, step-by-step and operation will be carried out earlier in the secondary bitmap, to find out the position of the secondary bitmap that is non-NULL simultaneously.Have only when two or more secondary bitmaps same to correspond to when all being non-NULL, then the position of the one-level bitmap of these correspondences is asked friendship again, can calculate two or more intersection of sets collection like this.The method of asking friendship of the embodiment of the invention, the existing Bitmap that compares asks the friendship method can save storage space, can reduce operand simultaneously when the step-by-step of asking friendship and operation.
Embodiment 6
Sixth embodiment of the invention has proposed a kind of method of asking friendship, and its flow process comprises as shown in Figure 6:
Step 401, the one-level bitmap is set, whether the one or more element of the corresponding set in the non-room of each of described one-level bitmap has in the described set and described non-room elements corresponding to identify.
In above-mentioned step 401, be with the corresponding set of an one-level bitmap (Bitmap) in the prior art, and an element of each corresponding set of one-level bitmap.When an element in the set was sky, the position of corresponding one-level bitmap was 0.When an element in set was non-NULL, the position of corresponding one-level bitmap was 1.Certainly adopt this mode in the embodiment of the invention, can certainly adopt in will gathering to the position in the corresponding one-level bitmap in empty position is 1, and be that the position of non-NULL is 0, the embodiment of the invention is not as limit.Simultaneously, do not limit the number of elements of the corresponding set in a position of one-level bitmap in the embodiment of the invention, the position of one-level bitmap can corresponding a plurality of elements.Simultaneously, the embodiment of the invention does not limit the set number of one-level bitmap correspondence yet; An one-level bitmap can corresponding one or more set.
Step 402, the secondary bitmap is set, two positions or two position sections of the described one-level bitmap of each correspondence of described secondary bitmap with upper formation, when the position of institute's rheme section be when sky all, be designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described secondary bitmap; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described secondary bitmap was a non-NULL.
In above-mentioned step 402, whether the position that can adopt 0 and 1 the method for being designated in the step 401 to identify the secondary bitmap equally is empty.Certainly employing 0 and 1 just is used to indicate a kind of mode of secondary bitmap and one-level bitmap corresponding relation in the above-mentioned step 402, can also adopt other modes to indicate, the embodiment of the invention is not as limit.In above-mentioned step 402, the length of the position section of the one-level bitmap that each of described secondary bitmap is corresponding is identical, or the length of the position section of each corresponding one-level bitmap of described secondary bitmap is inequality.
Step 403, when two or more set being asked when handing over, earlier the corresponding secondary bitmap bits of described each set is asked friendship, to calculate the position that is non-NULL in the corresponding position in all secondary bitmaps.
In step 403, ask friendship method can for as " step-by-step with " of the prior art computing, can calculate the position that is non-NULL in the corresponding positions of secondary bitmap of two or more set simultaneously.If this is that then the position section of a plurality of one-level bitmaps of this correspondence of these a plurality of secondary bitmaps must be non-common factor because of the secondary bitmap of a set correspondence is sky.Have only when the corresponding positions of a plurality of secondary bitmaps is not 0, friendship just need be asked again in the position of the one-level bitmap that it is pairing, to calculate whether common factor is arranged.Certainly step 403 can also calculate by other modes and be the corresponding position of non-NULL simultaneously, and the present invention is not as limit.
Step 404, according to the corresponding position that is non-NULL of described secondary bitmap, obtain the position section of one-level bitmap of each set of each correspondence, and respectively the position section of all set of each correspondence asked friendship, calculate the intersection of sets collection.
Can adopt " step-by-step with " computing of prior art in step 404, calculate common factor, step 404 can also calculate by other modes and be the position of non-NULL simultaneously certainly, and the present invention is not as limit.
Step 405, to reducing calculating in this position, promptly the secondary bitmap of this corresponding element value=affiliated sequence number * sub-bitmap lengths+this is positioned at the side-play amount of secondary bitmap.
In step 405, each corresponding one-level bitmap bits of sequence number * secondary bitmap of the secondary bitmap of this corresponding element value=affiliated length+this is positioned at the side-play amount of secondary bitmap.Wherein the sequence number of secondary bitmap is the integer of 0~n for value from right to left, i.e. secondary bitmap as shown in Figure 9, and the primary sequence number that begins from the right is that 0, second value is that 1, the 3rd value is 2 ... by that analogy.And the length of each corresponding one-level bitmap bits of secondary bitmap is illustrated in figure 9 as 8, i.e. the position of each corresponding 8 one-level bitmap of secondary bitmap.This is positioned at the side-play amount of secondary bitmap, promptly this be positioned at secondary bitmap correspondence the one-level bitmap the position sequence number; This sequence number is that value is the integer of 0~n from right to left.As shown in Figure 9, wherein be designated this position 1., sequence number=5 of affiliated secondary bitmap, length=8 of each corresponding one-level bitmap bits of secondary bitmap, this is positioned at side-play amount=3 of secondary bitmap; Therefore the value of this position is 5 * 8+3=43.
Because the embodiment of the invention can comprise multistage bitmap, therefore can between step 402 and 403, also comprise:
Three grades of bitmaps are set, two positions or two position sections of the described secondary bitmap of each correspondence of described three grades of bitmaps with upper formation, when the position of institute's rheme section be when sky all, be designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described three grades of bitmaps; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described three grades of bitmaps was a non-NULL.
Can also comprise level Four bitmap, Pyatyi bitmap are set ... step, do not give unnecessary details one by one at this.
When asking friendship for two or more set with multistage bitmap, the bitmap progression situation inequality that may occur gathering, so the embodiment of the invention can also comprise before step 403:
The bitmap progression of step a, more described set, and get progression minimum for benchmark progression.
Step b, the set that described bitmap progression is higher than benchmark progression reduce SERIES CALCULATION, so that the bitmap progression that should gather is identical with benchmark progression.And the mode that reduces progression is the backstepping of above-mentioned steps 401~402, does not repeat them here.
Step c, begin to ask friendship, until to the one-level bitmap, to calculate described a plurality of intersection of sets collection by the bitmap of highest number.And the friendship mode of asking of bitmap can not repeat them here for the identical mode of above-mentioned steps 403~405.
The embodiment of the invention has proposed concrete grammar that one-level bitmap and secondary bitmap are identified, can identify corresponding element or whether the position section is sky in simple mode.Simultaneously, also proposed the construction method of multistage bitmap, can carry out multistage bitmap than higher set for complexity and make up, with the shared space of further attenuating storage.And, just might appear at the different situation of progression of asking set when handing over for the mode that has adopted multistage bitmap.The embodiment of the invention has proposed the mode that multistage bitmap is demoted, so that bitmap progression mates mutually when calculating, and begins to ask step by step friendship by senior bitmap.Can improve the availability of the embodiment of the invention like this, make it be applicable to multiple environment.
Embodiment 7
Seventh embodiment of the invention has proposed a kind of device of asking friendship, and its structure comprises as shown in Figure 7:
The one-level bitmap is provided with module 1, is used to be provided with the one-level bitmap, and whether the one or more element of the corresponding set in the non-room of each of described one-level bitmap has in the described set and described non-room elements corresponding to identify;
The secondary bitmap is provided with module 2, be used to be provided with two positions of each and described one-level bitmap of secondary bitmap or two with upper corresponding relation, when whole positions of the one-level bitmap of a correspondence of described secondary bitmap all be sky, be designated sky then with whole deletions of the one-level bitmap of institute's rheme correspondence of described secondary bitmap, and with the corresponding positions of described secondary bitmap; When the position of a pairing one-level bitmap of described secondary bitmap not all be sky, the corresponding positions that identifies described secondary bitmap was a non-NULL;
The secondary bitmap is asked and is handed over module 3, be used for earlier the corresponding secondary bitmap bits of described each set being asked friendship when two or more set being asked when handing over, with calculate in all secondary bitmaps in the corresponding position be non-NULL;
The one-level bitmap is asked and is handed over module 4, the position that is non-NULL in the corresponding position of secondary bitmap that is used for asking the friendship module to obtain according to described secondary bitmap, obtain the position section of one-level bitmap of each set of each correspondence, and respectively the position section of all set of each correspondence is asked friendship, calculate the intersection of sets collection.
The embodiment of the invention increases the secondary bitmap, and makes at least two of each corresponding one-level bitmap of secondary bitmap.So just the one-level bitmap can be carried out segmentation, and will all be empty section deletion in the one-level bitmap, and corresponding bit-identify comes out in the secondary bitmap.Can represent a plurality of positions of one-level bitmap by of secondary bitmap, to save storage space for sparse set like this.Certainly, can also set up three grades of bitmaps, level Four bitmap as required ..., the embodiment of the invention is not as limit.These kinds mode has all comprised the secondary bitmap at least, therefore should be within protection domain of the present invention.When two or more set being asked friendship, step-by-step and operation will be carried out earlier in the secondary bitmap, to find out the position of the secondary bitmap that is non-NULL simultaneously.Have only when two or more secondary bitmaps same to correspond to when all being non-NULL, then the position of the one-level bitmap of these correspondences is asked friendship again, can calculate two or more intersection of sets collection like this.The method of asking friendship of the embodiment of the invention, the existing Bitmap that compares asks the friendship method can save storage space, can reduce operand simultaneously when the step-by-step of asking friendship and operation.
Embodiment 8
Eighth embodiment of the invention has proposed a kind of device of asking friendship, and its structure comprises as shown in Figure 8:
The one-level bitmap is provided with module 1, is used to be provided with the one-level bitmap, and whether the one or more element of the corresponding set in the non-room of each of described one-level bitmap has in the described set and described non-room elements corresponding to identify;
Wherein the one-level bitmap is provided with module 1 and comprises:
First corresponding unit 11 is used to be provided with each of one-level bitmap and an element of gathering or the corresponding relation of an above element;
The first corresponding position is provided with unit 12, is used to be provided with each of described one-level bitmap; When the element in the corresponding set in the position in the described one-level bitmap was sky, the corresponding position that then identifies described one-level bitmap was 0; When the element in the corresponding set in the position in the described one-level bitmap all was not 0, the corresponding position that then identifies described one-level bitmap was 1.
The secondary bitmap is provided with module 2, be used to be provided with two positions of each and described one-level bitmap of secondary bitmap or two with upper corresponding relation, when whole positions of the one-level bitmap of a correspondence of described secondary bitmap all are 0, be designated 0 then with whole deletions of the one-level bitmap of institute's rheme correspondence of described secondary bitmap, and with the corresponding positions of described secondary bitmap; When the position of the pairing one-level bitmap of described secondary bitmap not all was 0, the corresponding positions that identifies described secondary bitmap was 1.The secondary bitmap is provided with in the module 2, and the length of the position section of the one-level bitmap that each of described secondary bitmap is corresponding is identical, or the length of the position section of each corresponding one-level bitmap of described secondary bitmap is inequality.
The secondary bitmap is asked and is handed over module 3, be used for earlier the corresponding secondary bitmap bits of described each set being asked friendship when two or more set being asked when handing over, with calculate in all secondary bitmaps in the corresponding position be non-NULL.
Wherein the secondary bitmap ask hand over module 3 the method for asking friendship can for as " step-by-step with " of the prior art computing, can calculate the position that is non-NULL in the corresponding positions of secondary bitmap of two or more set simultaneously.If this is that then the position section of a plurality of one-level bitmaps of this correspondence of these a plurality of secondary bitmaps must be non-common factor because of the secondary bitmap of a set correspondence is sky.Have only when the corresponding positions of a plurality of secondary bitmaps is not 0, friendship just need be asked again in the position of the one-level bitmap that it is pairing, to calculate whether common factor is arranged.Certainly step 403 can also calculate by other modes and be the corresponding position of non-NULL simultaneously, and the present invention is not as limit.
The one-level bitmap is asked and is handed over module 4, the position that is non-NULL in the corresponding position of secondary bitmap that is used for asking the friendship module to obtain according to described secondary bitmap, obtain the position section of one-level bitmap of each set of each correspondence, and respectively the position section of all set of each correspondence is asked friendship, calculate the intersection of sets collection.
The one-level bitmap asks the friendship method to calculate common factor for " step-by-step with " computing of prior art, and the one-level bitmap is asked and handed over module 4 to calculate by other modes to be the position of non-NULL simultaneously certainly, and the present invention is not as limit.
Wherein the one-level bitmap is asked and is handed over module 4 to comprise:
Step-by-step and operating unit 41 are used for calculating one-level bitmap corresponding positions and carry out step-by-step and operation, are the position of non-NULL simultaneously in the corresponding positions to calculate in the one-level bitmap;
Element value computing unit 42 is used for the position to step-by-step and operating unit 41 gained, reduces calculating, calculates this element value; Each corresponding one-level bitmap bits of sequence number * secondary bitmap of the secondary bitmap of this corresponding element value=affiliated length+this is positioned at the side-play amount of secondary bitmap.Wherein the sequence number of secondary bitmap is the integer of 0~n for value from right to left, i.e. secondary bitmap as shown in Figure 9, and the primary sequence number that begins from the right is that 0, second value is that 1, the 3rd value is 2 ... by that analogy.And the length of each corresponding one-level bitmap bits of secondary bitmap is illustrated in figure 9 as 8, i.e. the position of each corresponding 8 one-level bitmap of secondary bitmap.This is positioned at the side-play amount of secondary bitmap, promptly this be positioned at secondary bitmap correspondence the one-level bitmap the position sequence number; This sequence number is that value is the integer of 0~n from right to left.As shown in Figure 9, wherein be designated this position 1., sequence number=5 of affiliated secondary bitmap, length=8 of each corresponding one-level bitmap bits of secondary bitmap, this is positioned at side-play amount=3 of secondary bitmap; Therefore the value of this position is 5 * 8+3=43.
Because the embodiment of the invention can comprise multistage bitmap, but therefore the embodiment of the invention can also comprise:
Three grades of bitmaps are provided with module, are used to be provided with each of three grades of bitmaps and two positions or two corresponding relations with the position section of upper formation of described secondary bitmap; When the position of institute's rheme section be when sky all, be designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described three grades of bitmaps; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described three grades of bitmaps was a non-NULL.
Certainly, can also comprise and be provided with that the level Four bitmap is provided with module, the Pyatyi bitmap is provided with module ..., do not give unnecessary details one by one at this.
When asking friendship for two or more set with multistage bitmap, the bitmap progression situation inequality that may occur gathering, so the embodiment of the invention can also comprise:
Bitmap progression comparison module is used for the bitmap progression of more described set, and get progression minimum for benchmark progression;
Reduce the SERIES CALCULATION module, be used for the set that described bitmap progression is higher than benchmark progression is reduced SERIES CALCULATION, so that the bitmap progression that should gather is identical with benchmark progression.And the mode that reduces progression is above-mentioned one-level bitmap the backstepping that module 1 and secondary bitmap are provided with module 2 is set, and does not repeat them here.
Ask the friendship module, be used for beginning to ask friendship, until arriving the one-level bitmap, to calculate described a plurality of intersection of sets collection by the bitmap of highest number.And bitmap ask the friendship mode to ask to hand over module and one-level bitmap to ask to hand over the identical mode of module, do not repeat them here for above-mentioned secondary bitmap.
The embodiment of the invention has proposed concrete grammar that one-level bitmap and secondary bitmap are identified, can identify corresponding element or whether the position section is sky in simple mode.Simultaneously, also proposed the construction method of multistage bitmap, can carry out multistage bitmap than higher set for complexity and make up, with the shared space of further attenuating storage.And, just might appear at the different situation of progression of asking set when handing over for the mode that has adopted multistage bitmap.The embodiment of the invention has proposed the mode that multistage bitmap is demoted, so that bitmap progression mates mutually when calculating, and begins to ask step by step friendship by senior bitmap.Can improve the availability of the embodiment of the invention like this, make it be applicable to multiple environment.
In above-mentioned each embodiment of the present invention, be not limited only to have only one-level bitmap and secondary bitmap.Those skilled in that art are appreciated that three grades of bitmaps, level Four bitmap can also be set as required ..., the embodiment of the invention is not as limit.And these kinds mode has all comprised the secondary bitmap at least, therefore should be within protection domain of the present invention.And ask when handing over for multistage bitmap, should ask friendship one by one from five-star bitmap, its account form is identical with the account form of the above embodiment of the present invention.And ask the mode of friendship greater than the multistage bitmap of two-stage for any number of stages, and all must carry out the friendship of asking of secondary bitmap and one-level bitmap, therefore should be within protection domain of the present invention.Ask in the set of friendship and work as, when the progression of the bitmap that each set is corresponding is inequality, then should be with minimum being as the criterion of progression.The set that progression is more can be reduced to progression identically with the less set of progression in advance, and then asks friendship one by one by five-star bitmap.
Hand in the method and apparatus of the present invention asking, can once ask friendship to two set, also can once ask friendship to a plurality of set, its computing method are identical, do not repeat them here.
With a concrete example the above embodiment of the present invention is described further below:
As shown in Figure 9, wherein lower frame is an one-level bitmap, and { 0,5,24,29,40,43,47,58,61,63} is because maximum element is 63, so need 63 bit (8 bytes) to describe this grade bitmap in the expression set.Can see that the position of partial continuous (bit) is 0, form very big evacuated space.In order to save the space, set up the secondary bitmap shown in Fig. 3 upper ledge, 8 positions (bit) in each of secondary bitmap (bit) expression one-level bitmap.When 8 positions of one-level bitmap all were 0, the corresponding positions of secondary bitmap also was changed to 0.Space availability ratio rises to 10/ (8 * 5)=25% by original 10/ (8 * 8)=15.6%.In the actual items, the sparse degree of set is very high mostly, and according to this compression method, space availability ratio will effectively be promoted.
Bitmap can carry out retrieving algorithm with the one-level bitmap by retrieving algorithm, that is: after overcompression
The set element that each bit represents=affiliated secondary bitmap number * sub-bitmap lengths+side-play amount of this basis in the secondary bitmap.As 1. this position of being designated among Fig. 9, all be when position of 0 when having deleted, it is positioned at the 19th bit (the corresponding decimal system 19), but in fact should be 5 * 8+3=43 in the one-level bitmap.
Asking when handing over to be integrated into as Figure 10 and as shown in figure 11 two, can be as follows:
Computing is to carry out when the mode of as shown in Figure 9 employing one-level bitmap and secondary bitmap.
As shown in Figure 10 and Figure 11, be provided with two set A=0,5,24,29,40,43,47,58,61,63}, B={8,9,13,25,29,35,36,40,46,47}.After set A and B compress through bitmap, the two-stage bitmap is arranged respectively.As shown in figure 10, earlier set A is generated one-level bitmap and secondary bitmap; Then as shown in figure 11, set B generates one-level bitmap and secondary bitmap.
As shown in figure 12, the secondary bitmap of set A and set B being carried out step-by-step and operation, is the position of non-NULL (1) when obtaining two secondary bitmaps, promptly as shown in figure 12 0010100.Value is carried out step-by-step and operation again for the position of the corresponding one-level bitmap in the position of non-NULL (1) simultaneously, promptly as shown in figure 13, be respectively 10001001﹠amp; 11000001=10000001,00100001﹠amp; 00100010=00100000.By above-mentioned retrieving algorithm, be respectively 5*8+0,5*8+7,3*8+5 so again, promptly occur simultaneously for 40,47,29}.
For the situation of a plurality of set, algorithm is identical because two elements with computing and a plurality of elements with computing be the same.
For the situation of multistage bitmap, algorithm also is identical, promptly begins by progressive line operate from the identical superlative degree of a plurality of set respectively.If the progression difference of the set in calculating, then the Bitmap from both identical highest levels begins downward computing.Suppose that A has 3 grades of Bitmap, and B has only 2 grades, then from the second level, ignores the third level of A, but need elder generation that the secondary bitmap of A is restored.
The cap of multistage Bitmap and one-level Bitmap are faster, because computing is from senior Bitmap, and senior Bitmap is abstract to rudimentary Bitmap, senior more bitmap, its volume is more little, its cap can be got over convergence fast, can calculate the computing interval of rudimentary Bitmap through very a spot of calculating.With one-level Bitmap is example, suppose that A, B directly represent with one-level Bitmap, take out a byte at every turn and do and computing, then need 8 computings altogether, if use two-stage Bitmap, then only need second level Bitmap do 1 time with+lowermost level Bitmap do 2 times with=have 3 times and computing altogether.
The figure place of the corresponding rudimentary bitmap of senior bitmap is a unit with 8bit, 32bit, 64bit generally, particularly with 32 or 64bit be unit, respectively corresponding 32,64 systems just equal the width of data bus, can improve arithmetic speed greatly.During actual the use, can also adjust according to the concrete distribution of data.More flexibly, the bit array of multiple length can be used altogether.
By the foregoing description as can be seen, the embodiment of the invention increases the secondary bitmap, and makes at least two of each corresponding one-level bitmap of secondary bitmap.So just the one-level bitmap can be carried out segmentation, and will all be empty section deletion in the one-level bitmap, and corresponding bit-identify comes out in the secondary bitmap.Can represent a plurality of positions of one-level bitmap by of secondary bitmap, to save storage space for sparse set like this.Certainly, can also set up three grades of bitmaps, level Four bitmap as required ..., the embodiment of the invention is not as limit.These kinds mode has all comprised the secondary bitmap at least, therefore should be within protection domain of the present invention.When two or more set being asked friendship, step-by-step and operation will be carried out earlier in the secondary bitmap, to find out the position of the secondary bitmap that is not sky simultaneously.Have only when two or more secondary bitmaps same to correspond to when all being non-NULL, then the position of the one-level bitmap of these correspondences is asked friendship again, can calculate two or more intersection of sets collection like this.The device of asking friendship of the embodiment of the invention, the existing Bitmap that compares asks the friendship method can save storage space, can reduce operand simultaneously when the step-by-step of asking friendship and operation.Simultaneously in the embodiment of the invention, the figure place of the one-level bitmap of secondary bitmap correspondence can be selected as required, and the not coordination in the same secondary bitmap can corresponding different one-level bitmap figure places, to improve dirigibility.Simultaneously, the embodiment of the invention has also proposed the method when friendship is asked in different set with bitmap of different progression, promptly be as the criterion by the less set of progression, the set that progression is more is reduced to progression with the less set of progression and calculates after identical again, to improve the applicability of the embodiment of the invention.
All or part of content in the technical scheme that above embodiment provides can realize that its software program is stored in the storage medium that can read by software programming, storage medium for example: the hard disk in the computing machine, CD or floppy disk.
Below only be preferred embodiment of the present invention, or not within the spirit and principles in the present invention not all in order to restriction the present invention, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (14)

1. the construction method of a bitmap is characterized in that, comprising:
The one-level bitmap is set, and whether the one or more element of the corresponding set in the non-room of each of described one-level bitmap has in the described set and described non-room elements corresponding to identify;
The secondary bitmap is set, two positions or two position sections of the described one-level bitmap of each correspondence of described secondary bitmap with upper formation, when the position of institute's rheme section be when sky all, be designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described secondary bitmap; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described secondary bitmap was a non-NULL.
2. the construction method of bitmap according to claim 1, it is characterized in that, in the described method, the length of the position section of the one-level bitmap that each of described secondary bitmap is corresponding is identical, or the length of the position section of each corresponding one-level bitmap of described secondary bitmap is inequality.
3. the construction method of bitmap according to claim 1 is characterized in that, described method also comprises:
N level bitmap is set, two positions or two position sections of the described previous stage bitmap of each correspondence of each grade bitmap in the described n level bitmap with upper formation, when the position of institute's rheme section be when sky all, be designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described n level bitmap; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described n level bitmap was a non-NULL; Wherein, n is more than or equal to 3.
4. the construction device of a bitmap is characterized in that, comprising:
Whether the one-level bitmap is provided with module, is used to be provided with the corresponding one or more element of gathering in each non-room of one-level bitmap, have in the described set and described non-room elements corresponding to identify;
The secondary bitmap is provided with module, is used to be provided with each of secondary bitmap and two positions or two corresponding relations with the position section of upper formation of described one-level bitmap; When the position of institute's rheme section be when sky all, be designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described secondary bitmap; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described secondary bitmap was a non-NULL.
5. the construction device of bitmap according to claim 4, it is characterized in that, described secondary bitmap is provided with in the module, and the length of the position section of the one-level bitmap that each of described secondary bitmap is corresponding is identical, or the length of the position section of each corresponding one-level bitmap of described secondary bitmap is inequality.
6. the construction device of bitmap according to claim 4 is characterized in that, described device also comprises:
Senior bitmap is provided with module, be used to be provided with n level bitmap, two positions or two position sections of the described previous stage bitmap of each correspondence of each grade bitmap in the described n level bitmap with upper formation, when the position of institute's rheme section is sky all, be designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described n level bitmap; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described n level bitmap was a non-NULL; Wherein, n is more than or equal to 3.
7. a method of asking friendship is characterized in that, comprising:
The one-level bitmap is set, and whether the one or more element of the corresponding set in the non-room of each of described one-level bitmap has in the described set and described non-room elements corresponding to identify;
The secondary bitmap is set, two positions or two position sections of the described one-level bitmap of each correspondence of described secondary bitmap with upper formation, when the position of institute's rheme section be when sky all, be designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described secondary bitmap; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described secondary bitmap was a non-NULL;
When two or more set being asked when handing over, earlier the corresponding secondary bitmap bits of described each set is asked friendship, to calculate the position that is non-NULL in the corresponding position in all secondary bitmaps;
According to the corresponding position that is non-NULL of described secondary bitmap, obtain the position section of one-level bitmap of each set of each correspondence, and respectively the position section of all set of each correspondence is asked friendship, calculate the intersection of sets collection.
8. the method for asking friendship according to claim 7, it is characterized in that, in the described method, the length of the position section of the one-level bitmap that each of described secondary bitmap is corresponding is identical, or the length of the position section of each corresponding one-level bitmap of described secondary bitmap is inequality.
9. according to claim 7 or the 8 described methods of asking friendship, it is characterized in that described secondary bitmap bits to described each set correspondence is asked friendship, the position that is non-NULL in the corresponding position comprises in all secondary bitmaps to calculate:
Obtaining the corresponding secondary bitmap of each set, and all secondary bitmaps are carried out step-by-step and operation, is the corresponding positions of non-NULL to calculate described all secondary bitmaps simultaneously.
10. according to claim 7 or the 8 described methods of asking friendship, it is characterized in that, described described all sections asked friendship, calculate the intersection of sets collection and comprise:
Corresponding positions in all sections is carried out step-by-step and operation, is the position of non-NULL in the corresponding positions to calculate in the one-level bitmap simultaneously;
Described one-level bitmap is reduced calculating for the position of non-NULL simultaneously, calculate this element value; Each corresponding one-level bitmap bits of sequence number * secondary bitmap of the secondary bitmap of this corresponding element value=affiliated length+this is positioned at the side-play amount of secondary bitmap.
11. a device of asking friendship is characterized in that, comprising:
Whether the one-level bitmap is provided with module, is used to be provided with the corresponding one or more element of gathering in each non-room of one-level bitmap, have in the described set and described non-room elements corresponding to identify;
Two positions of the described one-level bitmap of each correspondence of described secondary bitmap or two position sections with upper formation when the position of institute's rheme section be sky all, are designated sky then with whole deletions of institute's rheme section, and with the corresponding positions of described secondary bitmap; When the position of institute's rheme section all was not sky, the corresponding positions that then identifies described secondary bitmap was a non-NULL;
The secondary bitmap is asked the friendship module, is used for earlier the corresponding secondary bitmap bits of described each set being asked friendship, to calculate the position that is non-NULL in the corresponding position in all secondary bitmaps when two or more set being asked when handing over;
The one-level bitmap is asked the friendship module, the position that is non-NULL in the corresponding position of secondary bitmap that is used for asking the friendship module to obtain according to described secondary bitmap, obtain the position section of one-level bitmap of each set of each correspondence, and respectively the position section of all set of each correspondence is asked friendship, calculate the intersection of sets collection.
12. the device of asking friendship according to claim 11, it is characterized in that, described secondary bitmap is provided with in the module, and the length of the position section of the one-level bitmap that each of described secondary bitmap is corresponding is identical, or the length of the position section of each corresponding one-level bitmap of described secondary bitmap is inequality.
13. according to claim 11 or the 12 described devices of asking friendship, it is characterized in that, described secondary bitmap is asked and is handed over module to be used to obtain the corresponding secondary bitmap of each set, and all secondary bitmaps are carried out step-by-step and operation, is the corresponding positions of non-NULL simultaneously to calculate described all secondary bitmaps.
14., it is characterized in that described one-level bitmap is asked and handed over module to comprise according to claim 11 or the 12 described devices of asking friendship:
Step-by-step and operating unit are used for calculating one-level bitmap corresponding positions and carry out step-by-step and operation, are the position of non-NULL simultaneously in the corresponding positions to calculate in the one-level bitmap;
The element value computing unit is used for described one-level bitmap is reduced calculating for the position of non-NULL simultaneously, calculates this element value; Each corresponding one-level bitmap bits of sequence number * secondary bitmap of the secondary bitmap of this corresponding element value=affiliated length+this is positioned at the side-play amount of secondary bitmap.
CN 201010141779 2010-04-06 2010-04-06 Bitmap constructing method and device, intersection method and intersection device Active CN102214360B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201010141779 CN102214360B (en) 2010-04-06 2010-04-06 Bitmap constructing method and device, intersection method and intersection device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201010141779 CN102214360B (en) 2010-04-06 2010-04-06 Bitmap constructing method and device, intersection method and intersection device

Publications (2)

Publication Number Publication Date
CN102214360A true CN102214360A (en) 2011-10-12
CN102214360B CN102214360B (en) 2013-07-17

Family

ID=44745655

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201010141779 Active CN102214360B (en) 2010-04-06 2010-04-06 Bitmap constructing method and device, intersection method and intersection device

Country Status (1)

Country Link
CN (1) CN102214360B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104899204A (en) * 2014-03-05 2015-09-09 腾讯科技(深圳)有限公司 Data storage method and device
CN108256054A (en) * 2018-01-15 2018-07-06 腾讯科技(深圳)有限公司 The method and apparatus for determining destination number set
CN109522239A (en) * 2018-09-30 2019-03-26 上海恺英网络科技有限公司 A kind of method and apparatus that common trait data determine
CN109656949A (en) * 2018-11-15 2019-04-19 金蝶软件(中国)有限公司 Indexed search method, apparatus, computer equipment and the storage medium of bitmap
WO2022037015A1 (en) * 2020-08-21 2022-02-24 苏州浪潮智能科技有限公司 Column-based storage method, apparatus and device based on persistent memory

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030154189A1 (en) * 1999-12-30 2003-08-14 Decode Genetics, Ehf. Indexing, rewriting and efficient querying of relations referencing spatial objects
US20040249782A1 (en) * 2003-06-04 2004-12-09 International Business Machines Corporation Method and system for highly efficient database bitmap index processing
CN1593012A (en) * 2002-07-03 2005-03-09 休斯电子公司 Bit labeling for amplitude phase shift constellation used with low density parity check (LDPC) codes
CN101446978A (en) * 2008-12-11 2009-06-03 南京大学 Core node discovery method based on frequent itemset mining

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030154189A1 (en) * 1999-12-30 2003-08-14 Decode Genetics, Ehf. Indexing, rewriting and efficient querying of relations referencing spatial objects
CN1593012A (en) * 2002-07-03 2005-03-09 休斯电子公司 Bit labeling for amplitude phase shift constellation used with low density parity check (LDPC) codes
US20040249782A1 (en) * 2003-06-04 2004-12-09 International Business Machines Corporation Method and system for highly efficient database bitmap index processing
CN101446978A (en) * 2008-12-11 2009-06-03 南京大学 Core node discovery method based on frequent itemset mining

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
GEORGES GARDARIN ET. AL: "Bitmap Based Algorithms For Mining Association Rules", 《BDA 1998》, 31 December 1998 (1998-12-31) *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104899204A (en) * 2014-03-05 2015-09-09 腾讯科技(深圳)有限公司 Data storage method and device
CN104899204B (en) * 2014-03-05 2020-04-07 腾讯科技(深圳)有限公司 Data storage method and device
CN108256054A (en) * 2018-01-15 2018-07-06 腾讯科技(深圳)有限公司 The method and apparatus for determining destination number set
CN109522239A (en) * 2018-09-30 2019-03-26 上海恺英网络科技有限公司 A kind of method and apparatus that common trait data determine
CN109656949A (en) * 2018-11-15 2019-04-19 金蝶软件(中国)有限公司 Indexed search method, apparatus, computer equipment and the storage medium of bitmap
CN109656949B (en) * 2018-11-15 2020-11-10 金蝶软件(中国)有限公司 Bitmap index searching method and device, computer equipment and storage medium
WO2022037015A1 (en) * 2020-08-21 2022-02-24 苏州浪潮智能科技有限公司 Column-based storage method, apparatus and device based on persistent memory

Also Published As

Publication number Publication date
CN102214360B (en) 2013-07-17

Similar Documents

Publication Publication Date Title
CN102214360B (en) Bitmap constructing method and device, intersection method and intersection device
CN105207678B (en) A kind of system for implementing hardware of modified LZ4 compression algorithms
CN102970043B (en) A kind of compression hardware system based on GZIP and accelerated method thereof
Ozfatura et al. Gradient coding with clustering and multi-message communication
KR102377361B1 (en) Electronic system and output method thereof
CN102467571A (en) Data block partition method and addition method for data de-duplication
CN103138764A (en) Method and system for lossless compression of real-time data
US20230384959A1 (en) Capacity expansion method and system for a storage cluster, and related device
CN111930923B (en) Bloom filter system and filtering method
WO2023202149A1 (en) State selection method and system for finite state entropy encoding, and storage medium and device
CN114610650A (en) Memory compression method and device, storage medium and electronic equipment
CN104699485A (en) Massive program management method and massive program construction method
WO2012166190A1 (en) Compression match enumeration
JP6835285B1 (en) Data compression method, data compression device, data compression program, data decompression method, data decompression device and data decompression program
CN101478313B (en) Minimum value computing device for LDPC decoder and constructing method thereof
EP3926453A1 (en) Partitioning method and apparatus therefor
JP2020527880A (en) Encoding method and device, computer storage medium
US9172396B1 (en) Apparatus and method of compressing spatial data and apparatus and method of restoring compressed spatial data
CN111915091A (en) Parking space arrangement method, device, terminal and medium
US11409646B2 (en) Method for releasing memory
CN104636432B (en) A kind of method and device of journal file compression and decompression
KR20180067956A (en) Apparatus and method for data compression
CN103428502B (en) Decoding method and decoding system
US8140488B2 (en) Reducing memory required for prediction by partial matching models
CN103532758B (en) Be applicable to the configuration processing method of transmission of future generation, data equipment fusion

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
ASS Succession or assignment of patent right

Owner name: SHENZHEN SHIJI LIGHT SPEED INFORMATION TECHNOLOGY

Free format text: FORMER OWNER: TENGXUN SCI-TECH (SHENZHEN) CO., LTD.

Effective date: 20131104

C41 Transfer of patent application or patent right or utility model
COR Change of bibliographic data

Free format text: CORRECT: ADDRESS; FROM: 518000 SHENZHEN, GUANGDONG PROVINCE TO: 518057 SHENZHEN, GUANGDONG PROVINCE

TR01 Transfer of patent right

Effective date of registration: 20131104

Address after: A Tencent Building in Shenzhen Nanshan District City, Guangdong streets in Guangdong province science and technology 518057 16

Patentee after: Shenzhen Shiji Guangsu Information Technology Co., Ltd.

Address before: 518000 Guangdong city of Shenzhen province Futian District SEG Science Park 2 East Room 403

Patentee before: Tencent Technology (Shenzhen) Co., Ltd.