Data updating method and device for column storage files

By obtaining the target data information in the columnar storage file and updating the data, it solves the deficiencies of the data update mechanism in the columnar storage file and achieves efficient data update and maintenance of query performance.

CN113553335BActive Publication Date: 2024-10-18BUSINESS-INTELLIGENCE OF ORIENTAL NATIONS CORP LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202110846415.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-26
Publication Date
2024-10-18
Estimated Expiration
2041-07-26

AI Technical Summary

Technical Problem

In columnar storage files, the data update mechanism has not been effectively solved, which affects the data processing and query performance of analytical databases.

Method used

By obtaining the file name, number of columns, number of rows, and metadata information of the target data, data updates to columnar storage files are implemented, including modification or deletion operations, ensuring that updates do not affect query characteristics.

Benefits of technology

It realizes efficient data update of columnar storage files, maintains query performance, and meets the modification and deletion operation requirements in data processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113553335B_ABST
    Figure CN113553335B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for updating data of a column storage file, the method comprising: obtaining target data to be updated and data information of the target data; updating the target data according to the data information; wherein the data information at least includes the file name of the column storage file where the target data is located, the target file, the number of columns of the column storage file where the target data is located, the number of rows of the column storage file where the target data is located, and the metadata of the column storage file where the target data is located. The device is used to execute the above method. The present invention can update the data of the column storage file by utilizing the data information of the target data in the column storage file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a method and device for updating data of a column-type storage file. Background Art

[0002] In the era of big data, a common analytical query scenario often involves calculating the aggregate value of a certain attribute, such as the average height of a region, the average age of all people, etc. Columnar storage usually stores the same attribute values ​​of different data together, and only traverses the required data during query, which is more suitable for analytical scenarios. Therefore, analytical databases often use columnar storage file formats for data storage.

[0003] Batch storage and batch analysis are the basic capabilities of analytical databases. In this process, the ability to read and write data files is the basic function of analytical databases. The column storage file format is based on the idea of ​​storing and querying by column and is the best choice in this scenario.

[0004] In actual application scenarios, data update is also an indispensable part of data processing. How to realize data update based on column storage is a problem that needs to be solved urgently. Summary of the invention

[0005] The data updating method of the column storage file provided by the present invention is used to overcome the above-mentioned problems existing in the prior art. By utilizing the data information of the target data in the column storage file, the data of the column storage file can be updated.

[0006] The present invention provides a data updating method for a column-type storage file, comprising:

[0007] Acquire target data to be updated and data information of the target data;

[0008] According to the data information, the target data is updated;

[0009] Among them, the data information includes at least the file name of the column storage file where the target data is located, the target file, the number of columns of the column storage file where the target data is located, the number of rows of the column storage file where the target data is located, and the metadata of the column storage file where the target data is located.

[0010] According to a data updating method for a column storage file provided by the present invention, updating the target data according to the data information includes:

[0011] modifying the target data according to the data information; or

[0012] The target data is deleted according to the data information.

[0013] According to a data updating method for a column storage file provided by the present invention, modifying the target data according to the data information includes:

[0014] According to the data information, obtaining column data of a preset column;

[0015] Modifying the target data in the first preset row of the column data in the first preset column;

[0016] Modifying the metadata of the first preset column, and writing the modified metadata and the column data of the updated column storage file into the first target file;

[0017] The preset column is determined according to the number of columns of the column storage file where the target data is located;

[0018] The first preset row is determined according to the number of rows of the column storage file where the target data is located;

[0019] The target files include the first target file.

[0020] According to a data updating method of a column storage file provided by the present invention, the modifying the metadata of the first preset column includes:

[0021] The valid file path of the metadata of the first preset column is modified to the file name of the first target file.

[0022] According to a data updating method for a column-type storage file provided by the present invention, the file name of the first target file includes:

[0023] Version number.

[0024] According to a data updating method for a column storage file provided by the present invention, deleting the target data according to the data information includes:

[0025] Determine a bit array of a target number of rows according to the data information;

[0026] Modifying the bit values ​​of the bit array in the second preset row to preset bit values ​​to modify the bit array;

[0027] Saving the modified bit array into the metadata to modify the metadata;

[0028] Writing the modified metadata into a second target file;

[0029] Wherein, the target number of rows is determined according to the total number of data rows of the column storage file;

[0030] The second preset row is determined according to the number of rows of the column storage file where the target data is located;

[0031] The target files include the second target file.

[0032] The present invention also provides a data updating device for column storage files, a data acquisition module and a data updating module;

[0033] The data acquisition module is used to acquire the target data to be updated and the data information of the target data;

[0034] The data updating module is used to update the target data according to the data information;

[0035] Among them, the data information includes at least the file name of the column storage file where the target data is located, the target file, the number of columns of the column storage file where the target data is located, the number of rows of the column storage file where the target data is located, and the metadata of the column storage file where the target data is located.

[0036] According to a data updating device for a column-type storage file provided by the present invention, the data updating module is further used for:

[0037] modifying the target data according to the data information; or

[0038] The target data is deleted according to the data information.

[0039] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the data updating method of the column storage file as described above are implemented.

[0040] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the data update method of the column storage file as described in any one of the above are implemented.

[0041] The data updating method and device of the column storage file provided by the present invention can update the data of the column storage file by utilizing the data information of the target data in the column storage file. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0043] Figure 1 It is a flow chart of a data updating method of a column storage file provided by the present invention;

[0044] Figure 2 It is a structural schematic diagram of a data updating device for column-type storage files provided by the present invention;

[0045] Figure 3 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0047] The data update method of the column storage file provided by the present invention performs batch update and deletion operations on the data through column file storage after batch data loading. The file formats involved in the scheme are all column storage, and the query characteristics of the column storage data as a whole are not affected after the update. The specific implementation is as follows:

[0048] Figure 1 is a flow chart of a data updating method for a column storage file provided by the present invention, such as Figure 1 As shown, the method includes:

[0049] S1. Obtain target data to be updated and data information of the target data;

[0050] S2. Update the target data according to the data information;

[0051] The data information includes at least the file name of the column storage file where the target data is located, the target file, the number of columns of the column storage file where the target data is located, the number of rows of the column storage file where the target data is located, and the metadata of the column storage file where the target data is located.

[0052] It should be noted that the execution subject of the above method can be an electronic device, a component in an electronic device, an integrated circuit, or a chip. The electronic device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., and the present invention does not make specific limitations.

[0053] Optionally, prepare the target data to be updated and the data information corresponding to the target data, wherein the data information of the target data to be updated may specifically include the file name of the column storage file where the target data is located, the target file, the number of columns of the column storage file where the target data is located, the number of rows of the column storage file where the target data is located, and the metadata of the column storage file where the target data is located. Metadata: also known as intermediary data or relay data, is data describing data (data about data), mainly information describing data properties (property), used to support functions such as indicating storage location, historical data, resource search, and file records.

[0054] According to the data information of the target data, the target data in the column storage file is updated. For example, the target data may be modified or deleted to implement the data update of the column storage file.

[0055] The data updating method of the column storage file provided by the present invention can update the data of the column storage file by utilizing the data information of the target data in the column storage file.

[0056] Furthermore, in one embodiment, step S2 may specifically include:

[0057] S21. modify the target data according to the data information; or

[0058] S22. Delete the target data according to the data information.

[0059] Optionally, based on the obtained data information of the target data to be updated, the target data in the column storage file is modified to new data, or based on the obtained data information of the target data to be updated, the target data is deleted from the column storage file to update the target data in the column storage file.

[0060] The data updating method of the column storage file provided by the present invention realizes the updating of the column storage file by modifying or deleting the target data in the column storage file by utilizing the data information of the target data.

[0061] Furthermore, in one embodiment, step S21 may specifically include:

[0062] S211, acquiring column data of a preset column according to the data information;

[0063] S212, modifying the target data of the first preset row in the column data of the first preset column;

[0064] S213, modifying the metadata of the first preset column, and writing the modified metadata and the column data of the updated column storage file into the first target file;

[0065] The preset columns are determined according to the number of columns of the column storage file where the target data is located;

[0066] The first preset row is determined according to the number of rows of the column storage file where the target data is located;

[0067] The target files include the first target file.

[0068] Optionally, according to the obtained data information of the target data to be updated, the target data in the column storage file is modified to new data, as follows:

[0069] Assume the file name DpId (for example, base_file_v1) of the column storage file where the target data is located, the file name New_Dp_Id (for example, update_file_v2) of the first target file to be saved after the target data is modified, the number of columns SlotId (for example, C2) of the column storage file where the target data is located, the number of rows RowId of the target data in the column storage file, and the metadata md of the column storage file where the data is located.

[0070] According to the column number SlotId of the column storage file where the target data is located, the preset column is also SlotId, the column data of the SlotId column is read, and the target data of the first preset row in the column data of the SlotId column is modified, where the first preset row is determined according to the number of rows of the column storage file where the target data is located. Assuming that the target data has the number of rows RowId in the column storage file, the first preset row is also RowId.

[0071] The metadata of the SlotId-th column is modified, and the modified metadata and the column data of the updated column storage file are written into the first target file.

[0072] The data updating method of the column storage file provided by the present invention modifies the metadata corresponding to the column data of the column where the target data is located, so as to realize batch data updating of the column storage file.

[0073] Furthermore, in one embodiment, step S213 may specifically include:

[0074] S2131. Modify the valid file path of the metadata of the first preset column to the file name of the first target file.

[0075] Optionally, the metadata of the SlotId column is modified, and the modified metadata and the column data of the updated column storage file are written to the first target file. Specifically, the valid file path file_path of the metadata of the SlotId column is modified to the file name New_Dp_Id of the first target file.

[0076] In actual applications, when modifying the target data, the effective file path of the column data of the column number in the column storage file where the target data is located, such as file_path_v1 (in file_path_vn, n is the version number of the file generation operation), can be modified. A new first target file file_path_v2 will be generated each time the data is modified. During the first modification, the updated data of the column with updated data is saved, and the effective file path of the column with updated data in the metadata is saved as file_path_v2, and the effective file path of the column with no data update in the metadata is saved as file_path_v1. The effective file path of the column with updated data in the metadata will be modified later, and the version number of the effective file path of the column with updated data in the metadata will be updated.

[0077] The data updating method of the column storage file provided by the present invention ensures that the query performance of the column storage file is better and meets the modification operation requirements in data processing.

[0078] Furthermore, in one embodiment, the file name of the first target file may specifically include:

[0079] Version number.

[0080] Optionally, the effective file path of the metadata of the preset column is modified to the file name of the first target file, wherein the file name includes a version number, and the version number is used to distinguish between columns with data update and columns without data update. Assuming that the file names of the data columns (C1, C2 and C3) of the column storage file are base_file_v1, update_file_v2 and base_file_v1 respectively, as shown in Table 1, it can be determined that the data in the C2 column has an update operation.

[0081] Table 1

[0082] Data Columns A valid file path to the data C1 base_file_v1 C2 update_file_v2 C3 base_file_v1

[0083] When reading data in this way, the valid file path update_file_v2 of the latest version is read through the version number after the file name of the first target file, and the location of the latest data of each data column can be found through the valid file path of each data column in the metadata, and the data can be read by column.

[0084] The data updating method of the column storage file provided by the present invention improves the query rate of the updated data column by appending a version number after the valid file path of the updated data column.

[0085] Further, in one embodiment, step S22 may specifically include:

[0086] S221, determining a bit array of a target number of rows according to the data information;

[0087] S222, modifying the bit values ​​of the bit array of the second preset row to preset bit values, so as to modify the bit array;

[0088] S223, saving the modified bit array into metadata to modify the metadata;

[0089] S224, writing the modified metadata into the second target file;

[0090] The target number of rows is determined based on the total number of data rows in the column storage file;

[0091] The second preset row is determined according to the number of rows of the column storage file where the target data is located;

[0092] The target files include the second target file.

[0093] Optionally, prepare the target data to be deleted, assuming the file name DpId (such as base_file_v1) of the column storage file where the target data is located, the file name New_Dp_Id (for example, delete_file_v2) of the second target file to be saved after the target data is modified, the number of rows RowId of the target data in the column storage file, and the metadata md of the column storage file where the data is located.

[0094] A bit array DeleteBv of the target number of rows is created according to the above data information, wherein the target number of rows is determined according to the total number of data rows in the columnar storage file. DeleteBv is stored in the form of a bit array, and the number of valid rows of the current file is identified by the correspondence between the subscript and the bit value. The initial bit values ​​of the bit array are all set to 0.

[0095] Modify the bit value of the bit array of the second preset row to a preset bit value (for example, 1), wherein the second preset row is determined based on the number of rows of the column storage file where the target data is located. Assuming that the number of rows of the column storage file where the target data is located is RowId, the second preset row is also RowId.

[0096] The modified DeleteBv is saved in the metadata md, and other data in the metadata md remains unchanged, and is written to the second target file of the file, such as delete_file_v2, and the deletion operation is completed.

[0097] For example, when deleting data in the file file_path_v2, a new data file (i.e., the second target file) file_path_v3 is generated, the metadata of file_path_v2 is read, and a bit array DeleteBV identifying valid rows is added thereto. The bit value of the row where the target data is located in the bit array DeleteBV is 1. After updating DeleteBV, the metadata is stored in the file file_path_v3.

[0098] When reading data, the latest version of the file file_path_v3 is read, and the location of the latest data in each column is found through the valid file path of each column in the metadata. The deleted rows (i.e. rows with a bit value of 1) are skipped through DeleteBV in the metadata to read valid data. Specifically:

[0099] Assume that the data columns of the column storage file after deleting the target data and their corresponding valid file paths are shown in Table 2:

[0100] Table 2

[0101] Data Columns A valid file path to the data C1 base_file_v1 C2 base_file_v1 C3 base_file_v1

[0102] Find the file with the largest version number in the valid file path of the data (assuming it is delete_file_v2) by the version number after the file name of the second target file;

[0103] Read the metadata of the column storage file and obtain the valid file path of each column of data in the column storage file.

[0104] The number of valid rows of the column storage file (that is, the number of rows with a bit value of 1 in DeleteBv) is obtained through DeleteBv in the metadata.

[0105] Find the file where the column data is located through the valid file path, read the column storage file by column, and remove the data marked as 1 in DeleteBv.

[0106] The data updating method of the column storage file provided by the present invention ensures that the query performance of the column storage file is better and meets the deletion operation requirements in data processing.

[0107] The following is a description of a data updating device for a column storage file provided by the present invention. The data updating device for a column storage file described below and the data updating method for a column storage file described above can be referenced to each other.

[0108] Figure 2 is a schematic diagram of the structure of the data updating device for column storage files provided by the present invention, such as Figure 2 As shown, it includes: a data acquisition module 210 and a data update module 211;

[0109] The data acquisition module 210 is used to acquire the target data to be updated and the data information of the target data;

[0110] The data updating module 211 is used to update the target data according to the data information;

[0111] The data information includes at least the file name of the column storage file where the target data is located, the target file, the number of columns of the column storage file where the target data is located, the number of rows of the column storage file where the target data is located, and the metadata of the column storage file where the target data is located.

[0112] The data updating device for a column-type storage file provided by the present invention can update the data of the column-type storage file by utilizing the data information of the target data in the column-type storage file.

[0113] Furthermore, in one embodiment, the data updating module 211 may also be specifically used for:

[0114] Modify the target data according to the data information; or

[0115] Delete the target data according to the data information.

[0116] The data updating device for a column storage file provided by the present invention realizes the updating of the column storage file by modifying or deleting the target data in the column storage file by utilizing the data information of the target data.

[0117] Figure 3 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 3 As shown, the electronic device may include: a processor 310, a communication interface 311, a memory 312 and a bus 313, wherein the processor 310, the communication interface 311 and the memory 312 communicate with each other through the bus 313. The processor 310 may call the logic instructions in the memory 312 to execute the following method:

[0118] Obtain target data to be updated and data information of the target data;

[0119] Update the target data according to the data information;

[0120] The data information includes at least the file name of the column storage file where the target data is located, the target file, the number of columns of the column storage file where the target data is located, the number of rows of the column storage file where the target data is located, and the metadata of the column storage file where the target data is located.

[0121] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0122] Furthermore, the present invention discloses a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, and when the program instructions are executed by a computer, the computer can execute the data update method of the column storage file provided by the above-mentioned method embodiments, for example, comprising:

[0123] Obtain target data to be updated and data information of the target data;

[0124] Update the target data according to the data information;

[0125] The data information includes at least the file name of the column storage file where the target data is located, the target file, the number of columns of the column storage file where the target data is located, the number of rows of the column storage file where the target data is located, and the metadata of the column storage file where the target data is located.

[0126] On the other hand, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the data update method of the column storage file provided in the above embodiments, for example, including:

[0127] Obtain target data to be updated and data information of the target data;

[0128] Update the target data according to the data information;

[0129] The data information includes at least the file name of the column storage file where the target data is located, the target file, the number of columns of the column storage file where the target data is located, the number of rows of the column storage file where the target data is located, and the metadata of the column storage file where the target data is located.

[0130] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0131] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0132] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A data update method for column storage files, It is characterized in that include: Acquire target data to be updated and data information of the target data; According to the data information, the target data is updated; The data information includes at least the file name of the column storage file where the target data is located, the target file, the number of columns of the column storage file where the target data is located, the number of rows of the column storage file where the target data is located, and metadata of the column storage file where the target data is located; Wherein, updating the target data according to the data information includes: Modify the target data according to the data information; Wherein, modifying the target data according to the data information includes: According to the data information, obtaining column data of a preset column; Modifying the target data of the first preset row in the column data of the first preset column; Modifying the metadata of the first preset column, and writing the modified metadata and the column data of the updated column storage file into the first target file; The preset column is determined according to the number of columns of the column storage file where the target data is located; The first preset row is determined according to the number of rows of the column storage file where the target data is located; The target file includes the first target file; Wherein, updating the target data according to the data information includes: Deleting the target data according to the data information; Wherein, deleting the target data according to the data information includes: Determine a bit array of a target number of rows according to the data information; Modifying the bit values ​​of the bit array of the second preset row to preset bit values ​​to modify the bit array; Saving the modified bit array into the metadata to modify the metadata; Writing the modified metadata into a second target file; Wherein, the target number of rows is determined according to the total number of data rows of the column storage file; The second preset row is determined according to the number of rows of the column storage file where the target data is located; The target files include the second target file.

2. The data updating method of the column storage file according to claim 1, It is characterized in that The modifying the metadata of the first preset column includes: The valid file path of the metadata of the first preset column is modified to the file name of the first target file.

3. The data updating method of the column storage file according to claim 2, It is characterized in that The file name of the first target file includes: Version number.

4. A data updating device for column storage files, It is characterized in that include: Data acquisition module and data update module; The data acquisition module is used to acquire the target data to be updated and the data information of the target data; The data updating module is used to update the target data according to the data information; The data information includes at least the file name of the column storage file where the target data is located, the target file, the number of columns of the column storage file where the target data is located, the number of rows of the column storage file where the target data is located, and metadata of the column storage file where the target data is located; The data updating module is specifically used for: According to the data information, modify the target data; wherein, according to the data information, modifying the target data includes: according to the data information, acquiring column data of a preset column; Modifying the target data of the first preset row in the column data of the first preset column; Modifying the metadata of the first preset column, and writing the modified metadata and the column data of the updated column storage file into the first target file; The preset column is determined according to the number of columns of the column storage file where the target data is located; The first preset row is determined according to the number of rows of the column storage file where the target data is located; The target file includes the first target file; The data updating module is further specifically used for: Deleting the target data according to the data information; wherein deleting the target data according to the data information includes: Determine a bit array of a target number of rows according to the data information; Modifying the bit values ​​of the bit array of the second preset row to preset bit values ​​to modify the bit array; Saving the modified bit array into the metadata to modify the metadata; Writing the modified metadata into a second target file; Wherein, the target number of rows is determined according to the total number of data rows of the column storage file; The second preset row is determined according to the number of rows of the column storage file where the target data is located; The target files include the second target file.

5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the steps of the method for updating data of a column-based storage file as described in any one of claims 1 to 3 are implemented.

6. A non-transitory computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method for updating data of a column-based storage file as described in any one of claims 1 to 3 are implemented.

Citation Information

Patent Citations

  • Local updating software-based data processing method and apparatus

    CN105956123A

  • Data storage method and device

    CN107545021A

  • Column-storage-based data update method and device, server, and storage medium

    CN108959587A