A method and device for processing data based on column storage format

Through field similarity analysis and sorting processing of data, the compression rate of ORC files is improved, the problems of file expansion and storage resource waste are solved, and more efficient data storage and query efficiency are achieved.

CN111723089BActive Publication Date: 2024-09-20BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910216038.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-03-21
Publication Date
2024-09-20
Estimated Expiration
2039-03-21

AI Technical Summary

Technical Problem

In the existing technology, the compression rate of ORC files cannot be sufficiently reduced, leading to problems of file expansion and waste of storage resources.

Method used

By receiving batches of target data, determining the similarity between data according to field information, sorting is performed, and logical processing is performed based on the sorting results to improve the similarity of data blocks, thereby improving the compression rate.

Benefits of technology

It effectively reduces the consumption of data storage resources, solves the problem of file expansion, and improves the compression rate of data blocks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111723089B
    Figure CN111723089B
Patent Text Reader

Abstract

The present invention discloses a method and device for processing data based on a column storage format, and relates to the field of computer technology. A specific implementation of the method includes: receiving batch target data; determining the similarity between the batch target data according to the field information of the target data; and sorting the batch target data according to the determined similarity; and logically processing the batch target data according to the column storage format based on the sorting result. The method can reduce the compression rate and data storage resources, and solve the problem of file expansion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for processing data based on a column storage format. Background Art

[0002] From the characteristics of the columnar storage format, we can see that when using columnar storage, all elements of each column are stored sequentially. There are many columnar storage formats, such as the ORC (Optimized Row Columnar) storage format. For the storage of batch data, it is very necessary to reduce its compression rate.

[0003] In the prior art, different from the row storage format, the column storage adopted by ORC can maintain the consistency of the data format in its own storage unit, thereby improving the compression rate. In addition, in the storage unit of the column information, ORC will determine the degree of clustering of the current column information to decide whether to use dictionary coding for further compression. These operations can save data storage space, and the multi-level index mode can greatly improve the query efficiency of data according to statistical information at all levels. Among them, dictionary coding means that when a field has a large number of identical enumeration values, the same enumeration values ​​will be uniformly represented by a certain dictionary code, and will not be recorded repeatedly. Although the above method can reduce the compression rate of the data file to a certain extent, the above operation is not very sufficient. In many cases, the compression rate of the processing result still cannot meet the demand. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a method and apparatus for processing data based on a columnar storage format, which can reduce compression rate and data storage resources and solve the problem of ORC file expansion.

[0005] To achieve the above objective, according to one aspect of an embodiment of the present invention, a method for processing data based on a column storage format is provided.

[0006] The method for processing data based on a column storage format in an embodiment of the present invention includes: receiving batch target data; determining the similarity between the batch target data based on field information of the target data; and sorting the batch target data based on the determined similarity; based on the sorting result, logically processing the batch target data according to the column storage format.

[0007] Optionally, based on the sorting result, after logically processing the batch target data in a columnar storage format, it also includes: determining the compression rate of the batch target data after the logical processing; judging whether to re-sort the batch target data according to the compression rate; if so, determining the new similarity between the batch target data according to the field information of the target data; and sorting the batch target data according to the determined new similarity.

[0008] Optionally, based on the field information of the target data, the step of determining the similarity between the batch target data includes: analyzing the field information of the target data, and filtering out multiple sorting fields from all the fields of the target data; and associating the field information of the multiple sorting fields of the target data to determine the similarity between the batch target data.

[0009] Optionally, based on the sorting result, the step of performing logical processing on the batch target data in a columnar storage format includes: based on the sorting result, storing the batch target data in a Hive data warehouse in a columnar storage format; and / or, the columnar storage format is an ORC file storage format.

[0010] To achieve the above objective, according to another aspect of an embodiment of the present invention, a device for processing data based on a column storage format is provided.

[0011] The device for processing data based on a column storage format according to an embodiment of the present invention includes:

[0012] A receiving module, used for receiving batch target data;

[0013] A sorting module, configured to determine the similarity between the batch target data according to the field information of the target data; and sort the batch target data according to the determined similarity;

[0014] The logic processing module is used to perform logic processing on the batch target data in a column storage format based on the sorting result.

[0015] Optionally, the apparatus for processing data based on a column storage format in an embodiment of the present invention further includes a detection module, which is used to determine a compression ratio of the batch target data after logical processing; and determine whether to re-sort the batch target data according to the compression ratio;

[0016] The detection module determines to re-sort the batch target data, and the sorting module determines new similarities between the batch target data according to the field information of the target data; and sorts the batch target data according to the determined new similarities.

[0017] Optionally, the sorting module is further used to analyze field information of the target data, filter out multiple sorting fields from all fields of the target data; associate field information of the multiple sorting fields of the target data, and determine similarities between the batches of target data.

[0018] Optionally, the logic processing module is also used to store the batch target data in a Hive data warehouse in a column storage format based on the sorting result; and / or the column storage format is an ORC file storage format.

[0019] To achieve the above objective, according to another aspect of an embodiment of the present invention, an electronic device is provided.

[0020] The electronic device of an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement any of the above-mentioned methods for processing data based on a columnar storage format.

[0021] To achieve the above-mentioned purpose, according to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, characterized in that when the program is executed by a processor, any of the above-mentioned methods for processing data based on a columnar storage format is implemented.

[0022] One embodiment of the above invention has the following advantages or beneficial effects: it can locate the fields with high similarity among N fields of data, sort the data, thereby changing the data distribution, improving the similarity of data blocks, and improving the compression rate. In addition, it solves the problem of file expansion or incompressibility.

[0023] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0025] Figure 1 is a schematic diagram of the main process of a method for processing data based on a column storage format according to an embodiment of the present invention;

[0026] Figure 2 This is a schematic diagram of the ORC file structure;

[0027] Figure 3 It is a schematic diagram of traversing data according to query conditions in the ORC file structure;

[0028] Figure 4It is a schematic diagram of a method architecture for processing data based on a column storage format in the prior art;

[0029] Figure 5 is a schematic diagram of a method architecture for processing data based on a column storage format according to an embodiment of the present invention;

[0030] Figure 6 is a schematic diagram of main modules of an apparatus for processing data based on a column storage format according to an embodiment of the present invention;

[0031] Figure 7 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0032] Figure 8 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0033] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0034] Column-Based and row-Based storage formats have their own characteristics. In relational databases, row-based storage is usually used. When column-based storage is used, all elements of each column are stored sequentially. For example, the following Table 1 is stored in column-based storage format and row-based storage format, and the processed results are shown in Table 2 and Table 3 respectively.

[0035] Table 1

[0036] ID NAME DATE 001 A 1-1 002 B 1-2 003 C 1-3 …

[0037] Table 2

[0038] 001 A 1-1 002 B 1-2 003 C 1-3 …

[0039] Table 3

[0040]

[0041] From the above examples, we can see that compared with the row-based storage commonly used in relational databases, all elements of each column are stored sequentially when column-based storage is used. This feature can bring the following optimizations to query and storage: when querying, there is no need to scan all the data, but only to read the columns involved in each query, which can effectively reduce I\O operations; because the members of each column are isomorphic, more efficient data compression algorithms can be used for different data types to save storage space and further reduce I\O.

[0042] Figure 1 is a schematic diagram of the main process of a method for processing data based on a column storage format according to an embodiment of the present invention, such as Figure 1 As shown, the method for processing data based on the column storage format according to the embodiment of the present invention mainly includes:

[0043] Step S101: receiving batch target data.

[0044] Step S102: Determine the similarity between the batch target data according to the field information of the target data; and sort the batch target data according to the determined similarity. In the process of determining the similarity, analyze the field information of the target data, select multiple sorting fields from all the fields of the target data; associate the field information of the multiple sorting fields of the target data, and determine the similarity between the batch target data.

[0045] Step S103: Based on the sorting result, the batch target data is logically processed in a column storage format. Specifically, based on the sorting result, the batch target data is stored in a Hive data warehouse in a column storage format; and / or the column storage format is an ORC file storage format. After the above process, the compression rate of the batch target data after logical processing is determined; based on the compression rate, it is determined whether to re-sort the batch target data. If so, the new similarity between the batch target data is determined based on the field information of the target data; and the batch target data is sorted according to the determined new similarity.

[0046] The ORC (Optimized Row Columnar) file format is a columnar storage format in the Hadoop ecosystem. It is used to reduce Hadoop data storage space and speed up Hive queries. It has become the mainstream structure favored by various data processing frameworks such as hive, spark, and presto. Similar to Parquet, it first divides the entire table according to row groups and stores it by column in each row group. When data is stored in the ORC format, it is first split into several data block stripes by row, and then stored in columnar form within each stripe according to column information. In addition, ORC will build metadata information and index information at various levels. For example Figure 2 As shown in the figure, ORC files are divided into three levels of statistical information: file level, stripe level, and row level.

[0047] File level: At the end of the ORC file, the file-level statistical information PostScript is recorded. PostScript records the description information, metadata information, and statistical information of the entire file. This information is mainly used for query optimization and can also output results for some simple aggregation queries such as max, min, and sum.

[0048] Stripe level: Figure 2 In the File Footer, the ORC file will save the stripe-level statistics of each field. The ORC reader uses this statistics to determine which stripe records need to be read in a data query. For example, if the field max(a) of a stripe is 100 and min(a) is 20, then when the where condition is a>100 or a<20, then the data in this stripe does not need to be read in this query.

[0049] row level: Figure 2 In the Index Data, ORC will build an index for all the columns in each stripe (column_1 to column_m), and each column will have many rows of records. ORC defaults to 10,000 rows of records as an index group (the size of the index group can be adjusted by setting parameters). Each index group will have its own statistical information, so when querying data, you can filter out the index groups that do not need to be traversed in the stripe after filtering some stripes according to the query conditions, thereby further improving the query efficiency. Index Data is only the index information of the data. The real data information is stored in the Data Stream in the form of a stream through the ORC compression algorithm. Figure 2 As shown by the dotted line in the middle, when querying data, after determining the index information, the actual data is obtained from the Data Stream based on the index information.

[0050] Different from row-based storage, the column-based storage adopted by ORC can maintain the consistency of data format within its own storage unit, thereby greatly improving the compression ratio. At the same time, in the storage unit of column information, ORC will determine the degree of clustering of the current column information to decide whether to use dictionary encoding for further compression. These operations greatly save data storage space, and the multi-level index mode can greatly improve data query efficiency based on statistical information at all levels.

[0051] The embodiment of the present invention can locate the fields with high similarity among N fields of data, sort the data, thereby changing the data distribution, improving the similarity of data blocks, and improving the compression rate. In addition, the problem of ORC file expansion or incompressibility is solved.

[0052] Figure 3 This is a schematic diagram of traversing data according to query conditions in the ORC file structure. For example, if you query data using the following query conditions: where a>100or a<20, the traversed data is as follows Figure 3 As shown in the figure, the part with a cross does not need to be traversed, and the part without a cross is the data file that is traversed by the query. Among them, according to the file-level statistics of column a, we can know whether the file needs to be traversed, according to the Stripe statistics of column a, we can know which stripes do not need to be traversed, and according to the row-group statistics of column a, we can know which rows do not need to be traversed.

[0053] Based on the underlying structure of ORC described above, the following problems may be encountered in actual production: the same ORC table file, consistent data level, exactly the same number of fields, consistent storage information of each field, and ORC storage format, two tables with similar conditions in all aspects will differ by 4 times in storage level. In response to this situation, it was found through practice that the difference in data distribution caused the difference in storage and query efficiency of the two tables. If the degree of data clustering in each stripe of table A is much higher than that of table B, the degree of clustering of each column information is high, which will improve the degree of data compression. For example: the average storage occupied by 1000 data is 1B, and the detector finds that the storage occupied by the table is 10B, it is believed that the data distribution affects the data compression and causes expansion. Checking the 10B result table field can determine the number of each enumeration value of the field. The enumeration values ​​of a field are A\B\C. The program can easily capture the number of enumeration values ​​of A, B, and C. Assuming that there are 500 A, 200 B, and 300 C, the data distribution should keep the data with field value A together and the data with field value B together as much as possible, thereby eliminating the expansion caused by messy discrete data. Therefore, if the ORC file data distribution can be guaranteed to be orderly, the storage resources will be greatly increased.

[0054] Figure 4 It is a schematic diagram of the architecture of a method for processing data based on a column storage format in the prior art. Figure 5 is a schematic diagram of a method architecture for processing data based on a column storage format according to an embodiment of the present invention.

[0055] like Figure 4As shown, the processing logic of the prior art data is determined by the original data script, without considering the orderly distribution of the data. Based on the prior art, without changing the existing processing logic, the compression ratio of the generated file can be detected by the detector. If the compression ratio is lower than the set compression threshold, it is determined that there is file expansion, the compression is not effective, and then the subsequent reordering and rewriting operations are performed, such as Figure 5 shown.

[0056] In the method architecture for processing data based on a columnar storage format according to an embodiment of the present invention, the detector is used to record the ratio of file generation to compression. For example, before compression, the original file Orginal File is referred to as OrgFile, and after compression, the compressed file is referred to as ComFile. The function performed by the detector is to divide CompFile by OrgFile to obtain the Compress rate (the ratio of the size of the file after compression to the size before compression), referred to as ComRate. If the compression ratio is lower than the set compression threshold, it is judged that the compression is not effective. Among them, the compression threshold can be determined by the compression distribution of other orc tables, which can be simply understood as being determined according to the average compression rate of the orc format table. Taking the orc table used by the platform as a sample, the normal range of the compression rate of the overall orc table of the platform can be calculated by statistics. If the detector finds that the target table is out of range, it is considered that there is expansion. For example, if ComRate>=1, it proves that there is no compression at all, and even the file is swollen. Then it can be considered that there is a problem with the file sorting in ORC, and the sorting function is performed in the sorting engine stage.

[0057] The sorter is to re-sort the data results, which can be implemented through Hive's distribute by, sortby functions and join operations, and is best implemented through join operations. This is because when processing data, the method of selecting key values ​​through the association table can achieve the purpose of distributing data according to the corresponding key and ensuring the order of key values. This is a relatively ideal method, and its time cost is much lower than that of distribute by and sort by operations. First, there are often join operations in the data processing logic, and the cost of adding new joins is relatively low. Second, it is obviously more efficient to sort in a distributed manner on the map side and shuffle side than on the reduce side.

[0058] Take the following sku wide table as an example to illustrate the specific sorting process. For example, the sku wide table comes with a lot of product attribute information. The product attribute information of the same product is the same, as shown in Table 4 below:

[0059] Table 4

[0060]

[0061] If the sku data of the same product are distributed together, the clustering degree of multi-column data will be very high, which is conducive to data compression. Therefore, by distributing by product id, the product id can be hashed and bucketed, and the sku data of the same product id can be sent to the same reduce node for processing, thereby achieving the purpose of influencing data distribution. However, it is not enough to publish the sku data of the same product to one reduce node, because the number of sku of the same product may be large. If the sku data of the same product is divided into different stripes, it will obviously affect not only the stripe-level compression, but also the row-group-level compression within the stripe group.

[0062] Furthermore, on the basis of distribute by, we can add sort by operation to make the data sequence orderly, so as to control the distribution of data in stripe and achieve the effect of efficient distribution in the orange figure. In order to save storage space and improve query efficiency in data processing logic, the storage distribution and sequence of data are controlled. However, there is a high cost problem in controlling data distribution through distribute by sort by. The data processing process that could be completed in 1 hour can be completed in 1 hour and 45 minutes. In essence, time is exchanged for space, that is, time cost is consumed to organize data distribution and adjust data sequence, thereby saving space cost and time cost of future queries.

[0063] Generally, when performing data processing logic, it is often necessary to join different tables to obtain the required data information. When processing the join operation, MapReduce uses the join-key of the table as<key,value> The key value in the map task, the data with the same key will be sent to the same reduce node, and the iterator operation of different table data will be completed on the reduce node to realize the association of the tables.<key,value> The key values ​​in the shuffle are sorted to ensure that the key values ​​of each intermediate file written to the disk are in order. Before the shuffle process begins, the data parts with the same hash partition in each intermediate file will be merged, and merge sorting will be used to ensure that the key values ​​of the merged files are still in order. The Reduce node will fetch the corresponding partition data from each node through the shuffle process, and then merge the files from different nodes to ensure that the key values ​​are still in order. In the map phase, data will be sorted when it is written to the disk to ensure that the key values ​​are in order. When the map local files are merged by partition, the key values ​​will still be kept in order through merge sorting. After the shuffle process obtains the files of each map node, the key values ​​will still be kept in order when they are merged.

[0064] As can be seen above, the key value of the join operation can be used to control the data distribution of the data file, so that the data that is expected to be gathered together can be distributed together and kept in order. Therefore, both the distribute by sort by and join operations can control the data distribution, and the data with high similarity can be gathered together in an orderly manner as much as possible. Based on the above mapreduce principle, the timeliness of the join operation is higher than that of the distribute by sort by operation, and has better effects. In actual production, through join, it only took 10 minutes more to reduce the daily data volume of the MKT sku product wide table from 4T to 1T. At the same time, because the orderliness of the stripe and row-group indexes is guaranteed, the query efficiency of the downstream using the table is improved.

[0065] The re-engine of the method architecture for processing data based on the column storage format in the embodiment of the present invention rewrites the sorting result data to implement the sorting result determined by the sorter.

[0066] When using ORC as a storage structure, the distribution and sequence of data will have a great impact on the final file size and query efficiency. The data in the Hive ORC table is not generated out of thin air, but often stores the final results of a series of data processing logic. Different processing logics will result in different data distributions, resulting in different storage space and usage efficiency. Therefore, when processing data, you can locate the fields with high similarity among the N fields of the data and sort the data, thereby changing the data distribution, improving the similarity of the data block (stripe) data, and improving the compression rate. This solves the problem of file expansion or incompressibility.

[0067] Figure 6 is a schematic diagram of main modules of an apparatus for processing data based on a column storage format according to an embodiment of the present invention, such as Figure 6 As shown, the apparatus 600 for processing data based on a column storage format according to an embodiment of the present invention includes a receiving module 601 , a sorting module 602 and a logic processing module 603 .

[0068] The receiving module 601 is used to receive batch target data.

[0069] The sorting module 602 is used to determine the similarity between the batch target data according to the field information of the target data; and sort the batch target data according to the determined similarity. The sorting module is also used to analyze the field information of the target data, filter out multiple sorting fields from all the fields of the target data; and associate the field information of the multiple sorting fields of the target data to determine the similarity between the batch target data.

[0070] The logic processing module 603 is used to perform logic processing on the batch target data in a column storage format based on the sorting result. The logic processing module is also used to store the batch target data in a Hive data warehouse in a column storage format based on the sorting result; and / or the column storage format is an ORC file storage format.

[0071] The apparatus for processing data based on a column storage format according to an embodiment of the present invention further includes a detection module, which is used to determine the compression rate of the batch target data after logical processing; and to determine whether to reorder the batch target data according to the compression rate. If the detection module determines to reorder the batch target data, the sorting module determines the new similarity between the batch target data according to the field information of the target data; and sorts the batch target data according to the determined new similarity.

[0072] The embodiment of the present invention can locate the fields with high similarity among N fields of data, sort the data, thereby changing the data distribution, improving the similarity of data blocks, and improving the compression rate, thus solving the problem of file expansion or incompressibility.

[0073] Figure 7 An exemplary system architecture 700 is shown to which the method for processing data based on a column storage format or the apparatus for processing data based on a column storage format according to an embodiment of the present invention can be applied.

[0074] like Figure 7 As shown, system architecture 700 may include terminal devices 701, 702, 703, network 704 and server 705. Network 704 is used to provide a medium for communication links between terminal devices 701, 702, 703 and server 705. Network 704 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0075] Users can use terminal devices 701, 702, and 703 to interact with server 705 through network 704 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 701, 702, and 703, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).

[0076] The terminal devices 701 , 702 , and 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.

[0077] Server 705 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using terminal devices 701, 702, and 703. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results to the terminal device.

[0078] It should be noted that the method for processing data based on a column storage format provided in the embodiment of the present invention is generally executed by the server 705 , and accordingly, the device for processing data based on a column storage format is generally set in the server 705 .

[0079] It should be understood that Figure 7 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0080] Reference below Figure 8, which shows a schematic diagram of the structure of a computer system 800 of a terminal device suitable for implementing an embodiment of the present invention. Figure 8 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0081] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the system 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0082] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.

[0083] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above-mentioned functions defined in the system of the present invention are executed.

[0084] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0085] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0086] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor. For example, they may be described as: a processor includes an acquisition receiving module, a sorting module, and a logic processing module. The names of these modules do not constitute a limitation on the modules themselves in some cases. For example, the receiving module may also be described as a "module for receiving batch target data".

[0087] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: receiving batch target data; determining the similarity between batch target data according to the field information of the target data; and sorting the batch target data according to the determined similarity; and logically processing the batch target data according to the column storage format based on the sorting result.

[0088] The embodiment of the present invention can locate the fields with high similarity among N fields of data, sort the data, thereby changing the data distribution, improving the similarity of data blocks, and improving the compression rate. In addition, the problem of file expansion or incompressibility is solved.

[0089] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for processing data based on column storage format, It is characterized in that include: Receive batch target data; Analyze the field information of the target data, and select multiple sorting fields from all the fields of the target data; Associating the field information of the plurality of sorting fields of the target data to determine the similarity between the batches of target data; and, sorting the batch target data according to the determined similarity; Based on the sorting result, logically processing the batch target data in a column storage format; Determine the compression rate of the batch target data after logical processing; determine whether to re-sort the batch target data based on the compression rate; wherein the sorting is achieved through a join operation; if so, determine the new similarity between the batch target data based on the field information of the target data; and sort the batch target data based on the determined new similarity.

2. The method according to claim 1, It is characterized in that Based on the sorting result, the step of performing logical processing on the batch target data in a column storage format includes: based on the sorting result, storing the batch target data in a Hive data warehouse in a column storage format; and / or, The column storage format is an ORC file storage format.

3. A device for processing data based on a column storage format, It is characterized in that include: A receiving module, used for receiving batch target data; A sorting module, used for analyzing field information of target data and selecting a plurality of sorting fields from all fields of the target data; Associating the field information of the plurality of sorting fields of the target data to determine the similarity between the batches of target data; and, sorting the batch target data according to the determined similarity; A logic processing module, used for performing logic processing on the batch target data in a column storage format based on the sorting result; Determine the compression rate of the batch target data after logical processing; determine whether to re-sort the batch target data based on the compression rate; wherein the sorting is achieved through a join operation; if so, determine the new similarity between the batch target data based on the field information of the target data; and sort the batch target data based on the determined new similarity.

4. The device according to any one of claims 3, It is characterized in that The logic processing module is further configured to store the batch target data in a Hive data warehouse in a column storage format based on the sorting result; and / or, The column storage format is an ORC file storage format.

5. An electronic device, It is characterized in that include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1-2.

6. A computer readable medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 2 is implemented.