A data processing method and device
By obtaining offline data warehouse data, data lake metadata and file metadata are generated, and directly converted into data lake files, which solves the problem of converting historical data into data lake format, avoids the problem of high resource consumption, and achieves efficient data conversion. .
Patent Information
- Application Number
- CN202210514764.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-12
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2042-05-12
AI Technical Summary
Existing technology is difficult to efficiently convert historical data in offline data warehouses into data lake format, and the process of re-encoding and compression after decoding and decompression consumes a large amount of computing resources and has poor applicability.
By obtaining historical data in the offline data warehouse, data lake metadata is generated, data lake data is obtained based on historical data and metadata, file metadata is generated, and finally the data lake file is obtained, avoiding the decoding and decompression operations of historical data. Convert directly to data lake format.
While consuming less resources, the historical data in the offline data warehouse is converted into data lake files in the data lake format, which improves resource utilization efficiency and reduces the cost of data conversion.
Smart Images

Figure CN114911809B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data processing method and device. Background Art
[0002] Data warehouses can be used to store data, and offline data warehouses are a type of data warehouse. At present, compared with traditional offline data warehouse technology, data lake technology provides more capabilities, such as more fine-grained data updates and deletions, and higher data timeliness. Therefore, data lake technology is increasingly being used.
[0003] In the process of promoting data lake technology, it is necessary to convert historical data in offline data warehouses into data in data lake format. How to convert the historical data into data in data lake format is an urgent problem to be solved. Summary of the invention
[0004] The technical problem to be solved by this application is how to convert historical data in an offline data warehouse into data in a data lake format, and to provide a data processing method and device.
[0005] In a first aspect, an embodiment of the present application provides a data processing method, the method comprising:
[0006] Obtaining historical data in an offline data warehouse, where the historical data is encoded and / or compressed data;
[0007] Generate at least one column of data lake metadata;
[0008] Based on the historical data and the data lake metadata, data lake data is obtained, where the data lake data includes the historical data and the data lake metadata;
[0009] Generate file metadata of the data lake data, and obtain a data lake file according to the data lake data and the file metadata.
[0010] Optionally, obtaining a data lake file according to the data lake data and the file metadata includes:
[0011] In response to the column cluster configuration not being enabled, a data lake file is obtained according to the data lake data and the file metadata, wherein the column cluster configuration is used to indicate that a data lake file is generated according to a life cycle of a field, and the data lake file includes the data lake data and the file metadata.
[0012] Optionally, obtaining the data lake file according to the data lake data and the file metadata includes:
[0013] In response to the column cluster configuration being enabled, obtaining the lifecycle of each field of the data lake data, wherein the column cluster configuration is used to indicate generating a data lake file according to the lifecycle of the field;
[0014] According to the life cycle of each field of the data lake data, multiple data lake files are obtained, wherein the data corresponding to the fields with the same life cycle are stored in the same data lake file, and the data corresponding to the fields with different life cycles are stored in different data lake files, and the multiple data lake files include a first data lake file, and the first data lake file includes: data lake data corresponding to a first period of life cycle, and file metadata of the first data lake file.
[0015] Optionally, the at least one column of data lake metadata is stored in a separate data lake file.
[0016] Optionally, the historical data is data stored in a native Parquet format; and the data lake file includes data stored in a Parquet format of Hudi.
[0017] Optionally, the data lake metadata is Hudi metadata, and the file metadata is Parquet metadata.
[0018] In a second aspect, an embodiment of the present application provides a data processing device, the device comprising:
[0019] A first acquisition unit is used to acquire historical data in an offline data warehouse, where the historical data is encoded and / or compressed data;
[0020] A first generating unit, configured to generate at least one column of data lake metadata;
[0021] A second acquisition unit, configured to obtain data lake data based on the historical data and the data lake metadata, where the data lake data includes the historical data and the data lake metadata;
[0022] A second generating unit, configured to generate file metadata of the data lake data;
[0023] The third acquisition unit is used to obtain the data lake file according to the data lake data and the file metadata.
[0024] Optionally, the third acquiring unit is used to:
[0025] In response to the column cluster configuration not being enabled, a data lake file is obtained according to the data lake data and the file metadata, wherein the column cluster configuration is used to indicate that a data lake file is generated according to a life cycle of a field, and the data lake file includes the data lake data and the file metadata.
[0026] Optionally, the third acquiring unit is used to:
[0027] In response to the column cluster configuration being enabled, obtaining the lifecycle of each field of the data lake data, wherein the column cluster configuration is used to indicate generating a data lake file according to the lifecycle of the field;
[0028] According to the life cycle of each field of the data lake data, multiple data lake files are obtained, wherein the data corresponding to the fields with the same life cycle are stored in the same data lake file, and the data corresponding to the fields with different life cycles are stored in different data lake files, and the multiple data lake files include a first data lake file, and the first data lake file includes: data lake data corresponding to a first period of life cycle, and file metadata of the first data lake file.
[0029] Optionally, the at least one column of data lake metadata is stored in a separate data lake file.
[0030] Optionally, the historical data is data stored in a native Parquet format; and the data lake file includes data stored in a Parquet format of Hudi.
[0031] Optionally, the data lake metadata is Hudi metadata, and the file metadata is Parquet metadata.
[0032] In a third aspect, an embodiment of the present application provides a device, the device comprising a processor and a memory;
[0033] The processor is configured to execute instructions stored in the memory, so that the device performs the method as described in any one of the first aspects above.
[0034] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, comprising instructions, wherein the instructions instruct a device to execute a method as described in any one of the above first aspects.
[0035] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when executed on a computer, enables the computer to execute any of the methods described in the first aspect above.
[0036] Compared with the prior art, the embodiments of the present application have the following advantages:
[0037] An embodiment of the present application provides a data processing method, and in one example, the method can be executed by a server. The server can obtain historical data in an offline data warehouse, and the historical data is encoded and / or compressed data. Then, at least one column of data lake metadata is generated, and further based on the data lake metadata and the historical data, data lake data including the historical data and the data lake metadata is obtained. After obtaining the data lake data, the file metadata can be generated, and a data lake file can be obtained based on the file metadata and the data lake data. It can be seen that in an embodiment of the present application, when converting historical data in an offline data warehouse into a data lake file in a data lake format, there is no need to decode and re-encode the historical data, nor is there a need to decompress and compress the historical data, so that the resources consumed by converting the historical data into a data lake file in a data lake format are less. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 A flowchart of a data processing method provided in an embodiment of the present application;
[0040] Figure 2 A schematic diagram of a data processing method provided in an embodiment of the present application;
[0041] Figure 3 A schematic diagram of another data processing method provided in an embodiment of the present application;
[0042] Figure 4 A schematic diagram of the structure of a data processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0044] The inventor of this application has found through research that currently, offline data warehouses can support multiple data storage formats. For example, offline data warehouses can support native Parquet format data storage. With the development of data lake technology, it is necessary to convert historical data in offline data warehouses into data in data lake format. For example, in one scenario, it is necessary to convert data stored in native Parquet format into data stored in Parquet format based on data lake technology. The data lake technologies mentioned here include but are not limited to Hudi, IceBerg and DeltaLake.
[0045] In one example, data stored in native Parquet format can be read from an offline data warehouse, decompressed and uncompressed, and then the decompressed and decoded data can be rewritten into the offline data warehouse in Parquet format using data lake technology. In the process of rewriting the decompressed and decoded data into the offline data warehouse in Parquet format using data lake technology, the data needs to be re-encoded and compressed.
[0046] The aforementioned process of decompressing, decoding, encoding and compressing data requires a lot of computing resources. Therefore, the applicability of this solution is not very good. Therefore, there is an urgent need for a solution that can convert historical data in the offline data warehouse into data in the data lake format while consuming less resources.
[0047] In order to solve the above problems, an embodiment of the present application provides a data processing method and device.
[0048] Various non-limiting implementations of the present application are described in detail below in conjunction with the accompanying drawings.
[0049] Exemplary Methods
[0050] See also Figure 1 , which is a flow chart of a data processing method provided in an embodiment of the present application. In this embodiment, the method may be executed by a server, for example. In an example, the method may include the following steps: S101-S104.
[0051] S101: Acquire historical data in an offline data warehouse, where the historical data is encoded and / or compressed data.
[0052] The historical data mentioned here refers to data stored in a format supported by traditional offline data warehouses. In one example, the historical data may be data stored in native Parquet format. The historical data submitted here refers to data obtained after encoding and / or compressing valid data in the data table. The historical data does not include other data such as metadata added when the data in the data table is stored in a format supported by traditional offline data warehouses.
[0053] In the embodiment of the present application, even if the historical data is compressed data, the historical data is not decompressed. In addition, even if the historical data is encoded data, the historical data is not decoded.
[0054] In an example, the historical data may include multiple columns of data, where one column corresponds to one field. In other words, the historical data may include data corresponding to multiple fields.
[0055] S102: Generate at least one column of data lake metadata.
[0056] In the embodiment of the present application, the at least one column of data lake metadata may be generated based on the metadata generation rule corresponding to the data lake technology. The metadata generation rule corresponding to the data technology is not described in detail here.
[0057] The data lake technology is not specifically limited in the embodiment of the present application. In one example, the data lake technology may be hudi. In this case, the data lake source file is Hudi metadata.
[0058] S103: Obtain data lake data based on the historical data and the data lake metadata, where the data lake data includes the historical data and the data lake metadata.
[0059] After the data lake metadata is generated, the data lake data can be obtained based on the historical data and the data lake metadata. The data lake data may include the historical data and the data lake metadata. In one example, the data lake data adds at least one column of data lake metadata on the basis of the historical data. For example, the historical data includes M columns of data, and the data lake data includes (M+N) columns of data, the first M columns of data of the (M+N) columns of data are the historical data, and the last N columns of data of the (M+N) columns of data are the data lake metadata.
[0060] S104: Generate file metadata of the data lake data, and obtain a data lake file according to the data lake data and the file metadata.
[0061] In one example, the file metadata is metadata corresponding to the data storage format used by the data lake data. In one example, the data storage format used by the data lake data may be Parquet format. In this case, the file metadata may be Parquet metadata. In this case, the data lake file includes data stored in Hudi's Parquet format. In other words, in this case, the solution of the embodiment of the present application can be used to convert data stored in native Parquet format into data stored in Hudi's Parquet format.
[0062] In one example, considering that the data lake data includes multiple columns of data, and the life cycles of the multiple columns of data may be different, for example, the life cycles corresponding to the various fields of the historical data may be set by the user, and the user may set the life cycles corresponding to the various fields to different values.
[0063] When the life cycle of a field or several fields of the historical data ends, these fields need to be deleted from the offline data warehouse. At present, if the data lake data is stored in a data lake file, the current data deletion method requires reading the data in the entire data lake file, and then rewriting the data that does not need to be deleted to achieve data deletion. This data deletion method requires a large number of data reading and data writing operations, which consumes a lot of resources.
[0064] To avoid this problem, when generating a data lake file, you can choose whether to enable the column cluster configuration. The so-called column cluster configuration is used to indicate that a data lake file is generated according to the life cycle of a field. Specifically, the column cluster configuration is used to indicate that the data corresponding to fields with the same life cycle are stored in the same data lake file, and the data corresponding to fields with different life cycles are stored in different data lake files.
[0065] In one example, if the column cluster configuration is not enabled, then in S104, in response to the column cluster configuration not being enabled, the server may obtain a data lake file according to the data lake data and the file metadata. In other words, if the column cluster configuration is not enabled, the historical data is stored in a data lake file, and at this time, the data lake file may include the data lake data and the file metadata.
[0066] Regarding the method for generating the file metadata, the traditional method for generating file metadata may be used, and no detailed description is given here. For example, when the file metadata is Parquet metadata, the traditional method for generating Parquet metadata may be used to generate the file metadata.
[0067] In another example, if the column cluster configuration is enabled, then in the specific implementation of S104, the server can obtain the life cycle of each field of the data lake data in response to the column cluster configuration being enabled, and then obtain multiple data lake files according to the life cycle of each field of the data lake data. In this case, the server can generate file metadata corresponding to each data lake file, and then obtain the data lake file based on the file metadata corresponding to each data lake file and other data corresponding to each data lake file.
[0068] As mentioned above, the data lake data includes the historical data and at least one column of data lake metadata. Among them, the life cycle of each field of the historical data can be preset by the user. The life cycle of the data lake metadata can be a default value, which is generally set to a relatively large value. Alternatively, the life cycle of the data lake metadata can be the same as the life cycle of the field with the longest life cycle in the historical data. For example, the historical data includes 6 columns, the life cycle of the 1st, 2nd and 3rd columns is 60 days, the life cycle of the 4th and 5th columns is 30 days, and the life cycle of the 6th column is 10 days. Then the life cycle of the data lake metadata can be 30 days.
[0069] In the specific implementation of "obtaining multiple data lake files according to the life cycle of each field of the data lake data", the data corresponding to the fields with the same life cycle can be stored in the same data lake file, and the data corresponding to the fields with different life cycles can be stored in different data lake files. For example, one life cycle corresponds to one data lake file. For the convenience of description, any one of the multiple data lake files is called a "first data lake file", and the life cycle corresponding to the first data lake file is the first cycle. When generating the first data lake file, the first data lake file can be obtained based on the data of the field with a life cycle of the first cycle and the file metadata of the first data lake file. In other words, the first data lake file includes the data lake data corresponding to the life cycle of the first cycle and the file metadata of the first data lake file.
[0070] Regarding the method for generating the file metadata of the first data lake file, the traditional file metadata generation method can be used, and no detailed description is given here. For example, when the file metadata is Parquet metadata, the traditional Parquet metadata generation method can be used to generate the file metadata.
[0071] In one example, in order to distinguish the historical data from the data lake metadata, if the column cluster configuration is turned on, the at least one column of data lake metadata can be stored in a separate data lake file. For example, the historical data includes 6 columns, the life cycle of the 1st column, the 2nd column and the 3rd column is 60 days, the life cycle of the 4th column and the 5th column is 30 days, and the life cycle of the 6th column is 10 days. Based on the data lake data, 4 data lake files can be obtained, namely, data lake file 1 including the 1st column, the 2nd column and the 3rd column, data lake file 2 including the 4th column and the 5th column, data lake file 3 including the 6th column, and data lake file 4 including the data lake metadata.
[0072] In order to facilitate the understanding of the solution of the embodiment of the present application, Figure 2 and Figure 3 Provide explanation. Figure 2 A schematic diagram of a data processing method provided in an embodiment of the present application.
[0073] like Figure 2 As shown, when the column cluster configuration is not enabled, you can Figure 2 Then, at least one column of data lake metadata is generated (corresponding to Figure 2 Furthermore, based on the historical data, the data lake metadata, and the Parquet metadata, a data lake Parquet file is obtained.
[0074] Among them, in the newly obtained data lake Parquet file, the data that needs to be regenerated only includes the shaded column blocks in the figure, and the resources consumed for generating the shaded column blocks are far less than the resources consumed for decompressing, decoding, encoding and compressing the historical data.
[0075] like Figure 3 As shown, when the column cluster configuration is turned on, you can Figure 3 Column blocks in the traditional data warehouse Parquet file), generate at least one column of data lake metadata (corresponding to Figure 3 In the data lake metadata column block, further, based on the life cycle of historical data, the column blocks A and B with the same life cycle are stored in the data lake Parquet file 1, the column block X is stored in the data lake Parquet file 2, and the data lake metadata column block is stored in the data lake Parquet file 3. The data lake Parquet file 1 also includes its corresponding Parquet metadata, the data lake Parquet file 2 also includes its corresponding Parquet metadata, and the data lake Parquet file 3 also includes its corresponding Parquet metadata.
[0076] and Figure 2 The situation shown is similar to Figure 3 In the scenario shown, the data that needs to be regenerated in the three newly obtained data lake Parquet files only include the shaded column blocks in the figure, and the resources consumed for generating the shaded column blocks are far less than the resources consumed for decompressing, decoding, encoding, and compressing the historical data.
[0077] about Figure 2 and Figure 3 The RowGroup and column chunk shown are concepts in traditional Parquet and will not be described in detail this time.
[0078] Exemplary Devices
[0079] Based on the method provided in the above embodiment, the embodiment of the present application further provides a device, which is described below in conjunction with the accompanying drawings.
[0080] See also Figure 4 , Figure 4 The schematic diagram of the structure of a data processing device provided in an embodiment of the present application is as follows: the device 400 may specifically include: a first acquisition unit 401, a first generation unit 402, a second acquisition unit 403, a second generation unit 404 and a third acquisition unit 405.
[0081] A first acquisition unit 401 is used to acquire historical data in an offline data warehouse, where the historical data is encoded and / or compressed data;
[0082] A first generating unit 402 is used to generate at least one column of data lake metadata;
[0083] A second acquisition unit 403 is used to obtain data lake data based on the historical data and the data lake metadata, where the data lake data includes the historical data and the data lake metadata;
[0084] A second generating unit 404 is used to generate file metadata of the data lake data;
[0085] The third acquisition unit 405 is used to obtain a data lake file according to the data lake data and the file metadata.
[0086] Optionally, the third obtaining unit 405 is configured to:
[0087] In response to the column cluster configuration not being enabled, a data lake file is obtained according to the data lake data and the file metadata, wherein the column cluster configuration is used to indicate that a data lake file is generated according to a life cycle of a field, and the data lake file includes the data lake data and the file metadata.
[0088] Optionally, the third obtaining unit 405 is configured to:
[0089] In response to the column cluster configuration being enabled, obtaining the lifecycle of each field of the data lake data, wherein the column cluster configuration is used to indicate generating a data lake file according to the lifecycle of the field;
[0090] According to the life cycle of each field of the data lake data, multiple data lake files are obtained, wherein the data corresponding to the fields with the same life cycle are stored in the same data lake file, and the data corresponding to the fields with different life cycles are stored in different data lake files, and the multiple data lake files include a first data lake file, and the first data lake file includes: data lake data corresponding to a first period of life cycle, and file metadata of the first data lake file.
[0091] Optionally, the at least one column of data lake metadata is stored in a separate data lake file.
[0092] Optionally, the historical data is data stored in a native Parquet format; and the data lake file includes data stored in a Parquet format of Hudi.
[0093] Optionally, the data lake metadata is Hudi metadata, and the file metadata is Parquet metadata.
[0094] Since the device 400 is a device corresponding to the method provided in the above method embodiment, the specific implementation of each unit of the device 400 is based on the same concept as the above method embodiment. Therefore, for the specific implementation of each unit of the device 400, reference can be made to the description part of the above method embodiment, which will not be repeated here.
[0095] The embodiment of the present application also provides a device, the device comprising a processor and a memory;
[0096] The processor is used to execute the instructions stored in the memory, so that the device executes the data processing method provided by the above method embodiment.
[0097] An embodiment of the present application provides a computer-readable storage medium, including instructions, wherein the instructions instruct a device to execute the data processing method provided by the above method embodiment.
[0098] The embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the data processing method provided by the above method embodiment.
[0099] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0100] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
[0101] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A data processing method, characterized in that: The method comprises: Obtaining historical data in an offline data warehouse, where the historical data is encoded and / or compressed data; Generate at least one column of data lake metadata; Based on the historical data and the data lake metadata, data lake data is obtained, where the data lake data includes the historical data and the data lake metadata; Generate file metadata of the data lake data, and obtain a data lake file according to the data lake data and the file metadata; The step of obtaining a data lake file according to the data lake data and the file metadata includes: In response to the column cluster configuration being enabled, obtaining the lifecycle of each field of the data lake data, wherein the column cluster configuration is used to indicate generating a data lake file according to the lifecycle of the field; According to the life cycle of each field of the data lake data, multiple data lake files are obtained, wherein the data corresponding to the fields with the same life cycle are stored in the same data lake file, and the data corresponding to the fields with different life cycles are stored in different data lake files, and the multiple data lake files include a first data lake file, and the first data lake file includes: data lake data corresponding to a first period of life cycle, and file metadata of the first data lake file.
2. The method according to claim 1, characterized in that The step of obtaining a data lake file according to the data lake data and the file metadata includes: In response to the column cluster configuration not being enabled, a data lake file is obtained according to the data lake data and the file metadata, wherein the data lake file includes the data lake data and the file metadata.
3. The method according to claim 1, characterized in that The at least one column of data lake metadata is stored in a separate data lake file.
4. The method according to any one of claims 1 to 3, characterized in that: The historical data is data stored in the native Parquet format; the data lake file includes data stored in the Parquet format of Hudi.
5. The method according to claim 4, characterized in that The data lake metadata is Hudi metadata, and the file metadata is Parquet metadata.
6. A data processing device, characterized in that: The device comprises: A first acquisition unit is used to acquire historical data in an offline data warehouse, where the historical data is encoded and / or compressed data; A first generating unit, configured to generate at least one column of data lake metadata; A second acquisition unit, configured to obtain data lake data based on the historical data and the data lake metadata, where the data lake data includes the historical data and the data lake metadata; A second generating unit, configured to generate file metadata of the data lake data; A third acquisition unit, configured to obtain a data lake file according to the data lake data and the file metadata; The third acquisition unit is specifically used for: In response to the column cluster configuration being enabled, obtaining the lifecycle of each field of the data lake data, wherein the column cluster configuration is used to indicate generating a data lake file according to the lifecycle of the field; According to the life cycle of each field of the data lake data, multiple data lake files are obtained, wherein the data corresponding to the fields with the same life cycle are stored in the same data lake file, and the data corresponding to the fields with different life cycles are stored in different data lake files, and the multiple data lake files include a first data lake file, and the first data lake file includes: data lake data corresponding to a first period of life cycle, and file metadata of the first data lake file.
7. An electronic device, characterized in that: The electronic device comprises a processor and a memory; The processor is configured to execute instructions stored in the memory, so that the electronic device executes the method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The method comprises instructions for instructing a device to execute the method according to any one of claims 1 to 5.
