Data processing method and device
By determining the corresponding relationship between data processing tasks and data tables, searching for traceability results layer by layer and updating links, the problem of low data processing efficiency in the business system is solved, and link optimization and efficiency improvement are achieved.
Patent Information
- Application Number
- CN202410659309.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-24
- Publication Date
- 2024-09-17
AI Technical Summary
In the database of the business system, business variables are derived from complex logic or processed through long links, resulting in low data processing efficiency.
By determining the corresponding relationship between data processing tasks and data tables, the traceability results of variables are searched layer by layer, and the data processing links are updated to reduce the complexity of the data processing links and improve data processing efficiency.
The data processing link is optimized, the data processing efficiency is improved, the link complexity is reduced, and the data output efficiency is improved.
Smart Images

Figure CN118656369A
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data processing method and device. Background Art
[0002] In the database of the business system, there are often many business variables that are processed based on internal and external data sources. These business variables may be derived through complex logic or processed through long links. For example, Figure 1 As shown, the 100 business variables of the business system's database are derived from the databases of eight data processing nodes upstream of the business, of which 25 business variables have processing links of up to eight layers. This data processing link is relatively lengthy and complex, and can easily lead to low data processing efficiency. Summary of the invention
[0003] The embodiments of the present application provide a data processing method and device to optimize the data processing link and improve the data processing efficiency.
[0004] In order to solve the above technical problems, this application is implemented as follows:
[0005] In a first aspect, an embodiment of the present application provides a data processing method. The method includes:
[0006] Determine a first correspondence between a data processing task and a first data table, and a second correspondence between the data processing task and a second data table, wherein the first data table represents a data table output by executing the data processing task, and the second data table represents a data table referenced by executing the data processing task;
[0007] Determine a source tracing result corresponding to each field of the third data table based on the first corresponding relationship and the second corresponding relationship, wherein the source tracing result includes a source table and a source field in the source table;
[0008] Based on the tracing results corresponding to the fields of the third data table, the data processing link is updated, wherein the data tables output by the data processing tasks of the data processing link are all referenced by the third data table.
[0009] In a second aspect, an embodiment of the present application further provides a data processing device. The data processing device includes:
[0010] A first determining module is used to determine a first corresponding relationship between a data processing task and a first data table, and a second corresponding relationship between the data processing task and a second data table, wherein the first data table represents a data table output by executing the data processing task, and the second data table represents a data table referenced by executing the data processing task;
[0011] A second determining module, configured to determine a tracing result corresponding to each field of a third data table based on the first corresponding relationship and the second corresponding relationship, wherein the tracing result includes a source table and a source field in the source table;
[0012] An update module is used to update a data processing link based on the tracing results corresponding to each field of the third data table, wherein the data tables output by each data processing task of the data processing link are all referenced by the third data table.
[0013] In a third aspect, an embodiment of the present application further provides a data processing device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the above-mentioned data processing method when executed by the processor.
[0014] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned data processing method are implemented.
[0015] In a fifth aspect, an embodiment of the present application further provides a computer program product, which is stored in a storage medium and implements the steps of the above-mentioned data processing method when the computer program product is executed by at least one processor.
[0016] In an embodiment of the present application, by determining a first correspondence between a data processing task and a first data table, and a second correspondence between the data processing task and the second data table, the traceability results corresponding to each field of the third data table are determined based on the first correspondence and the second correspondence, and based on the traceability results corresponding to each field of the third data table, the data processing link is updated, and the data tables output by each data processing task of the data processing link are all referenced by the third data table, that is, the data processing link is a data processing link located upstream of the third data table, which is conducive to reducing the complexity of the data processing link, and thus is conducive to improving data processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0018] Figure 1 It is a schematic diagram that the variables provided in the embodiment of the present application are derived from each layer of the upstream data processing link;
[0019] Figure 2 is a flow chart of a data processing method provided in an embodiment of the present application;
[0020] Figure 3 It is a schematic diagram of each level reference table of the layer-by-layer search variable data table provided in an embodiment of the present application;
[0021] Figure 4 is a schematic diagram of a horizontal table view of a package provided in an embodiment of the present application;
[0022] Figure 5 It is a link compression schematic diagram of the splicing assembly scenario provided in an embodiment of the present application;
[0023] Figure 6 It is a schematic diagram of link compression in a layered stripping scenario provided in an embodiment of the present application;
[0024] Figure 7 is a schematic diagram of a Spark execution plan provided in an embodiment of the present application;
[0025] Figure 8 is a structural diagram of a data processing device provided in an embodiment of the present application;
[0026] Fig. 9 It is a structural diagram of another data processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are 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.
[0028] For ease of understanding, some contents involved in the embodiments of the present application are described below:
[0029] Data model: also called table or data table, is an abstraction of data features. It describes the static features, dynamic behaviors and constraints of the system from an abstract level, and provides an abstract framework for information representation and operation of the database system. The content described by the data model consists of three parts, namely data structure, data operation and data constraint. The data model of the embodiment of the present application mainly refers to the public stable data table in the data warehouse.
[0030] Data assets: refers to data legally owned or controlled by an organization (government agencies, enterprises, institutions, etc.), recorded electronically or otherwise, such as text, images, voice, video, web pages, databases, sensor signals and other structured or unstructured data, which can be measured or traded and can directly or indirectly bring economic and social benefits. The data assets of the embodiment of the present application are mainly offline data warehouse tables, wide tables, reports and other data tables generated by the business department during the business analysis application process. These data tables can generate value for the organization or team.
[0031] Extraction, transformation and loading (ETL): responsible for extracting data from scattered and heterogeneous data sources to a temporary intermediate layer for cleaning, transformation, integration, and finally loading into a data warehouse or data mart. ETL is the core of implementing a data warehouse, and the design and implementation of ETL rules accounts for about 60% to 80% of the workload of building the entire data warehouse. It is mainly divided into four steps: data extraction, data cleaning, data transformation, and data loading.
[0032] Variables and atomic variables: Variables are the characteristics of objects in statistical research. Among quantitative symbols, unchanging quantitative symbols are called constants or parameters, and variable quantitative symbols are called variables. For example, in the field of credit risk business, there are many risk control decision variables processed based on internal and external data sources in an offline data warehouse environment. These variables may be derived through complex logical derivations or long links. Therefore, tracing the source to the first derivation of the variable name is called the atomic mining process of the variable, and the fields of the initial layer table traced back are atomic variables.
[0033] Breadth-first Search (BFS) algorithm: also known as the breadth-first search algorithm, is a blind search method that aims to systematically expand and check all nodes in the graph to find the result. The main logic is to traverse layer by layer starting from the root node. Only after all the nodes in one layer are completely traversed will the traversal of the next layer be entered until all leaf nodes are traversed.
[0034] Scheduling tasks: Scheduling refers to the process by which a system executes a task at a specific agreed time or under specific conditions in order to automatically complete a specific task. Scheduling tasks can free up more manpower, and the system can automatically execute the task. The scheduling tasks of the embodiments of the present application may refer to the table writing output tasks of the data model in an offline data warehouse environment under a big data cluster, and the scheduling period may include days, weeks, months, etc.
[0035] Metadata: data about data, that is, data that describes data. It is data that exists to describe relevant information about the data.
[0036] At present, there are often many business variables in the database of the business system that are processed based on internal and external data sources. These business variables may be derived through complex logic or processed through lengthy links, which can easily lead to low data output efficiency of the business system. Based on this, an embodiment of the present application provides a data processing method, by tracing the business variables (i.e., fields in the data table) involved in the database of the business system, obtaining the atomic variables (i.e., source fields) of each business variable, and then optimizing the data processing link located upstream of the business system based on the atomic variables of each business variable, so as to reduce the complexity of the data processing link located upstream of the business system, thereby facilitating improving data processing efficiency.
[0037] See also Figure 2 , Figure 2 is a flow chart of a data processing method provided in an embodiment of the present application, such as Figure 2 As shown, the following steps are included:
[0038] Step 201, determine a first correspondence between a data processing task and a first data table, and a second correspondence between the data processing task and a second data table, wherein the first data table represents a data table output by executing the data processing task, and the second data table represents a data table referenced by executing the data processing task.
[0039] In this embodiment, the data processing task may also be referred to as a scheduling task or task, etc., which is used to produce or output a data table based on an input or referenced data table. The input or referenced data table may be referred to as an input table, a reference table, or a second data table, etc., and the output or output data table may be referred to as an output table, a result table, or a first data table, etc. For ease of understanding, this embodiment is described by taking the table output by executing the data processing task as an output table and the data table referenced by executing the data processing task as a reference table as an example.
[0040] The above-mentioned determination of the first correspondence between the data processing task and the first data table, and the second correspondence between the data processing task and the second data table may include generating the first correspondence and the second correspondence, or obtaining the first correspondence and the second correspondence, for example, reading the pre-stored first correspondence and the second correspondence, or receiving the first correspondence and the second correspondence.
[0041] Exemplarily, the task configuration information of the data center of the big data cluster can be read, and the first corresponding relationship between the data processing task and the first data table, and the second corresponding relationship between the data processing task and the second data table can be obtained by parsing the task configuration information of the data center; or, the running information of the task can be parsed to obtain the first corresponding relationship between the data processing task and the first data table, and the second corresponding relationship between the data processing task and the second data table. The above-mentioned task configuration information can also be called scheduling configuration information.
[0042] It should be noted that under the big data development specification, since each task is required to have only one first data table, the task corresponding to each first data table is obtained directly by reading the task configuration information of the data center, and metadata containing the task name and the corresponding first data table is generated, that is, the above-mentioned first correspondence. Since the big data development specification restricts each task to have only one first data table, it can be guaranteed that the first correspondence determined based on the task configuration information of the data center has a high reliability.
[0043] Step 202: Determine the tracing results corresponding to the respective fields of the third data table based on the first corresponding relationship and the second corresponding relationship, wherein the tracing results include a source table and source fields in the source table.
[0044] In this embodiment, the third data table can be any data table. For example, the third data table can be a data table classified by user dimension, that is, the variables (i.e., fields) of the data table are used to describe users. For example, the data table can include user portrait information, environment information, terminal information, user tags, etc., which are used to represent user variables. The third data table can also be called a variable data table, a data asset table, or a variable result table, etc. In addition, the number of the third data tables can be one or more.
[0045] The source table can be understood as the data table where the fields of the third data table appear for the first time, and the source fields are fields in the source table corresponding to the fields of the third data table, for example, the source fields are fields in the source table with the same names as the fields of the third data table. The source table can also be called an atomic table or an original table, and the source fields can also be called an atomic variable or an original variable or an original field, etc.
[0046] Exemplarily, based on the above-mentioned first correspondence and second correspondence, the data table referenced by the third data table can be searched layer by layer to obtain the source table and source field corresponding to each field of the third data table. For example, based on the above-mentioned first correspondence and second correspondence, data table A referenced by the third data table is determined, and the fields in data table A that are the same as those in the third data table are analyzed, and then based on the above-mentioned first correspondence and second correspondence, data table B referenced by data table A is determined, and the fields in data table B that are the same as those in data table A are analyzed, and so on, until the determined data table does not have a referenced data table, so that the traceability results of each field of the third data table can be determined by combining the above-mentioned various analysis results.
[0047] Step 203: based on the tracing results corresponding to the fields of the third data table, update the data processing link, wherein the data tables output by the data processing tasks of the data processing link are all referenced by the third data table.
[0048] The above-mentioned data processing link may include multiple data processing tasks, and the multiple data processing tasks can be connected in series. For example, the above-mentioned data processing link includes data processing task A, data processing task B and data processing task C, wherein the output end of data processing task A can be connected to the input end of data processing task B, and the output end of data processing task B is connected to the input end of data processing task C.
[0049] The data tables output by each data processing task of the above-mentioned data processing link are all referenced by the third data table, that is, the above-mentioned data processing link is a data processing link located upstream of the third data table. The data tables output by the data processing tasks of the above-mentioned data processing link are referenced by the third data table, which may include the data tables output by the data processing tasks of the above-mentioned data processing link being directly referenced and indirectly referenced by the above-mentioned third data table. For example, data table A output by data processing task A is referenced by data table B of data processing task B, and the third data table references data table B, then the above-mentioned data table B can be called a data table directly referenced by the third data table, and the above-mentioned data table A can be called a data table indirectly referenced by the third data table. In other words, the data table output by the data processing tasks of the above-mentioned data processing link can be an M-order reference table of the third data table, where M is a positive integer, wherein the first-order reference table of the third data table can be understood as a data table directly referenced by the third data table, the second-order reference table of the third data table can be understood as a data table referenced by a data table directly referenced by the third data table, and the third-order reference table of the third data table can be understood as a data table referenced by a data table referenced by a data table directly referenced by the third data table, and so on.
[0050] It should be noted that the above-mentioned data processing link can also be called a data processing link, an ETL link, an ETL processing link, etc.
[0051] Exemplarily, the source tables corresponding to the various fields of the third data table can be used to replace the data processing tasks related to the above-mentioned fields in the above-mentioned data processing link to compress the data processing link. In this way, the data processing tasks corresponding to the third data table can directly obtain the values of the corresponding fields from the source tables corresponding to the various fields of the third data table, which is conducive to improving data processing efficiency.
[0052] In an embodiment of the present application, by determining a first correspondence between a data processing task and a first data table, and a second correspondence between the data processing task and the second data table, the traceability results corresponding to each field of the third data table are determined based on the first correspondence and the second correspondence, and based on the traceability results corresponding to each field of the third data table, the data processing link is updated, and the data tables output by each data processing task of the data processing link are all referenced by the third data table, that is, the data processing link is a data processing link located upstream of the third data table, which is conducive to reducing the complexity of the data processing link, and thus is conducive to improving data processing efficiency.
[0053] Optionally, determining the tracing results corresponding to the respective fields of the third data table based on the first corresponding relationship and the second corresponding relationship includes:
[0054] Based on the first corresponding relationship and the second corresponding relationship, searching each order reference table of the third data table in the data processing link to obtain traceability information of each order, wherein the traceability information of the Nth order is determined based on the Nth order reference table of the third data table, where N is a positive integer;
[0055] The tracing results corresponding to the various fields of the third data table are determined based on the tracing information of all orders.
[0056] In this embodiment, the first-order reference table of the third data table can be understood as the data table directly referenced by the third data table, the second-order reference table of the third data table can be understood as the data table referenced by the data table directly referenced by the third data table, the third-order reference table of the third data table can be understood as the data table referenced by the data table referenced by the data table directly referenced by the third data table, and so on. Figure 2 As shown; or, the N-th order reference table of the third data table can be understood as the data table referenced by the third data table through N-1 data tables.
[0057] The above-mentioned search obtains the traceability information of each order by searching the reference tables of each order of the third data table in the data processing link. For example, based on a search algorithm such as a depth-first search algorithm or a breadth-first search algorithm, the reference tables of each order of the third data table in the data processing link can be searched to obtain the traceability information of each order.
[0058] Preferably, the search for each order reference table of the third data table in the data processing link to obtain each order of traceability information includes: searching each order reference table of the third data table in the data processing link according to a breadth-first search algorithm to obtain each order of traceability information. For example, according to the breadth-first search algorithm, with the third data table as the root node, traverse each layer of nodes in the data processing link layer by layer starting from the root node, and only after completely traversing all the nodes of one layer will the traversal of the next layer be entered until all the nodes are traversed. Since the search based on the breadth-first search algorithm can traverse all nodes, this can help to obtain the reference tables of each order of the third data table more comprehensively and completely.
[0059] The above-mentioned N-th order traceability information is determined based on the N-th order reference table of the third data table, that is, when the above-mentioned data processing link searches for the N-th order reference table of the third data table, the N-th order traceability information is determined based on the N-th order reference table of the third data table. For example, when the above-mentioned data processing link searches for the 1st order reference table of the third data table, the 1st order traceability information is determined based on the 1st order reference table of the third data table; when the above-mentioned data processing link searches for the 2nd order reference table of the third data table, the 2nd order traceability information is determined based on the 2nd order reference table of the third data table, and so on.
[0060] Exemplarily, the traceability information of the Nth order may include the name and the first field of the Nth order reference table, and the first field is a field in the Nth order reference table with the same name as the field of the third data table; or, the traceability information of the Nth order may include the name and the second field of the Nth order reference table, and the second field is a field in the Nth order reference table with the same name as the field of the N-1th order reference table of the third data table, and the N-1th order reference table references the N-1th order reference table.
[0061] The above-mentioned tracing results corresponding to each field of the third data table are determined based on the tracing information of all orders. For example, the reference tables in the tracing information of the maximum order corresponding to each field of the third data table are used as the source tables corresponding to each field of the third data table, and the corresponding fields of the reference table in the tracing information of the maximum order corresponding to each field of the third data table are used as the source fields corresponding to each field of the third data table.
[0062] This embodiment searches for reference tables of each order of the third data table in the data processing link based on the first corresponding relationship and the second corresponding relationship, obtains traceability information of each order, and determines traceability results corresponding to each field of the third data table based on the traceability information of all orders. This helps to ensure that the source tables and source fields corresponding to each field of the determined third data table are the data tables and fields where each field of the third data table initially appears, thereby ensuring the reliability of the source tables and source fields corresponding to each field of the determined third data table.
[0063] Optionally, the method for determining the traceability information of the Nth order includes:
[0064] Determine a first data processing task corresponding to a fourth data table based on the first corresponding relationship;
[0065] Determine a fifth data table corresponding to the first data processing task based on the second corresponding relationship;
[0066] Determine whether there are fields with the same name between the fourth data table and the fifth data table;
[0067] If there are fields with the same name, performing consistency check on the fields with the same name in the fourth data table and the fifth data table;
[0068] If the consistency check passes, the traceability information of the Nth order is recorded, and the traceability information of the Nth order includes: the name of the fourth data table, the target field of the fourth data table, the name of the fifth data table, and the target field of the fifth data table;
[0069] Among them, the target field represents the field with the same name in the fourth data table and the fifth data table. When N is 1, the fourth data table includes the third data table. When N is an integer greater than 1, the fourth data table includes the N-1th order reference table of the third data table, and the fifth data table includes the Nth order reference table of the third data table.
[0070] It can be understood that, when N is 1, the fourth data table is the third data table, and the fifth data table is the 1st-order reference table of the third data table; when N is an integer greater than 1, the fourth data table is the N-1th-order reference table of the third data table, and the fifth data table is the Nth-order reference table of the third data table.
[0071] The above-mentioned consistency check is performed on the fields with the same name in the fourth data table and the fifth data table. Exemplarily, if the values of the fields with the same name in the fourth data table and the fifth data table are the same, it is determined that the fields with the same name in the fourth data table and the fifth data table pass the consistency check. For example, when the value of field A in the fourth data table and the value of field A in the fifth data table are associated through a user identifier, if the values of field A in the fourth data table and field A in the fifth data table are the same under each user identifier, it is determined that field A in the fourth data table and field A in the fifth data table pass the consistency verification.
[0072] The present embodiment is described below with reference to examples:
[0073] Step 1: For the variable data table table0 (i.e., the fourth data table), based on the first correspondence between tasks and output tables, it can be known that the corresponding task is task0 (i.e., the first data processing task). Based on the second correspondence between tasks and reference tables, it can be known that the reference table corresponding to task0 (i.e., the fifth data table) includes table1 and table2. Figure 3 As shown. According to the comparison results of the field information of table0, table1 and table2, table1 has col1 and col2 with the same field names as table0, and the data consistency of the same fields of the two tables is verified. The data of the same fields are associated through union_id and written into the intermediate table check_table. For example, as shown in Table 1, if the data consistency rate of the fields of the variable data table and the fields of each referenced table is statistically analyzed to obtain table0.col1 (i.e. col1 of table0) and table1.col1 (i.e. col1 of table1), table0.col2 (i.e., col2 of table0) and all data records of table1.col2 (i.e., col2 of table1) are consistent (i.e., the consistency rate is 100%), then it is determined that table1.col1 and table1.col2 are the first-order source fields of table0.col1 and table0.col2 respectively. In this case, the first-order traceability information is obtained, and the traceability information may include the following data: the name of the fourth data table, the fields of the fourth data table, the name of the fifth data table, the fields of the fifth data table, the consistency rate, and the order; and the first-order traceability information can be asynchronously written into the data table atom_table, for example, as shown in Table 2.
[0074] Table 1
[0075]
[0076] Table 2
[0077]
[0078] Step 2: From the first correspondence, we know that the task corresponding to table1 (i.e., the fourth data table) is task1 (i.e., the first data processing task). Based on the second correspondence, we know that the reference tables corresponding to task1 (i.e., the fifth data table) are table3 and table4. Figure 3 As shown, according to the field information of each table, it can be known that table3 and table1 have fields with the same name col1 and col2, and the data consistency of the fields of the two tables is verified, wherein the data of the same field is associated through union_id and written into the intermediate table. For example, as shown in Table 3, the field data consistency rate is counted to know that all data records of table1.col1 and table3.col1, table1.col2 and table3.col2 are consistent, then it is determined that table3.col1 and table3.col2 are the second-order source fields of table0.col1 and table0.col2. In this case, the second-order traceability information is obtained and asynchronously written into the data table atom_table, for example, as shown in Table 3.
[0079] Table 3
[0080]
[0081] Table 4
[0082]
[0083]
[0084] Step 3: Based on the first corresponding relationship, it can be known that the task corresponding to table3 (i.e., the fourth data table) is task3 (i.e., the first data processing task). Based on the second corresponding relationship, it can be known that the reference table corresponding to task3 (i.e., the fifth data table) includes table7 and table8. Figure 3 As shown, based on the field information of each table, it can be known that table7 and table3 have fields with the same name col1 and col2, and the data consistency of the fields of the two tables is verified, where the data of the same field is associated through union_id and written into the intermediate table. For example, as shown in Table 5, the field data consistency rate is counted and it can be obtained that table7.col1 and table7.col2 are the third-order source fields of table0.col1 and table0.col2 respectively. In this case, the third-order traceability information is obtained and asynchronously written into the data table atom_table, for example, as shown in Table 6.
[0085] Table 5
[0086]
[0087] Table 6
[0088]
[0089] Step 4: Similarly, iteratively search the reference tables of table0 at each order in the upstream data processing link layer by layer to obtain the traceability information of each order, and asynchronously write the traceability information of each order into the data table atom_table.
[0090] Step 5: Determine the fifth data table corresponding to the maximum order of each field of table0 in atom_table as the source table, and determine the field of the fifth data table corresponding to the maximum order of each field of table0 in atom_table as the source field. For example, for atom_table shown in Table 6, the maximum order corresponding to col1 and col2 of table0 is 3, then determine table7 as the source table corresponding to col1 and col2 of table0, determine col1 of table7 as the source field corresponding to col1 of table0, and determine col2 of table7 as the source field corresponding to col2 of table0.
[0091] It should be noted that, in the case where there are multiple third data tables, for example, the variable data asset list includes multiple variable data tables, each third data table can be processed according to the above steps 1 to 5 to obtain the traceability results of each third data table. Optionally, the traceability results of all third data tables can be integrated to obtain the source table and source field of each field of the global variable data table, wherein the above global variable data table includes the above multiple third data tables.
[0092] It should also be noted that the above-mentioned acquisition of field information of each table can be achieved by scanning the table structure of the table, which can be achieved by a custom function encapsulating the SQL syntax for executing the retrieval table structure, for example, showcolumns from table_name in db_name. Scanning the table structure is a very efficient retrieval, which is sufficient to support the timeliness of the above-mentioned search iteration. In addition, the above-mentioned data consistency verification process is a method for batch calculating whether each record (union_id) of each set of key-value pairs (i.e., field name-field value) is consistent, and generates an intermediate table check_table, which can be used only to count the consistency rate of the fields of the fourth data table and the fields of the fifth data table.
[0093] This embodiment determines the fifth data table corresponding to the fourth data table based on the first correspondence and the second correspondence, compares the field names of the fourth data table and the fifth data table, and performs consistency check on the fields with the same names in the fourth data table and the fifth data table when there are fields with the same names, and records the traceability information of the corresponding order when the consistency check passes, which is conducive to ensuring the reliability of the traceability information of each order obtained, and further conducive to further ensuring the reliability of the traceability results corresponding to each field of the determined third data table.
[0094] Optionally, updating the data processing link based on the tracing results corresponding to the fields of the third data table includes:
[0095] Generate a vertical table based on the tracing results corresponding to each field of the third data table, wherein the vertical table includes the following fields: a primary key, a name of a source field, and a value of a source field;
[0096] Generate a target horizontal table view based on the vertical table;
[0097] The data processing link is updated through the target horizontal table view.
[0098] Exemplarily, the primary key may be an identifier of an object described by the field of the third data table. For example, when the field of the third data table is used to describe a user, the primary key may be a user identifier, such as union_id.
[0099] Exemplarily, a triple containing the primary key, the name of the source field, and the value of the source field can be generated based on the tracing results corresponding to each field of all third data tables, for example, [key, feature_name, feature_value], wherein key represents the primary key, feature_name represents the name of the source field, and feature_value represents the value of the source field. Then, a vertical table can be generated based on the above triple. For example, as shown in Table 7, the vertical table is a key-value structure with the characteristics of column-level stability, row-level vertical scalability, stable structure, high compression, efficient reading performance, and convenient data integration and aggregation.
[0100] Table 7
[0101]
[0102]
[0103] After the vertical table is generated, a horizontal table can be generated based on the vertical table, wherein the horizontal table can also be called a wide table. For example, the vertical table can be loaded into the Spark engine and converted into a wide table by pivoting and pulling using a pivot operator, and the dimension of the variable can automatically grow with the growth of the primary key of the vertical table. For example, the vertical table shown in Table 7 is pivoted and pulled horizontally to obtain a horizontal table as shown in Figure 8.
[0104] It should be noted that the above-mentioned horizontal table is a multivariable horizontal table based on application purposes, with the characteristics of column-level auto-increment, flexibility, diversity, and application-oriented. The horizontal table constructed in the above manner, on the one hand, has different characteristics from the variable data asset table of the business domain, that is, there is no calculation process derived from the business itself in the intermediate process, but it starts from the data warehouse source layer data model, and after reconstructing the processing link, it avoids the data quality problems, calculation efficiency problems, unreasonable storage problems, and data output timeliness problems that may exist in the original data asset table; on the other hand, the constructed horizontal table has a lot of similarities with the variable data asset table of the original business domain in terms of function. In scenarios such as business data analysis, indicator calculation, feature engineering, model training, model prediction, etc., the same function can be achieved by taking data from the horizontal table and taking data from the original data asset table. At the same time, the multi-variables of the horizontal table can also integrate the functions of the original multiple processing links to reduce the complexity of the task.
[0105] Table 8
[0106]
[0107]
[0108] The above-mentioned horizontal table view (view) is a view of the horizontal table. For example, based on the stable and uniformly stored data model feature_table (i.e., vertical table), the required variables (i.e., source fields) can be screened, and the data service (i.e., horizontal table view) of the variable data can be encapsulated one-to-one. Then, the data processing link can be optimized based on the generated horizontal table view. For example, the generated horizontal table view can be used to replace some intermediate tables generated in the data processing link as the input table of the business located downstream of the data processing link, such as Figure 4 As shown in the figure, multiple horizontal table views are generated based on the vertical table, that is, Figure 1 To Vision Figure 3 , and will be viewed Figure 1 As the input of ETL business 1, Figure 2 As the input of ETL business 2, Figure 3 As the input of ETL business 3, this can not only compress the link length and reduce the complexity of data processing, but also reduce data storage space because the horizontal table view does not need to store the corresponding horizontal table data.
[0109] It should be noted that for each view, you can specify the required source fields as needed when creating the view (create view) to define the widening conversion logic. In addition, when you need to change the view, such as adding source fields, you can reconstruct the view logic in a lightweight way by changing the view (atler view) syntax. The above views have the characteristics of flexible logic definition, lightweight data structure, one-to-one customization, and no actual data storage.
[0110] Optionally, generating a target horizontal table view based on the vertical table includes:
[0111] Determine the target source field;
[0112] When the number of the target source fields is greater than or equal to a threshold, generating a plurality of horizontal table views based on the vertical table;
[0113] The multiple horizontal table views are spliced together to obtain a target horizontal table view.
[0114] Exemplarily, the target source field (ie, variable) can be determined based on business needs. For example, for a model training task, 10 source fields in the vertical table are required, and a horizontal table view including the above 10 source fields can be generated based on the above vertical table.
[0115] The above thresholds can be reasonably set according to actual needs, for example, 100 or 200.
[0116] In this embodiment, when the number of target source fields is less than a threshold, a target horizontal table view can be directly generated based on the above-mentioned vertical table; when the number of target source fields is greater than or equal to the threshold, multiple horizontal table views can be generated based on the vertical table, and the multiple horizontal table views can be spliced to obtain the target horizontal table view. Since the more fields there are, the longer it takes to generate the horizontal table view, this embodiment generates multiple horizontal table views that each contain some fields when the number of fields is large, and then splices them to obtain the target horizontal table view. This is conducive to improving the efficiency of generating the target horizontal table view.
[0117] It should be noted that the number of generated horizontal table views and the number of source fields included in each horizontal table view can be reasonably set according to actual needs.
[0118] Optionally, updating the data processing link through the target horizontal table view includes:
[0119] replacing a second data processing task in the data processing link with the target horizontal table view;
[0120] The second data processing task includes a data processing task between the source table where the source field in the target horizontal table view is located in the data processing link and the third data table.
[0121] In this embodiment, the target horizontal table view can be directly used to replace the second data processing business in the data processing link, that is, the target horizontal table view can be directly used to replace the data processing business of generating intermediate tables or temporary tables in the data processing link. This can not only compress the upstream data processing link of the third data table, but also save data storage space.
[0122] The following is an example to illustrate:
[0123] Scenario 1: Link compression in splicing and assembly scenarios.
[0124] When joining a series of source tables and assembling fields layer by layer, a temporary table is generated in the intermediate process, such as Figure 5 As shown, the node1_table series tables / node2_table series tables / node3_table series tables are all temporary tables of the intermediate process. This part of the table is a bridge connecting the node4_table series original table to node0_table0. In addition to being a logical connection, there is no need to store them in the database as tables. The data processing method provided in this embodiment is applied to search for the initial layer atomic variable table (i.e., source table) node4_table series tables in the upstream data processing link of node0_table0, and generate the vertical table data model feature_table (i.e., vertical table) according to the searched atomic field set (i.e., source field set), and then create the variable service feature_view (i.e., horizontal table view) according to the horizontal splicing logic. The horizontal table view is used as a data conversion bridge to replace the intermediate process of the original data processing link and is embedded in the data processing link. This can not only improve the data processing efficiency and reduce the complexity and length of the link, but also reduce the redundant storage generated by the intermediate process.
[0125] 2. Link compression in layered stripping scenarios.
[0126] For the case where atomic variables (i.e. source fields) are scattered in each upstream layer of the variable result table, such as Figure 6 As shown, the process of searching for atomic variables is a layered peeling process, that is, there are some atomic variables in each layer. The data processing method provided in this embodiment is applied to track and search the atomic variable set from the node1_table series table to the node8_table series table layer by layer, and the variables are peeled layer by layer and written into the vertical table data model feature_table (i.e., vertical table), and then the variable service feature_view (i.e., horizontal table view) is created according to the horizontal splicing logic, and the original processing link is replaced with the horizontal table view. In this way, each layer has different degrees of compression efficiency, and the compressed variable data can be produced earlier, which is conducive to improving the timeliness of data output.
[0127] Optionally, before determining the second corresponding relationship between the data processing task and the second data table, the method further includes:
[0128] Obtaining Structured Query Language (SQL) information for data processing tasks;
[0129] Standardizing the SQL information to obtain a standardized SQL statement;
[0130] Parsing the SQL statement to obtain a second data table of the SQL statement;
[0131] The corresponding relationship between the second data table and the data processing task is recorded.
[0132] The above standardization processing may include but is not limited to comment processing, special statement filtering, single statement segmentation and other processing to obtain standardized SQL statements.
[0133] Since a scheduling task can reference multiple tables, the task configuration information of the data center of the big data cluster may be omitted. Therefore, this embodiment parses the SQL information during the actual operation of the task to obtain the correspondence between the second data table and the task. Exemplarily, the SparkSQL execution plan parsing can be used to obtain the correspondence between the second data table and the task. For example, the SQL text is obtained by reading the content of the SQL scheduling task of the big data cluster, and the SQL text is standardized, such as comment processing, special statement filtering, single statement segmentation, etc., to obtain a standardized set of SQL statements, and the SQL execution plan is parsed by the Spark engine to obtain the second data table and field of each SQL statement, and then the second correspondence between the task name and the second data table can be generated.
[0134] For example, the above SparkSQL execution plan parsing can be based on the abstract syntax tree (AST) generated by the built-in physical plan of Spark, autonomously parse the content of its scan phase, extract the scanned table information; traverse the execution plan of each scheduled task SQL, and finally generate metadata including the task name and the corresponding second data table. The schematic diagram of the Spark execution plan is as follows: Figure 7 shown.
[0135] This embodiment parses the SQL information of the data processing task to obtain the correspondence between the second data table and the data processing task, which helps to ensure that the obtained correspondence between the second data table and the data processing task is more comprehensive and reliable.
[0136] The present embodiment is described below in conjunction with specific application scenarios:
[0137] Scenario 1: The risk control data mart uses the data tables that belong to the channel risk control department and meet the requirements of stable update and complete scheduling tasks based on the data center retrieval and offline collection as the variable data asset list, and conducts preliminary analysis and decomposition, mainly including list type, customer portrait type, environmental information type, terminal information type, user tag type and other data. This data can be used for the user's portrait scenario. Therefore, the user dimension data asset list can be screened, and the data processing method provided in this embodiment is used to change each variable data of the user dimension data asset list, which is triggered from the data table of the upper-level analysis application and deposited downward to the standard warehouse of the risk control data mart (i.e., rcdm_rcf warehouse and r cdm_rca warehouse) generates a standard data model. The data model design is distributed in two layers. The rcdm_rcf warehouse builds a stable middle-layer vertical table data model. For example, the vertical table labels can include: blacklist, historical application behavior, historical bad performance, multiple, repeated application, assets, RVs, special customer groups and other portrait labels; the rcdm_rca warehouse builds a horizontal table data model for analysis. The horizontal table data model uses user ID as the primary key, the above-mentioned labels as the field names, and each user's each label attribute as the value. This can support flexible business analysis and also has the function of replacing the series of data tables in the original variable data asset list.
[0138] Scenario 2: In the risk control decision-making process, some score prediction links based on machine learning models are deployed in an offline environment. At the same time, there will be a large number of model training links in the early stage of model deployment. Both model training and model prediction use a series of variable input tables. For example, the above risk control decision-making process involves 224 model tasks, and these 224 model tasks involve 281 variable input expressions, involving a total of 25,000 variables. The variable input result table of each model may have problems such as one-to-many, cross-referenced by model tasks, and serious redundant storage. At the same time, the upstream ETL link of each variable input table has many unreasonable problems, such as simple repeated copying and multi-layer splicing and assembly problems in the variable service layer, and repeated copying and interwoven reference confusion in the variable development layer. This embodiment can parse and identify the model file, sort out the variable field range of 281 variable input tables, and use the data processing method provided by this embodiment to process the 281 variable data tables, that is, trace the atomic variables in the upstream ETL link, and build a unified variable library based on the atomic variables for storage. The upstream ETL link of the variable data table and the process of the variable data table serving the downstream model application can be taken over by the data service built by the unified variable library. First, a stable variable data model is constructed, second, the upstream ETL link process of the variable table is compressed and optimized, and third, the variable service downstream model application process is transformed, which has different degrees of improvement in the overall rationality of the model task, output timeliness, stability, etc.
[0139] In summary, the data processing method provided in this embodiment can be based on the variable data assets of the business domain, derive mining and sinking abstraction into a standard data model (i.e., vertical table), manage the variable data tables with chaotic structures, and integrate them into data tables with reasonable structures and storage specifications; through a top-down mining model, starting from the upper-level business application, after mining, it is precipitated to the lower-level data architecture; it can automatically search and track to achieve the purpose of automated reconstruction and analysis and management of the ETL process of variable data; based on metadata drive, it can realize the assembly-style generation of base tables and field sets, and both efficiency and stability are improved; it can eliminate redundant storage, visualize some intermediate processes, eliminate some unnecessary intermediate process tables, and reduce the required storage space as a whole; it can optimize the link design, and the logical view encapsulates a processing process, compresses the link length, and reduces the link complexity.
[0140] See also Figure 8 , Figure 8 is a structural diagram of a data processing device provided in an embodiment of the present application. Figure 8 As shown, the data processing device 800 includes:
[0141] A first determining module 801 is used to determine a first correspondence between a data processing task and a first data table, and a second correspondence between the data processing task and a second data table, wherein the first data table represents a data table output by executing the data processing task, and the second data table represents a data table referenced by executing the data processing task;
[0142] A second determination module 802 is used to determine the source tracing result corresponding to each field of the third data table based on the first corresponding relationship and the second corresponding relationship, wherein the source tracing result includes a source table and a source field in the source table;
[0143] The updating module 803 is used to update the data processing link based on the tracing results corresponding to each field of the third data table, wherein the data tables output by each data processing task of the data processing link are all referenced by the third data table.
[0144] Optionally, the second determining module is specifically configured to:
[0145] Based on the first corresponding relationship and the second corresponding relationship, searching each order reference table of the third data table in the data processing link to obtain traceability information of each order, wherein the traceability information of the Nth order is determined based on the Nth order reference table of the third data table, where N is a positive integer;
[0146] The tracing results corresponding to the various fields of the third data table are determined based on the tracing information of all orders.
[0147] Optionally, the method for determining the traceability information of the Nth order includes:
[0148] Determine a first data processing task corresponding to a fourth data table based on the first corresponding relationship;
[0149] Determine a fifth data table corresponding to the first data processing task based on the second corresponding relationship;
[0150] Determine whether there are fields with the same name between the fourth data table and the fifth data table;
[0151] If there are fields with the same name, performing consistency check on the fields with the same name in the fourth data table and the fifth data table;
[0152] If the consistency check passes, the traceability information of the Nth order is recorded, and the traceability information of the Nth order includes: the name of the fourth data table, the target field of the fourth data table, the name of the fifth data table, and the target field of the fifth data table;
[0153] Among them, the target field represents the field with the same name in the fourth data table and the fifth data table. When N is 1, the fourth data table includes the third data table. When N is an integer greater than 1, the fourth data table includes the N-1th order reference table of the third data table, and the fifth data table includes the Nth order reference table of the third data table.
[0154] Optionally, the update module includes:
[0155] A first generating unit is used to generate a vertical table based on the tracing results corresponding to the fields of the third data table, wherein the vertical table includes the following fields: a primary key, a name of a source field, and a value of a source field;
[0156] A second generating unit, configured to generate a target horizontal table view based on the vertical table;
[0157] An updating unit is used to update the data processing link through the target horizontal table view.
[0158] Optionally, the second generating unit is specifically configured to:
[0159] Determine the target source field;
[0160] When the number of the target source fields is greater than or equal to a threshold, generating a plurality of horizontal table views based on the vertical table;
[0161] The multiple horizontal table views are spliced together to obtain a target horizontal table view.
[0162] Optionally, the updating unit is specifically used for:
[0163] replacing a second data processing task in the data processing link with the target horizontal table view;
[0164] The second data processing task includes a data processing task between a source table where a source field in the target horizontal table view is located in the data processing link and the third data table.
[0165] Optionally, the device further comprises:
[0166] An acquisition module, used for acquiring structured query language SQL information of the data processing task before determining the second corresponding relationship between the data processing task and the second data table;
[0167] A processing module, used for performing standardization processing on the SQL information to obtain a standardized SQL statement;
[0168] A parsing module, used for parsing the SQL statement to obtain a second data table referenced by the data processing task;
[0169] A recording module is used to record the corresponding relationship between the second data table and the data processing task.
[0170] The data processing device 800 provided in the embodiment of the present application can implement each process in the above method embodiment, and will not be described again here to avoid repetition.
[0171] See also Fig. 9 , Fig. 9 is a structural diagram of a data processing device provided by another embodiment of the present application, such as Fig. 9 As shown, the data processing device 900 includes: a processor 901, a memory 902, and a computer program stored in the memory 902 and executable on the processor. The various components in the data processing device 900 are coupled together via a bus interface 903. When the computer program is executed by the processor 901, the following steps are implemented:
[0172] Determine a first correspondence between a data processing task and a first data table, and a second correspondence between the data processing task and a second data table, wherein the first data table represents a data table output by executing the data processing task, and the second data table represents a data table referenced by executing the data processing task;
[0173] Determine a source tracing result corresponding to each field of the third data table based on the first corresponding relationship and the second corresponding relationship, wherein the source tracing result includes a source table and a source field in the source table;
[0174] Based on the tracing results corresponding to the fields of the third data table, the data processing link is updated, wherein the data tables output by the data processing tasks of the data processing link are all referenced by the third data table.
[0175] It should be understood that in the embodiment of the present application, when the computer program is executed by the processor 901, it can implement each process in the above-mentioned data processing method embodiment. To avoid repetition, it will not be repeated here.
[0176] An embodiment of the present application also provides a data processing device, including a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned data processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0177] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned data processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0178] An embodiment of the present application also provides a computer program product, which is stored in a storage medium. When the computer program product is executed by at least one processor, it implements the various processes of the above-mentioned data processing method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0179] It should be noted that, in this article, the terms "include", "comprises" or any other variations 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 sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0180] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0181] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A data processing method, characterized in that: include: Determine a first correspondence between a data processing task and a first data table, and a second correspondence between the data processing task and a second data table, wherein the first data table represents a data table output by executing the data processing task, and the second data table represents a data table referenced by executing the data processing task; Determine a source tracing result corresponding to each field of the third data table based on the first corresponding relationship and the second corresponding relationship, wherein the source tracing result includes a source table and a source field in the source table; Based on the tracing results corresponding to the fields of the third data table, the data processing link is updated, wherein the data tables output by the data processing tasks of the data processing link are all referenced by the third data table.
2. The method according to claim 1, characterized in that The determining, based on the first corresponding relationship and the second corresponding relationship, the tracing result corresponding to each field of the third data table includes: Based on the first corresponding relationship and the second corresponding relationship, searching each order reference table of the third data table in the data processing link to obtain traceability information of each order, wherein the traceability information of the Nth order is determined based on the Nth order reference table of the third data table, where N is a positive integer; The tracing results corresponding to the various fields of the third data table are determined based on the tracing information of all orders.
3. The method according to claim 2, characterized in that The method for determining the traceability information of the Nth order includes: Determine a first data processing task corresponding to a fourth data table based on the first corresponding relationship; Determine a fifth data table corresponding to the first data processing task based on the second corresponding relationship; Determine whether there are fields with the same name between the fourth data table and the fifth data table; If there are fields with the same name, performing consistency check on the fields with the same name in the fourth data table and the fifth data table; If the consistency check passes, the traceability information of the Nth order is recorded, and the traceability information of the Nth order includes: the name of the fourth data table, the target field of the fourth data table, the name of the fifth data table, and the target field of the fifth data table; Among them, the target field represents the field with the same name in the fourth data table and the fifth data table. When N is 1, the fourth data table includes the third data table. When N is an integer greater than 1, the fourth data table includes the N-1th order reference table of the third data table, and the fifth data table includes the Nth order reference table of the third data table.
4. The method according to any one of claims 1 to 3, characterized in that The updating of the data processing link based on the tracing results corresponding to the fields of the third data table includes: Generate a vertical table based on the tracing results corresponding to each field of the third data table, wherein the vertical table includes the following fields: a primary key, a name of a source field, and a value of a source field; Generate a target horizontal table view based on the vertical table; The data processing link is updated through the target horizontal table view.
5. The method according to claim 4, characterized in that The generating a target horizontal table view based on the vertical table includes: Determine the target source field; When the number of the target source fields is greater than or equal to a threshold, generating a plurality of horizontal table views based on the vertical table; The multiple horizontal table views are spliced together to obtain a target horizontal table view.
6. The method according to claim 4, characterized in that The updating of the data processing link through the target horizontal table view includes: replacing a second data processing task in the data processing link with the target horizontal table view; The second data processing task includes a data processing task between a source table where a source field in the target horizontal table view is located in the data processing link and the third data table.
7. The method according to claim 1, characterized in that Before determining the second corresponding relationship between the data processing task and the second data table, the method further includes: Obtain structured query language SQL information for data processing tasks; Standardizing the SQL information to obtain a standardized SQL statement; Parsing the SQL statement to obtain a second data table referenced by the data processing task; The corresponding relationship between the second data table and the data processing task is recorded.
8. A data processing device, characterized in that: include: A first determining module is used to determine a first corresponding relationship between a data processing task and a first data table, and a second corresponding relationship between the data processing task and a second data table, wherein the first data table represents a data table output by executing the data processing task, and the second data table represents a data table referenced by executing the data processing task; A second determining module, configured to determine a source tracing result corresponding to each field of a third data table based on the first corresponding relationship and the second corresponding relationship, wherein the source tracing result includes a source table and a source field in the source table; An update module is used to update a data processing link based on the tracing results corresponding to each field of the third data table, wherein the data tables output by each data processing task of the data processing link are all referenced by the third data table.
9. An electronic device, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the data processing method according to any one of claims 1 to 7 when executed by the processor.
10. 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, the steps of the data processing method according to any one of claims 1 to 7 are implemented.
11. A computer program product, characterized in that The computer program product is stored in a storage medium, and when the computer program product is executed by at least one processor, the steps of the data processing method according to any one of claims 1 to 7 are implemented.
