CN105824829B - Compression method, decompression method and device for order record - Google Patents

Compression method, decompression method and device for order record Download PDF

Info

Publication number
CN105824829B
CN105824829B CN201510004883.8A CN201510004883A CN105824829B CN 105824829 B CN105824829 B CN 105824829B CN 201510004883 A CN201510004883 A CN 201510004883A CN 105824829 B CN105824829 B CN 105824829B
Authority
CN
China
Prior art keywords
chapter
ordering
offset
subscription
module
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
CN201510004883.8A
Other languages
Chinese (zh)
Other versions
CN105824829A (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.)
China Mobile Group Zhejiang Co Ltd
Original Assignee
China Mobile Group Zhejiang 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 China Mobile Group Zhejiang Co Ltd filed Critical China Mobile Group Zhejiang Co Ltd
Priority to CN201510004883.8A priority Critical patent/CN105824829B/en
Publication of CN105824829A publication Critical patent/CN105824829A/en
Application granted granted Critical
Publication of CN105824829B publication Critical patent/CN105824829B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention provides a compression method, a decompression method and a device for order records, wherein the compression method comprises the following steps: acquiring chapter sequence numbers in the ordering records to be compressed; based on a chapter bitmap addressing algorithm, searching the position of the ordering state corresponding to the chapter number in an ordering record table; and modifying the ordering state corresponding to the chapter sequence number into ordered by using a bitmap compression algorithm. By the invention, the compression time delay can be shortened.

Description

Compression method, decompression method and device for order record
Technical Field
The present invention relates to the field of data service technologies, and in particular, to a compression method, a decompression method, and an apparatus for ordering records.
Background
As a new reading mode, mobile phone reading has started to gradually replace paper books, newspapers, magazines and the like, and more people have gone into learning and living. However, as the number of users and the number of electronic books increase, the order records of the users increase in a geometric series, which eventually causes a bottleneck in storage space and performance of the reading platform database.
The existing compression technology compresses a data table through a self-contained pressure compression function of relational database software (such as Oracle and Sql server), and the pressure compression principle is to save space by deleting data values which repeatedly appear in the data table. And, when compressing, use the short symbol of length to replace each value in the column, because the symbol occupation space is smaller than the actual value, thus reach the effect of saving space. The compression method is usually used for storing an OLAP (On-linear analytical Processing) database of a large amount of data, and is used for saving storage space and increasing data backup and recovery speed.
However, the existing compression technology has the following disadvantages: when data is inserted, updated and index key value is updated, the data is decompressed and updated, so that the operation delay is high, and the data is not suitable for an OLTP (On-line transaction Processing) database with millisecond response speed required by a user; the compressed data does not support high parallel reading and writing of the compressed data table.
Disclosure of Invention
The invention aims to provide a compression method, a decompression method and a device for order records, which complete the decompression and compression of the order records by reading and writing an order record table, shorten the time delay of compression operation and adapt to an OLTP database with millisecond-level response speed.
To achieve the object of the present invention, the present invention provides a compression method for an order record, comprising: acquiring chapter sequence numbers in the ordering records to be compressed; based on a chapter bitmap addressing algorithm, searching the position of the ordering state corresponding to the chapter number in an ordering record table; and modifying the ordering state corresponding to the chapter sequence number into ordered by using a bitmap compression algorithm.
The foregoing compression method for subscription records, the subscription record table comprising an offset bit and chapter bitmap fields, the chapter bitmap field being a hexadecimal string, and each hexadecimal character being represented as four binary characters;
the searching for the position of the ordering state corresponding to the chapter number in the ordering record table based on the chapter bitmap addressing algorithm comprises:
acquiring the length a of a chapter bitmap field in the ordering record table;
calculating the offset bit b corresponding to the ordering state corresponding to the chapter number in an ordering record table by using formula 1:
Figure BDA0000652221260000021
formula 1;
calculating an offset of the subscription state corresponding to the chapter number at the offset bit b by using formula 2:
offset is num-a × b × 4 formula 2;
the chapter number is num, and the offset at the offset position is the position of the ordering state corresponding to the chapter number in the ordering record table.
In the compression method for the subscription record, each binary character is represented as a boolean value of the subscription record, where "1" represents that the chapter is subscribed and "0" represents that the chapter is not subscribed.
In the foregoing compression method for subscription records, the bitmap compression algorithm is an or operation, and the modifying the subscription status corresponding to the chapter number to be subscribed by using the bitmap compression algorithm includes: using an OR operation of "1" with a binary character at the offset of the offset bit, overwriting the binary character at the offset of the offset bit with "1", modifying the subscription status corresponding to the chapter number to subscribed.
The invention also provides a compression device for the order record, which comprises a first acquisition module, an addressing module and a compression module; the first acquisition module is used for acquiring chapter serial numbers in the ordering records to be compressed; the addressing module is used for searching the position of the ordering state corresponding to the chapter number in an ordering record table based on a chapter bitmap addressing algorithm; and the compression module is used for modifying the ordering state corresponding to the chapter sequence number into ordered by using a bitmap compression algorithm.
The foregoing compression apparatus for subscription records, the subscription record table comprising an offset bit and chapter bitmap fields, the chapter bitmap field being a hexadecimal string, and each hexadecimal character being represented as four binary characters;
the addressing module comprises a second acquisition module, a first calculation module and a second calculation module;
the second obtaining module is configured to obtain a chapter bitmap field length a in the order record table;
the first calculating module is configured to calculate, by using formula 1, an offset bit b corresponding to the ordering state corresponding to the chapter number in an ordering record table:
Figure BDA0000652221260000031
formula 1;
the second calculating module is configured to calculate an offset of the subscription state corresponding to the chapter number at the offset bit b by using formula 2:
offset is num-a × b × 4 formula 2;
the chapter number is num, and the offset at the offset position is the position of the ordering state corresponding to the chapter number in the ordering record table.
In the compression apparatus for subscription records, each binary character represents a boolean value of the subscription record, where "1" represents that the chapter is subscribed and "0" represents that the chapter is not subscribed.
In the foregoing compression apparatus for ordering records, the bitmap compression algorithm is an or operation, and the compression module is configured to use a "1" to perform an or operation with a binary character at the offset of the offset bit, to rewrite the binary character at the offset of the offset bit to "1", and to modify the ordering status corresponding to the chapter number to be ordered.
The present invention further provides a method for decompressing an order record, including: receiving chapter sequence numbers in the subscription records to be authenticated; based on a chapter bitmap addressing algorithm, searching the position of the ordering state corresponding to the chapter number in an ordering record table; and judging whether the ordering state corresponding to the chapter number is ordered or not.
The foregoing decompression method for subscription records, the subscription record table comprising an offset bit and chapter bitmap fields, the chapter bitmap field being a hexadecimal string, and each hexadecimal character being represented as four binary characters;
the searching for the position of the ordering state corresponding to the chapter number in the ordering record table based on the chapter bitmap addressing algorithm comprises:
acquiring the length a of a chapter bitmap field in the ordering record table;
calculating the offset bit b corresponding to the ordering state corresponding to the chapter number in an ordering record table by using formula 1:
Figure BDA0000652221260000041
formula 1;
calculating an offset of the subscription state corresponding to the chapter number at the offset bit b by using formula 2:
offset is num-a × b × 4 formula 2;
the chapter number is num, and the offset at the offset position is the position of the ordering state corresponding to the chapter number in the ordering record table.
In the foregoing decompression method for subscription records, each binary character is represented as a boolean value of the subscription record, where "1" represents that the chapter is subscribed and "0" represents that the chapter is not subscribed.
In the foregoing decompression method for subscription records, the determining whether the subscription state corresponding to the chapter number is subscribed includes: it is determined whether a binary character at the offset of the offset bit is "1", which indicates that a chapter is ordered if "1", and indicates that a chapter is not ordered if "0".
The invention also provides a decompression device for the order record, which is characterized by comprising a first receiving module, an addressing module and a decompression module; the first receiving module is used for receiving the chapter serial number in the subscription record to be authenticated; the addressing module is used for searching the position of the ordering state corresponding to the chapter number in an ordering record table based on a chapter bitmap addressing algorithm; and the decompression module is used for judging whether the ordering state corresponding to the chapter number is ordered or not.
The foregoing decompression apparatus for subscription records, wherein the subscription record table includes an offset bit and a chapter bitmap field, the chapter bitmap field is a hexadecimal character string, and each hexadecimal character is represented by four binary characters;
the addressing module comprises a second acquisition module, a first calculation module and a second calculation module;
the second obtaining module is configured to obtain a chapter bitmap field length a in the order record table;
the first calculating module is configured to calculate, by using formula 1, an offset bit b corresponding to the ordering state corresponding to the chapter number in an ordering record table:
Figure BDA0000652221260000051
formula 1;
the second calculating module is configured to calculate an offset of the subscription state corresponding to the chapter number at the offset bit b by using formula 2:
offset is num-a × b × 4 formula 2;
the chapter number is num, and the offset at the offset position is the position of the ordering state corresponding to the chapter number in the ordering record table.
In the foregoing decompression apparatus for subscription records, each binary character represents a boolean value of the subscription record, where "1" represents that the chapter is subscribed and "0" represents that the chapter is not subscribed.
In the foregoing decompression apparatus for ordering records, the decompression module is configured to determine whether a binary character at the offset of the offset bit is "1", and if so, it indicates that a chapter is ordered, and if so, it indicates that a chapter is not ordered.
By the technical scheme, the technical effects of the embodiment of the invention are as follows:
1. the compression method for the order record of the embodiment of the invention writes the order record to be compressed into the order record table by utilizing the chapter number in the order record to be compressed based on the chapter bitmap addressing algorithm and the bitmap compression algorithm, thereby achieving the purpose of compressing the order record, changing the existing compression mode, shortening the compression operation time delay and being capable of adapting to an OLTP database with millisecond-level response speed.
2. In addition, the compression method of the invention is compatible with the compression algorithm of the data table carried by the database, and on the OLTP system, the existing compression function of the data table of the database can be continuously used on the basis of the compression of the invention, thereby realizing better compression effect.
3. The decompression method for the order record of the embodiment of the invention links the chapter number in the order record to be authenticated with the order record table, and achieves the purposes of authentication and decompression by judging whether the order state corresponding to the chapter number is ordered in the order record table.
Drawings
FIG. 1: a block diagram of a compression method for subscription records of an embodiment of the present invention.
FIG. 2: a flow diagram of addressing and compression is shown in accordance with an embodiment of the present invention.
FIG. 3: a block diagram of a compression apparatus for subscription records according to an embodiment of the present invention.
FIG. 4: a block diagram of a decompression method for subscription records of an embodiment of the present invention is shown.
FIG. 5: is a flow chart of decompression and authentication of another embodiment of the present invention.
FIG. 6: a block diagram of a decompression apparatus for subscription records of an embodiment of the present invention is shown.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the following detailed description of the embodiments is provided with reference to the accompanying drawings.
In the current storage scheme of the ordering record, each time a user orders a chapter of a book, a piece of data containing information such as a mobile phone number, a book serial number, a chapter serial number and the like is inserted into the ordering record table of the user, so that the subsequent authentication can be conveniently carried out. And because the user generates an ordering record according to chapters when reading a payment chapter, and the sequence of the chapters in each book is fixed, the invention provides a basis for using the chapter bitmap field to indicate the chapter number in the ordering record.
The compression method for the order record of the embodiment of the invention is to write the order record to be compressed into the order record table by utilizing the chapter number in the order record to be compressed based on the chapter bitmap addressing algorithm and the bitmap compression algorithm, thereby achieving the purpose of compressing the order record, changing the existing compression mode, shortening the compression operation time delay and being capable of adapting to an OLTP database with millisecond-level response speed. In addition, the compression method of the invention is compatible with the compression algorithm of the data table carried by the database, and on the OLTP system, the existing compression function of the data table of the database can be continuously used on the basis of the compression of the invention, thereby realizing better compression effect.
Referring to fig. 1, an embodiment of the present invention provides a compression method for subscription records, including:
step S101: acquiring chapter sequence numbers in the ordering records to be compressed;
step S102: based on a chapter bitmap addressing algorithm, searching the position of the ordering state corresponding to the chapter number in an ordering record table;
step S103: and modifying the ordering state corresponding to the chapter sequence number into ordered by using a bitmap compression algorithm.
The compression method for the order record of the specific embodiment of the invention is to link the chapter number in the order record to be compressed with the order record table, and achieve the purpose of compressing the order record to be compressed into the order record table by changing the order record table, so as to reduce the consumption of the whole storage space.
Specifically, the subscription record table includes an offset bit and a chapter bitmap field, and the chapter number is indicated by the offset bit and the chapter bitmap field.
Wherein the chapter bitmap field is a hexadecimal string, and each hexadecimal character represents four binary characters, and each binary character represents a boolean value ordered for a chapter, "1" represents that the chapter is ordered, and "0" represents that the chapter is not ordered. That is, if the length of the chapter bitmap field is a, it can indicate a 4a chapter subscription status. For example, the chapter bitmap field is a1, and its corresponding binary character is 10100001, which represents that the chapters corresponding to the 1 st, 3 rd and 8 th positions are ordered, and the chapters corresponding to the 2 nd, 4 th and 7 th positions are not ordered.
In order to ensure that the chapter number can be represented, an offset bit is introduced into the ordering record table. When the offset is-1, ordering according to the book is represented; and when the offset bit is 0 to 99 (or non-1), a subscription by chapter is indicated.
Specifically, the finding of the position of the ordering state corresponding to the chapter number in the ordering record table based on the chapter bitmap addressing algorithm includes:
acquiring the length a of a chapter bitmap field in the ordering record table;
calculating the offset bit b corresponding to the ordering state corresponding to the chapter number in an ordering record table by using formula 1:
Figure BDA0000652221260000071
formula 1;
calculating an offset of the subscription state corresponding to the chapter number at the offset bit b by using formula 2:
offset is num-a × b × 4 formula 2;
the chapter number is num, and the offset at the offset position is the position of the ordering state corresponding to the chapter number in the ordering record table.
And after the position of the ordering state corresponding to the chapter number in the ordering record table is found, the ordering record can be compressed into the ordering record table by changing the ordering state corresponding to the chapter number.
In an embodiment of the present invention, the bitmap compression algorithm is an or operation, and the modifying the subscription state corresponding to the chapter number to be subscribed by using the bitmap compression algorithm includes:
using an OR operation of "1" with a binary character at the offset of the offset bit, overwriting the binary character at the offset of the offset bit with "1", modifying the subscription status corresponding to the chapter number to subscribed.
A specific embodiment is described below to illustrate the addressing and compression process of the present invention, as shown in fig. 2.
In this specific embodiment, the chapter number num in the subscription record to be compressed is 152, and the chapter bitmap field length a of the corresponding subscription record table is 8, so that the offset b is equal to 12 according to formula one, and the offset is equal to 8 according to formula two, so that the subscription status corresponding to the chapter number 152 is located where the offset of the subscription record table is 12 and the offset is 8, see fig. 2, where the chapter bitmap field is 0CF and the corresponding binary string is 000011001111; subsequently, using a bitmap compression algorithm, the binary string 000011001111 is modified into a binary string 000011011111 using an or operation of the binary string 000000010000 with the binary string 000011001111, with the corresponding chapter bitmap field modified to 0 DF; this completes the compression of the subscription record to be compressed into the subscription record table.
Because the bitmap compression algorithm in the embodiment of the invention is an OR operation, repeated operation does not influence the correctness of data, repeated recording is avoided, and the error tolerance is strong compared with the existing compression technology.
Referring to fig. 3, an embodiment of the present invention further provides a compression apparatus for an order record, corresponding to the compression method for an order record of fig. 1, including a first obtaining module, an addressing module, and a compression module;
the first acquisition module is used for acquiring chapter serial numbers in the ordering records to be compressed;
the addressing module is used for searching the position of the ordering state corresponding to the chapter number in an ordering record table based on a chapter bitmap addressing algorithm;
and the compression module is used for modifying the ordering state corresponding to the chapter sequence number into ordered by using a bitmap compression algorithm.
Wherein, the ordering record table comprises an offset bit field and a chapter bitmap field, and the chapter number is represented by the offset bit field and the chapter bitmap field.
The chapter bitmap field is a string of hexadecimal characters, each hexadecimal character representing four binary characters, and each binary character representing a boolean value ordered for a chapter, "1" representing that the chapter has been ordered, and "0" representing that the chapter has not been ordered. That is, if the length of the chapter bitmap field is a, it can indicate a 4a chapter subscription status. The offset bits are introduced to ensure that the chapter number can be represented.
Specifically, the addressing module comprises a second obtaining module, a first calculating module and a second calculating module;
the second obtaining module is configured to obtain a chapter bitmap field length a in the order record table;
the first calculating module is configured to calculate, by using formula 1, an offset bit b corresponding to the ordering state corresponding to the chapter number in an ordering record table:
Figure BDA0000652221260000091
formula 1;
the second calculating module is configured to calculate an offset of the subscription state corresponding to the chapter number at the offset bit b by using formula 2:
offset is num-a × b × 4 formula 2;
the chapter number is num, and the offset at the offset position is the position of the ordering state corresponding to the chapter number in the ordering record table.
In an embodiment of the present invention, the bitmap compression algorithm is an or operation, and the compression module is configured to use a "1" to perform an or operation with a binary character at the offset of the offset bit, to rewrite the binary character at the offset of the offset bit to be "1", and to modify the subscription status corresponding to the chapter number to be subscribed.
Referring to fig. 4, an embodiment of the present invention further provides a decompression method for subscription records, which is used for authenticating the subscription records, and includes:
step 401: receiving chapter sequence numbers in the subscription records to be authenticated;
step 402: based on a chapter bitmap addressing algorithm, searching the position of the ordering state corresponding to the chapter number in an ordering record table;
step 403: and judging whether the ordering state corresponding to the chapter number is ordered or not.
The decompression method for the order record of the embodiment of the invention links the chapter number in the order record to be authenticated with the order record table, and achieves the purpose of authentication by judging whether the order state corresponding to the chapter number is ordered in the order record table.
Specifically, the subscription record table includes an offset bit and a chapter bitmap field, and the chapter number is indicated by the offset bit and the chapter bitmap field.
Wherein the chapter bitmap field is a hexadecimal string, and each hexadecimal character represents four binary characters, and each binary character represents a boolean value ordered for a chapter, "1" represents that the chapter is ordered, and "0" represents that the chapter is not ordered. That is, if the length of the chapter bitmap field is a, it can indicate a 4a chapter subscription status.
The chapter bitmap addressing algorithm used in the decompression method for order records according to the embodiment of the present invention is the same as the chapter bitmap addressing algorithm used in the compression method for order records, and the position of the order state corresponding to the chapter number in the order record table needs to be found, which is not described herein again.
And after the position of the ordering state corresponding to the chapter number in the ordering record to be authenticated in the ordering record table is found, judging whether the ordering state corresponding to the chapter number is ordered or not.
Specifically, the determining whether the subscription state corresponding to the chapter number is subscribed includes:
it is determined whether a binary character at the offset of the offset bit is "1", which indicates that a chapter is ordered if "1", and indicates that a chapter is not ordered if "0".
That is, when the binary character at the offset of the offset bit is "1", the authentication is passed, otherwise, the authentication is not passed.
A specific embodiment is described below to illustrate the decompression and authentication process of the present invention, which is illustrated in fig. 5.
In the specific embodiment, the chapter number num in the subscription record to be authenticated is 7 and 151, and the chapter bitmap field length a of the corresponding subscription record table is 8; when num is 7, the position of the subscription state is offset 0 and offset 7, the corresponding chapter bitmap field is FF0, the corresponding binary string is 111111110000, and the 7 th position is "1", so that the authentication is passed and the chapter is subscribed; when num is 151, the position of the subscription state is offset bit 12 and offset 7, the corresponding chapter bitmap field is 0DF, the corresponding binary string is 000011011111, because the 7 th position is "0", the authentication is not passed, and the chapter is not subscribed; this completes the decompression and authentication process.
Referring to fig. 6, an embodiment of the present invention further provides a decompression apparatus for subscription records, corresponding to the decompression method for subscription records of fig. 4, including a first receiving module, an addressing module, and a decompression module;
the first receiving module is used for receiving the chapter serial number in the subscription record to be authenticated;
the addressing module is used for searching the position of the ordering state corresponding to the chapter number in an ordering record table based on a chapter bitmap addressing algorithm;
and the decompression module is used for judging whether the ordering state corresponding to the chapter number is ordered or not.
Specifically, the decompression apparatus for subscription records according to the embodiment of the present invention associates the chapter number in the subscription record to be authenticated with the subscription record table, and achieves the purpose of authentication by determining whether the subscription state corresponding to the chapter number is subscribed in the subscription record table.
The subscription record table includes offset bit and chapter bitmap fields, and the chapter number is indicated by the offset bit and chapter bitmap fields. Wherein the chapter bitmap field is a hexadecimal string, and each hexadecimal character represents four binary characters, and each binary character represents a boolean value ordered for a chapter, "1" represents that the chapter is ordered, and "0" represents that the chapter is not ordered. That is, if the length of the chapter bitmap field is a, it can indicate a 4a chapter subscription status.
In the decompression apparatus for order record according to the embodiment of the present invention, the addressing module of the decompression apparatus for order record is the same as the addressing module of the compression apparatus for order record, and the position of the order state corresponding to the chapter number in the order record table is to be found, which is not described herein again.
When the addressing module finds the position of the ordering state corresponding to the chapter number in the ordering record to be authenticated in the ordering record table, the decompression module needs to judge whether the ordering state corresponding to the chapter number is ordered or not.
Specifically, the decompression module is configured to determine whether a binary character at the offset of the offset bit is "1", and if so, it indicates that the chapter is ordered, and if so, it indicates that the chapter is not ordered.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (12)

1. A compression method for subscription records, comprising:
acquiring chapter sequence numbers in the ordering records to be compressed;
based on a chapter bitmap addressing algorithm, searching the position of the ordering state corresponding to the chapter number in an ordering record table;
using a bitmap compression algorithm to modify the ordering state corresponding to the chapter number into ordered state;
the order record table comprises an offset bit and a chapter bitmap field, the chapter bitmap field is a hexadecimal character string, and each hexadecimal character is represented as four binary characters;
the searching for the position of the ordering state corresponding to the chapter number in the ordering record table based on the chapter bitmap addressing algorithm comprises:
acquiring the length a of a chapter bitmap field in the ordering record table;
calculating the offset bit b corresponding to the ordering state corresponding to the chapter number in an ordering record table by using formula 1:
Figure FDA0002209230070000011
calculating an offset of the subscription state corresponding to the chapter number at the offset bit b by using formula 2:
offset is num-a × b × 4 formula 2;
the chapter number is num, and the offset at the offset position is the position of the ordering state corresponding to the chapter number in the ordering record table.
2. The compression method for subscription records according to claim 1, wherein each binary character represents a boolean value of subscription records, wherein "1" represents that a chapter has been subscribed and "0" represents that a chapter has not been subscribed.
3. The compression method for subscription records according to claim 2, wherein the bitmap compression algorithm is an or operation, and the modifying the subscription status corresponding to the chapter number to be subscribed by using the bitmap compression algorithm comprises:
using an OR operation of "1" with a binary character at the offset of the offset bit, overwriting the binary character at the offset of the offset bit with "1", modifying the subscription status corresponding to the chapter number to subscribed.
4. The compression device for the order record is characterized by comprising a first acquisition module, an addressing module and a compression module;
the first acquisition module is used for acquiring chapter serial numbers in the ordering records to be compressed;
the addressing module is used for searching the position of the ordering state corresponding to the chapter number in an ordering record table based on a chapter bitmap addressing algorithm;
the compression module is used for modifying the ordering state corresponding to the chapter sequence number into ordered by using a bitmap compression algorithm;
the order record table comprises an offset bit and a chapter bitmap field, the chapter bitmap field is a hexadecimal character string, and each hexadecimal character is represented as four binary characters;
the addressing module comprises a second acquisition module, a first calculation module and a second calculation module;
the second obtaining module is configured to obtain a chapter bitmap field length a in the order record table;
the first calculating module is configured to calculate, by using formula 1, an offset bit b corresponding to the ordering state corresponding to the chapter number in an ordering record table:
Figure FDA0002209230070000021
the second calculating module is configured to calculate an offset of the subscription state corresponding to the chapter number at the offset bit b by using formula 2:
offset is num-a × b × 4 formula 2;
the chapter number is num, and the offset at the offset position is the position of the ordering state corresponding to the chapter number in the ordering record table.
5. The compression apparatus for subscription records according to claim 4, wherein each binary character represents a Boolean value of the subscription record, wherein "1" represents that the chapter has been subscribed and "0" represents that the chapter has not been subscribed.
6. The compression apparatus for subscription records according to claim 5, wherein the bitmap compression algorithm is an OR operation, and the compression module is configured to use an OR operation of "1" with a binary character at the offset of the offset bit, to rewrite the binary character at the offset of the offset bit to "1", and to modify the subscription status corresponding to the chapter number to be subscribed.
7. A decompression method for subscription records, comprising:
receiving chapter sequence numbers in the subscription records to be authenticated;
based on a chapter bitmap addressing algorithm, searching the position of the ordering state corresponding to the chapter number in an ordering record table;
judging whether the ordering state corresponding to the chapter number is ordered or not;
the order record table comprises an offset bit and a chapter bitmap field, the chapter bitmap field is a hexadecimal character string, and each hexadecimal character is represented as four binary characters;
the searching for the position of the ordering state corresponding to the chapter number in the ordering record table based on the chapter bitmap addressing algorithm comprises:
acquiring the length a of a chapter bitmap field in the ordering record table;
calculating the offset bit b corresponding to the ordering state corresponding to the chapter number in an ordering record table by using formula 1:
Figure FDA0002209230070000031
calculating an offset of the subscription state corresponding to the chapter number at the offset bit b by using formula 2:
offset is num-a × b × 4 formula 2;
the chapter number is num, and the offset at the offset position is the position of the ordering state corresponding to the chapter number in the ordering record table.
8. The decompression method for subscription records according to claim 7, wherein each binary character represents a Boolean value of the subscription record, wherein "1" represents that the chapter has been subscribed and "0" represents that the chapter has not been subscribed.
9. The decompression method for subscription records according to claim 8, wherein the determining whether the subscription status corresponding to the chapter number is subscribed comprises:
it is determined whether a binary character at the offset of the offset bit is "1", which indicates that a chapter is ordered if "1", and indicates that a chapter is not ordered if "0".
10. A decompression apparatus for subscription records, comprising a first receiving module, an addressing module and a decompression module;
the first receiving module is used for receiving the chapter serial number in the subscription record to be authenticated;
the addressing module is used for searching the position of the ordering state corresponding to the chapter number in an ordering record table based on a chapter bitmap addressing algorithm;
the decompression module is used for judging whether the ordering state corresponding to the chapter number is ordered or not;
the order record table comprises an offset bit and a chapter bitmap field, the chapter bitmap field is a hexadecimal character string, and each hexadecimal character is represented as four binary characters;
the addressing module comprises a second acquisition module, a first calculation module and a second calculation module;
the second obtaining module is configured to obtain a chapter bitmap field length a in the order record table;
the first calculating module is configured to calculate, by using formula 1, an offset bit b corresponding to the ordering state corresponding to the chapter number in an ordering record table:
Figure FDA0002209230070000041
the second calculating module is configured to calculate an offset of the subscription state corresponding to the chapter number at the offset bit b by using formula 2:
offset is num-a × b × 4 formula 2;
the chapter number is num, and the offset at the offset position is the position of the ordering state corresponding to the chapter number in the ordering record table.
11. The decompression device for subscription records according to claim 10, wherein each binary character represents a boolean value of a subscription record, wherein "1" represents that a chapter has been subscribed and "0" represents that a chapter has not been subscribed.
12. The decompression apparatus for subscription records according to claim 11, wherein the decompression module is configured to determine whether a binary character at the offset of the offset bit is "1", if "1", indicating that a chapter is subscribed, and if "0", indicating that a chapter is not subscribed.
CN201510004883.8A 2015-01-06 2015-01-06 Compression method, decompression method and device for order record Active CN105824829B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510004883.8A CN105824829B (en) 2015-01-06 2015-01-06 Compression method, decompression method and device for order record

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510004883.8A CN105824829B (en) 2015-01-06 2015-01-06 Compression method, decompression method and device for order record

Publications (2)

Publication Number Publication Date
CN105824829A CN105824829A (en) 2016-08-03
CN105824829B true CN105824829B (en) 2020-05-15

Family

ID=56513650

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510004883.8A Active CN105824829B (en) 2015-01-06 2015-01-06 Compression method, decompression method and device for order record

Country Status (1)

Country Link
CN (1) CN105824829B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112861036A (en) * 2021-02-07 2021-05-28 广州华多网络科技有限公司 User favorite access method and device, equipment and medium thereof

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102479362A (en) * 2010-11-24 2012-05-30 盛乐信息技术(上海)有限公司 Method for automatically subscribing incomplete e-book by using e-book reader
CN103078646A (en) * 2012-12-31 2013-05-01 上海宇芯科技有限公司 Dictionary lookup compression and decompression method and device
CN103281156A (en) * 2013-05-02 2013-09-04 华为技术有限公司 Methods and devices for compressing and decompressing data
CN103995887A (en) * 2014-05-30 2014-08-20 上海达梦数据库有限公司 Bitmap index compressing method and bitmap index decompressing method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8417730B2 (en) * 2008-04-14 2013-04-09 Objectif Lune Inc. Block compression algorithm

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102479362A (en) * 2010-11-24 2012-05-30 盛乐信息技术(上海)有限公司 Method for automatically subscribing incomplete e-book by using e-book reader
CN103078646A (en) * 2012-12-31 2013-05-01 上海宇芯科技有限公司 Dictionary lookup compression and decompression method and device
CN103281156A (en) * 2013-05-02 2013-09-04 华为技术有限公司 Methods and devices for compressing and decompressing data
CN103995887A (en) * 2014-05-30 2014-08-20 上海达梦数据库有限公司 Bitmap index compressing method and bitmap index decompressing method

Also Published As

Publication number Publication date
CN105824829A (en) 2016-08-03

Similar Documents

Publication Publication Date Title
US20050210054A1 (en) Information management system
CN103200293A (en) Method of automatically combining tautonomy contacts in process of guiding contacts into contact list
CN104881470A (en) Repeated data deletion method oriented to mass picture data
CN103150359B (en) Micro-blog information display packing and device
CN111078701B (en) Data extraction method and device based on relational database
CN108027713A (en) Data de-duplication for solid state drive controller
CN106557571A (en) A kind of data duplicate removal method and device based on K V storage engines
EP3123360B1 (en) Partition filtering using smart index in memory
CN110647423B (en) Method, device and readable medium for creating storage volume mirror image based on application
CN105824829B (en) Compression method, decompression method and device for order record
KR101588375B1 (en) Method and system for managing database
CN106909623B (en) A kind of data set and date storage method for supporting efficient mass data to analyze and retrieve
EP3343395B1 (en) Data storage method and apparatus for mobile terminal
CN104408097A (en) Hybrid indexing method and system based on character field hot update
CN112506869A (en) File processing method, device and system
CN111858581A (en) Page query method and device, storage medium and electronic equipment
CN110647577A (en) Data cube partitioning method and device, computer equipment and storage medium
CN105260423A (en) Duplicate removal method and apparatus for electronic cards
US11652495B2 (en) Pattern-based string compression
US10360234B2 (en) Recursive extractor framework for forensics and electronic discovery
CN106372985B (en) Order data processing method and device
CN104615948A (en) Method for automatically recognizing file completeness and restoring
CN111444194B (en) Method, device and equipment for clearing indexes in block chain type account book
US10037148B2 (en) Facilitating reverse reading of sequentially stored, variable-length data
CN107861956B (en) Method and device for inquiring data record of bayonet passing vehicle

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant