A data change method, device, equipment and computer readable storage medium

By distinguishing whether file blocks need to change data in the data lake table format component, only the file blocks that need to be changed are processed one by one, and the unchanged file blocks are copied in their entirety, which solves the problem of low data change efficiency in the existing technology and achieves Efficient reading and writing performance.

CN113821485BActive Publication Date: 2024-10-11SANGFOR TECH INC
View PDF 11 Cites 0 Cited by

Patent Information

Application Number
CN202111138801.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-27
Publication Date
2024-10-11
Estimated Expiration
2041-09-27

AI Technical Summary

Technical Problem

When the data changes in the existing data lake table format component, the COW solution is used, which causes the entire file data to be read and processed, which greatly reduces the reading and writing efficiency, especially in the column storage format, the queues during reading and writing Conversion further impacts efficiency.

Method used

By judging whether the data in the file block needs to be changed, only the file blocks that need to be changed are read and written one by one, and the unchanged file blocks are copied as a whole block, and the data change granularity is subdivided to the file block level to avoid unnecessary striping. Reading and row-column conversion.

Benefits of technology

Significantly improves the efficiency of reading and writing data changes, especially in column storage formats, reducing processing time and increasing overall data processing speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113821485B_ABST
    Figure CN113821485B_ABST
Patent Text Reader

Abstract

The present application discloses a data change method, device, electronic device and computer-readable storage medium, the method comprising: for any file block in a first file, determining whether the file block needs to change data; if the file block needs to change data, writing the data read out in strips therefrom into the file block at the corresponding position in the second file after data change; if the file block does not need to change data, copying the data of the file block as a whole to the file block at the corresponding position in the second file. The present application distinguishes whether each file block in a file needs to change data, and then subdivides the granularity of data change from the file level to the file block level, effectively avoiding unnecessary stripe reading of data, and greatly improving the read and write efficiency of data change.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of big data technology, and in particular to a data change method, device, electronic device and computer-readable storage medium. Background Art

[0002] With the development of big data technology, a big data table-based component for data lakes has emerged in recent years - data lake table-based component. It can provide batch and stream integration, data changes (update and delete), time travel and other functions. Among them, the most representative components are DeltaLake, Apache Iceberg, Apache Hudi, etc.

[0003] In the data lake table-based components, there are two main ways to change data (update or delete): COW and MOR. Currently, whether it is Apache Iceberg, Apache Hudi, or DeltaLake, the COW implementation scheme is generally that as long as a file has data that needs to be changed, all the data in the entire data file is read out one by one, and then the data is updated or deleted before being written into a new file.

[0004] Since this solution will read out all the data of the file and process it one by one, that is, all the data must be processed once, which greatly reduces the reading and writing efficiency. In particular, when the stored file format is a column storage format, there is a column-to-row conversion process when reading, and a row-to-column conversion process when writing. Obviously, the reading and writing efficiency of such files will be greatly affected when they are processed according to the traditional COW solution.

[0005] In view of this, providing a solution to the above-mentioned technical problems has become an urgent concern for those skilled in the art. Summary of the invention

[0006] The purpose of this application is to provide a method, device, electronic device and computer-readable storage medium for changing data in a data lake table-based component, so as to effectively improve the reading and writing efficiency during the data change process.

[0007] In order to solve the above technical problems, on the one hand, the present application discloses a data modification method, comprising:

[0008] For any file block in the first file, determine whether data of the file block needs to be changed;

[0009] If the file block needs to change data, the data read out from it in strips is written into the file block at the corresponding position in the second file after the data is changed;

[0010] If the data of the file block does not need to be changed, the data of the file block is copied in its entirety to the file block at the corresponding position in the second file.

[0011] Optionally, the first file is a column storage file; and the data read out from the first file in a row is written into a file block at a corresponding position in the second file after data modification, including:

[0012] Through row-column transformation, data read from the file block by column is changed, and the data is written by column into the file block at the corresponding position in the second file.

[0013] Optionally, the step of performing data change on the data read from the file block by column through row-column transformation and writing the data by column into the file block at the corresponding position in the second file includes:

[0014] Extracting data columns from the file block as a row element by column to perform column-to-row transformation;

[0015] Performing data change processing on the data in the row element;

[0016] After all data columns in the file block are processed, each changed row element is transformed from row to column, so as to be written into the file block at the corresponding position in the second file by column.

[0017] Optionally, the first file is a line-type storage file; and the data read out in rows from the first file is written into a file block at a corresponding position in the second file after data modification, including:

[0018] The data read out from the file block row by row is changed, and the data is written into the file block at the corresponding position in the second file row by row.

[0019] Optionally, the step of changing the data read from the file block row by row and writing the data into the file block at the corresponding position in the second file row by row includes:

[0020] Taking out data rows from the file block as a row element;

[0021] Performing data change processing on the data in the row element;

[0022] After all the data rows in the file block are processed, the changed row elements are written row by row into the file block at the corresponding position in the second file.

[0023] Optionally, before determining, for any file block in the first file, whether the file block needs to change data, the method further includes:

[0024] Determine the target data that needs to be changed according to the data change instruction;

[0025] The file where the target data is located is determined as the first file.

[0026] Optionally, after determining that the file where the target data is located is the first file and before determining, for any file block in the first file, whether the file block needs to change data, the method further includes:

[0027] Determine the row number corresponding to the target data in the first file;

[0028] Identify the file block corresponding to the line number as a file block that needs data change, and generate a record file;

[0029] The step of determining, for any file block in the first file, whether data of the file block needs to be changed includes:

[0030] For any file block in the first file, performing a matching search in the record file;

[0031] If the match is successful, it is determined that the file block needs to change data;

[0032] If the match fails, it is determined that the file block does not need to change data.

[0033] In another aspect, the present application discloses a data changing device, comprising:

[0034] A judgment module, used for judging, for any file block in the first file, whether the file block needs to change data;

[0035] A change module, used for writing the data read out from the file block in accordance with the stripe into the file block at the corresponding position in the second file after the data is changed when the data of the file block needs to be changed;

[0036] The copy module is used to copy the data of the file block as a whole to the file block at the corresponding position in the second file when the data of the file block does not need to be changed.

[0037] Optionally, the first file is a column storage file; when the change module writes the data read out from the first file in a row into a file block at a corresponding position in the second file after data change, the change module is specifically used to:

[0038] Through row-column transformation, data read from the file block by column is changed, and the data is written by column into the file block at the corresponding position in the second file.

[0039] Optionally, when the changing module performs data change on the data read from the file block by column through row-column transformation and writes the data by column into the file block at the corresponding position in the second file, the changing module is specifically configured to:

[0040] A data column is taken out from the file block as a row element by column, and a column-to-row transformation is performed; data in the row element is subjected to data change processing; after all data columns in the file block are processed, each changed row element is subjected to a row-to-column transformation, so as to be written into a file block at a corresponding position in the second file by column.

[0041] Optionally, the first file is a line-type storage file; when the change module writes the data read out in rows into the file block at the corresponding position in the second file after the data change, it is specifically used to:

[0042] The data read out from the file block row by row is changed, and the data is written into the file block at the corresponding position in the second file row by row.

[0043] Optionally, when the changing module changes the data read from the file block by line and writes the data by line into the file block at the corresponding position in the second file, it is specifically configured to:

[0044] The data rows are taken out from the file block as a row element; data change processing is performed on the data in the row element; after all the data rows in the file block are processed, the changed row elements are written into the file block at the corresponding position in the second file.

[0045] Optionally, it also includes:

[0046] The determination module is used to determine the target data that needs to be changed according to the data change instruction before the judgment module determines whether the file block needs to change data for any file block in the first file; and determine the file where the target data is located as the first file.

[0047] Optionally, the determining module is further used for:

[0048] After determining that the file where the target data is located is the first file, before the judgment module determines, for any file block in the first file, whether the file block needs to change data, the line number corresponding to the target data in the first file is determined; the file block corresponding to the line number is identified as a file block that needs to be changed data, and a record file is generated;

[0049] When the judgment module judges whether data of any file block in the first file needs to be changed, the judgment module is specifically used to:

[0050] For any file block in the first file, a matching search is performed in the record file; if the match is successful, it is determined that the file block needs to change data; if the match fails, it is determined that the file block does not need to change data.

[0051] In another aspect, the present application also discloses an electronic device, comprising:

[0052] Memory for storing computer programs;

[0053] A processor is used to execute the computer program to implement the steps of any one of the data change methods described above.

[0054] On the other hand, the present application further discloses a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it is used to implement the steps of any one of the data change methods described above.

[0055] The data change method, device, electronic device and computer-readable storage medium provided by the present application have the following beneficial effects: the present application distinguishes whether data needs to be changed for each file block in a file, and then subdivides the granularity of data changes from the file level to the file block level, thereby effectively avoiding unnecessary striped data reading processes and greatly improving the reading and writing efficiency of data changes. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] In order to more clearly illustrate the technical solutions in the prior art and the embodiments of the present application, the drawings required for use in the description of the prior art and the embodiments of the present application are briefly introduced below. Of course, the drawings described below in relation to the embodiments of the present application are only part of the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without creative work, and the obtained other drawings also belong to the protection scope of the present application.

[0057] Figure 1 A schematic diagram of a data modification method in the prior art;

[0058] Figure 2 A flowchart of a data modification method disclosed in an embodiment of the present application;

[0059] Figure 3 A schematic diagram of a data modification method disclosed in an embodiment of the present application;

[0060] Figure 4 A structural block diagram of a data changing device disclosed in an embodiment of the present application;

[0061] Figure 5 This is a structural block diagram of an electronic device disclosed in an embodiment of the present application. DETAILED DESCRIPTION

[0062] The core of this application is to provide a data change method, device, electronic device and computer-readable storage medium to effectively improve the reading and writing efficiency during the data change process.

[0063] In order to describe the technical solutions in the embodiments of the present application more clearly and completely, the technical solutions in the embodiments of the present application will be introduced below in conjunction with the drawings in the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0064] With the development of big data technology, a big data table-based component for data lakes has emerged in recent years - data lake table-based component. It can provide batch and stream integration, data changes (update and delete), time travel and other functions. Among them, the most representative components are DeltaLake, Apache Iceberg, Apache Hudi, etc.

[0065] In the data lake table-based component, data changes (updates or deletions) mainly include COW (Copy-On-Write) and MOR (Merge-On-Read). COW means that when data is changed, the original data to be modified and the changed data are merged and processed and written to a new data file, thereby avoiding the merging overhead when reading data. MOR means that when data is changed, the changed data is written to a new file without being merged with the original data to be modified.

[0066] Currently, whether it is Apache Iceberg, Apache Hudi, or DeltaLake, the COW implementation scheme is generally that as long as a file has data that needs to be changed, all the data in the entire data file will be read out one by one, and then written into a new file after the data is updated or deleted.

[0067] Since this solution reads all the data in the file and processes them one by one, that is, all the data must be processed once, which greatly reduces the reading and writing efficiency. In particular, when the stored file format is a column storage format (such as ORC file format or Parquet file format), there is a column-to-row conversion process when reading, and a row-to-column conversion process when writing. Figure 1 shown.

[0068] Specifically, in files using column storage formats such as ORC or Parquet, table data is generally cut horizontally into multiple file blocks, namely Blocks (a Block can be called a Stripe), and each file block is cut vertically into multiple file strips, namely Columns, by column. A table can include multiple ORC files, and an ORC file generally contains multiple Blocks. For files with this structure, when COW is performed according to the traditional solution, the Columns need to be read out and changed one by one. Obviously, when such files are processed according to the traditional COW solution, the read and write efficiency will be greatly affected. In view of this, the present application provides a data change solution in a data lake table format component, which can effectively solve the above problems.

[0069] See also Figure 2 As shown, the embodiment of the present application discloses a data modification method, which mainly includes:

[0070] S101: for any file block in the first file, determine whether the file block needs to change data; if so, proceed to S102; if not, proceed to S103.

[0071] S102: writing the data read out piece by piece into a file block at a corresponding position in the second file after data modification.

[0072] S103: Copy the data of the file block in its entirety to a file block at a corresponding position in the second file.

[0073] It is easy to understand that after a file block of the first file is processed through the above steps S101-S103, the processing in the above steps can be automatically performed on the next file block until all file blocks in the first file are processed.

[0074] It should be pointed out that the data change method provided by the present application can be specifically applied to the data lake table format component. Among them, the first file, that is, the file that needs to change the data, can be called the "original file"; the second file, that is, the file generated after the data change in the MOR manner, can be called the "new file". It should be emphasized that in the process of data change, the present application specifically identifies whether each file block in the first file, that is, Block, needs to change the data, thereby subdividing the granularity of data changes from the file level to the file block level.

[0075] Specifically, when the data that needs to be changed only involves certain data blocks in the first file, the present application will only extract data one by one and make changes to these data blocks according to the traditional implementation scheme; and for file blocks that do not involve data changes, the present application will no longer process them by strip, but read and write the entire block into the second file. In this way, for these data blocks that do not require data changes, the present application effectively reduces the intermediate stripe reading process, which can greatly improve the reading and writing efficiency.

[0076] For details, please refer to Figure 3 A schematic diagram of a data change method is shown in FIG. Figure 3 In the example, it is assumed that the first file contains three blocks, among which only Block 1 needs to change data, while Block 2 and Block 3 do not need to change data.

[0077] In this way, the present application only reads out the data in Block1 of the first file one by one to perform the corresponding data change processing, and then writes the changed data of Block1 into Block1 of the second file. As for Block2 and Block3 of the first file, the present application does not need to process them one by one, but reads them as a whole block and writes them into Block2 and Block3 of the second file respectively. In this way, the data of Block2 and Block3 will be directly copied and written into the second file as a whole block, which greatly shortens the data processing time and improves the data reading and writing efficiency.

[0078] It can be seen that the data change method in the data lake table format component provided by the present application, by distinguishing whether each file block in the file needs to change the data, and then subdividing the granularity of the data change from the file level to the file block level, effectively avoids unnecessary striped data reading process and greatly improves the reading and writing efficiency of data changes.

[0079] As a specific embodiment, the data change method in the data lake table format component provided in the embodiment of the present application is based on the above content, the first file is a column storage file; the data read out by row from it is written into the file block at the corresponding position in the second file after the data is changed, including:

[0080] Through row-column transformation, data read from the file block by column is changed, and the data is written by column into the file block at the corresponding position in the second file.

[0081] It should be noted that in these column storage files, data is stored in columns, so there is a process of converting columns to rows when reading data, and there is a process of converting rows to columns when writing data. Obviously, these row-column conversions will consume a certain amount of processing time. However, this application not only saves the process of reading and processing data one by one, but also saves the process of converting rows to columns by copying the file blocks that do not involve data changes to the second file, which can greatly improve the efficiency of data change processing.

[0082] For example, for a 128MB ORC file, the amount of data is nearly 4 million, and it is divided into 4 blocks. If the data that needs to be changed only involves one of the blocks, this application only needs to read and change the 1 / 4 of the data one by one, and the other 3 / 4 of the data can be read and written as a whole block without row and column conversion. In this way, this application can save up to 3 / 4 of the processing time for this file.

[0083] In fact, in big data application scenarios, a table may include hundreds or even thousands of ORC files. If each file can save data processing time, the overall data reading and writing efficiency will be greatly improved. The data change task that originally took several hours to complete can be completed in just tens of minutes through the technical solution of this application, achieving a very significant speed improvement.

[0084] As a specific embodiment, the data change method in the data lake table format component provided in the embodiment of the present application is based on the above content, and the data read from the file block by column is changed by row and column transformation, and the file block at the corresponding position in the second file is written by column, including:

[0085] Take out data columns from the file block as a row element and perform column-to-row transformation;

[0086] Perform data change processing on the data in the row elements;

[0087] After all data columns in the file block are processed, each changed row element is converted from row to column, so as to be written into the file block at the corresponding position in the second file by column.

[0088] For details, please refer to Figure 3 . Figure 3 The first file in the data change process shown is a file in a columnar storage format, such as an ORC or Parquet file format. Figure 3Block 1 is a data block involving data changes. After extracting each piece of data, that is, each data column, the present application can convert the rows and columns and change the data, and then write the columns into Block 1 of the second file. For Block and Block 3, the present application directly copies and writes the entire block.

[0089] As a specific embodiment, the data change method in the data lake table format component provided in the embodiment of the present application is based on the above content, the first file is a line storage file; the data read out in rows is written into the file block at the corresponding position in the second file after the data is changed, including:

[0090] The data read out from the file block row by row is changed, and the data is written into the file block at the corresponding position in the second file row by row.

[0091] It is easy to understand that for files in a row storage format, the present application reads out the data in the file block involving data changes row by row, and then writes the data into the second file after completing the data change processing.

[0092] As a specific embodiment, the data change method in the data lake table format component provided in the embodiment of the present application is based on the above content, and the data read from the file block by row is changed, and the file block at the corresponding position in the second file is written by row, including:

[0093] Writing the data read out piece by piece into the file block at the corresponding position of the second file after data modification, including:

[0094] Take out the data row from the file block as a row element;

[0095] Perform data change processing on the data in the row elements;

[0096] After all the data rows in the file block are processed, the changed row elements are written row by row into the file block at the corresponding position in the second file.

[0097] As a specific embodiment, the data change method in the data lake table format component provided in the embodiment of the present application is based on the above content, and before judging whether the file block in any file block in the first file needs to change data, it also includes:

[0098] Determine the target data that needs to be changed according to the data change instruction;

[0099] The file where the target data is located is determined as the first file.

[0100] Specifically, in the data lake table format component, operations can be performed through relevant instructions. After the user enters the data change instruction, the target data that needs to be changed (including modification or deletion) can be determined according to the data change instruction. Since a table may usually contain hundreds or thousands of files, it is possible to retrieve the files containing the target data, and these files are the first files that need to change the data.

[0101] As a specific embodiment, the data change method in the data lake table format component provided in the embodiment of the present application is based on the above content, and after determining that the file where the target data is located is the first file and before judging whether the file block in any file block in the first file needs to change data, further includes:

[0102] Determine the row number corresponding to the target data in the first file;

[0103] Identify the file block corresponding to the line number as the file block that needs data change, and generate a record file;

[0104] For any file block in the first file, determining whether the file block needs to change data includes:

[0105] For any file block in the first file, performing a matching search in the record file;

[0106] If the match is successful, it is determined that the file block needs to change data;

[0107] If the match fails, it is determined that the file block does not need to change data.

[0108] Specifically, in order to facilitate determining whether each file block in the first file needs to change data, the present application first searches for and determines the row number where the target data is located for each first file, and then determines the file block where the target data is located based on the row number, and then stores the file block information in the record file. In this way, whenever it is necessary to determine whether a file block needs to change data, the present application only needs to perform a matching search in the record file. If the match is successful, it means that the file block contains the target data and needs to be changed; otherwise, the opposite is true.

[0109] It should also be noted that data operations in general data lake table-format components are performed in the form of opening tasks. Therefore, when the number of file blocks in the first file is large, in order to improve the efficiency of data change processing, the present application can also selectively open multiple tasks to process the first file at the same time. For example, if there are 4 file blocks involving data changes in a first file, two tasks can be opened at the same time, and each task processes 2 of the file blocks respectively. Those skilled in the art can choose and set them according to actual application requirements, and this application does not limit this.

[0110] See also Figure 4 As shown, the embodiment of the present application discloses a data change device in a data lake table format component, which mainly includes:

[0111] The judging module 201 is used to judge whether data of any file block in the first file needs to be changed;

[0112] The changing module 202 is used to write the data read out from the file block into the file block at the corresponding position in the second file after the data is changed when the data of the file block needs to be changed;

[0113] The copy module 203 is used to copy the data of the file block as a whole to the file block at the corresponding position in the second file when the data of the file block does not need to be changed.

[0114] It can be seen that the data change device in the data lake table format component disclosed in the embodiment of the present application distinguishes whether each file block in the file needs to change data, and then subdivides the granularity of data changes from the file level to the file block level, thereby effectively avoiding unnecessary striped data reading process and greatly improving the reading and writing efficiency of data changes.

[0115] For the specific content of the data changing device in the above-mentioned data lake table-based component, please refer to the above-mentioned detailed introduction of the data changing method in the data lake table-based component, which will not be repeated here.

[0116] As a specific embodiment, the data change device in the data lake table format component disclosed in the embodiment of the present application is based on the above content, and the first file is a column storage file; when the change module 202 writes the data read out by the file into the file block at the corresponding position in the second file after the data is changed, it is specifically used to:

[0117] Through row-column transformation, data read from the file block by column is changed, and the data is written by column into the file block at the corresponding position in the second file.

[0118] Optionally, when the changing module 202 performs data change on the data read from the file block by column through row-column transformation and writes the data by column into the file block at the corresponding position in the second file, it is specifically configured to:

[0119] A data column is taken out from the file block as a row element by column, and a column-to-row transformation is performed; data in the row element is subjected to data change processing; after all data columns in the file block are processed, each changed row element is subjected to a row-to-column transformation, so as to be written into a file block at a corresponding position in the second file by column.

[0120] As a specific embodiment, the data change device in the data lake table format component disclosed in the embodiment of the present application is based on the above content, and the first file is a row storage file; when the change module 202 writes the data read out by row into the file block at the corresponding position in the second file after the data is changed, it is specifically used to:

[0121] The data read out from the file block row by row is changed, and the data is written into the file block at the corresponding position in the second file row by row.

[0122] Optionally, when the changing module 202 changes the data read from the file block by line and writes the data by line into the file block at the corresponding position in the second file, it is specifically configured to:

[0123] The data rows are taken out from the file block as a row element; the data in the row element is processed; after all the data rows in the file block are processed, the changed row elements are written into the file block at the corresponding position in the second file.

[0124] As a specific embodiment, the data change device in the data lake table format component disclosed in the embodiment of the present application further includes:

[0125] The determination module is used to determine the target data that needs to be changed according to the data change instruction before the judgment module 201 determines whether the file block needs to change data for any file block in the first file; and determine the file where the target data is located as the first file.

[0126] As a specific embodiment, the data change device in the data lake table format component disclosed in the embodiment of the present application is based on the above content, and the determination module is also used to:

[0127] After determining that the file where the target data is located is the first file, before the judgment module 201 determines whether the file block needs to change data for any file block in the first file, the line number corresponding to the target data in the first file is determined; the file block corresponding to the line number is identified as a file block that needs to be changed, and a record file is generated;

[0128] When judging whether data of any file block in the first file needs to be changed, the judging module 201 is specifically used to:

[0129] For any file block in the first file, a matching search is performed in the record file; if the match is successful, it is determined that the file block needs to change data; if the match fails, it is determined that the file block does not need to change data.

[0130] See also Figure 5As shown, the embodiment of the present application discloses an electronic device, including:

[0131] Memory 301, used for storing computer programs;

[0132] The processor 302 is used to execute the computer program to implement the steps of any one of the data modification methods described above.

[0133] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, it is used to implement the steps of any one of the data change methods described above.

[0134] For specific contents of the above-mentioned electronic device and computer-readable storage medium, please refer to the detailed introduction of the data change method in the data lake table format component, which will not be repeated here.

[0135] In this application, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0136] It should also be noted that, in this application document, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. In addition, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0137] The technical solution provided by the present application is described in detail above. The principle and implementation method of the present application are described in detail using specific examples herein, and the description of the above embodiments is only used to help understand the method and core idea of ​​the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the present application.

Claims

1. A data modification method, characterized in that: include: For any file block in the first file, determine whether data of the file block needs to be changed; If the file block needs to change data, the data read out from it in strips is written into the file block at the corresponding position in the second file after the data is changed; If the data of the file block does not need to be changed, copying the data of the file block as a whole to the file block at the corresponding position in the second file; Before determining whether data of any file block in the first file needs to be changed, the method further includes: Determine the row number corresponding to the target data to be changed in the first file; Identify the file block corresponding to the line number as a file block that needs data change, and generate a record file; The step of determining, for any file block in the first file, whether data of the file block needs to be changed includes: For any file block in the first file, performing a matching search in the record file; If the match is successful, it is determined that the file block needs to change data; If the match fails, it is determined that the file block does not need to change data.

2. The method according to claim 1, characterized in that: The first file is a column storage file; the data read out from the first file in a row is written into a file block at a corresponding position in the second file after data modification, including: Through row-column transformation, data read from the file block by column is changed, and the data is written by column into the file block at the corresponding position in the second file.

3. The method according to claim 2, characterized in that The step of performing data change on the data read from the file block by column through row-column transformation and writing the data by column into the file block at the corresponding position in the second file includes: Extracting data columns from the file block as a row element by column to perform column-to-row transformation; Performing data change processing on the data in the row element; After all data columns in the file block are processed, each changed row element is transformed from row to column, so as to be written into the file block at the corresponding position in the second file by column.

4. The method according to claim 1, characterized in that: The first file is a line-type storage file; the data read out from the first file in rows is written into the file block at the corresponding position in the second file after the data is changed, including: The data read out from the file block row by row is changed, and the data is written into the file block at the corresponding position in the second file row by row.

5. The method according to claim 4, characterized in that The step of changing the data read from the file block by line and writing the data by line into the file block at the corresponding position in the second file includes: Taking out data rows from the file block as a row element; Performing data change processing on the data in the row element; After all the data rows in the file block are processed, the changed row elements are written row by row into the file block at the corresponding position in the second file.

6. The method according to any one of claims 1 to 5, characterized in that: Before determining, for any file block in the first file, whether the file block needs to change data, the method further includes: Determine the target data that needs to be changed according to the data change instruction; The file where the target data is located is determined as the first file.

7. A data changing device, characterized in that: include: A determination module, used to determine the line number corresponding to the target data to be changed in the first file; Identify the file block corresponding to the line number as the file block that needs data change, and generate a record file; A judgment module, for judging, for any file block in the first file, whether the file block needs to change data; specifically, for any file block in the first file, performing a matching search in the record file; if the match succeeds, it is judged that the file block needs to change data; if the match fails, it is judged that the file block does not need to change data; A change module, used for writing the data read out from the file block in accordance with the stripe into the file block at the corresponding position in the second file after the data is changed when the data of the file block needs to be changed; The copy module is used to copy the data of the file block as a whole to the file block at the corresponding position in the second file when the data of the file block does not need to be changed.

8. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute the computer program to implement the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it is used to implement the steps of the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Data block comparison based data updating method

    CN101770515A

  • Data backup method of distributed file system

    CN103761162A

  • Big data platform-based data processing method and device

    CN110618988A

  • Data updating method and device

    CN110874181A

  • Data read-write method, device and equipment of cluster file system and storage medium

    CN111737221A