Field tracing method, device, system, equipment, cluster, product and medium

By parsing the query statement into multiple sub-statements and matching them with preset relationship rules, the problem of not being able to trace the source table of the fields in the existing technology is solved, realizing comprehensive tracing of field modification relationships and improving the efficiency and accuracy of error location.

CN121009101APending Publication Date: 2025-11-25HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410651341.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-23
Publication Date
2025-11-25

AI Technical Summary

Technical Problem

Existing tracing techniques can only trace back to fields with relationships within the SQL syntax tree, but cannot trace further back to the source table of the field, making it difficult to locate errors in complex data table relationships.

Method used

By parsing the query statement into multiple sub-statements, identifying the sub-statements that include the target fields, and matching the source table of the fields according to preset relational rules, multi-level tracing is achieved.

Benefits of technology

It enables comprehensive tracing of field modification relationships, accurately pinpointing the source table of errors and improving the efficiency and accuracy of error location.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121009101A_ABST
    Figure CN121009101A_ABST
Patent Text Reader

Abstract

The invention provides a field tracing method, device and system, equipment, a cluster, a product and a medium. The method comprises the following steps: obtaining a traceability request, wherein the traceability request comprises an identifier of a first table and an identifier of a first field in the first table; searching a query statement comprising the identifier of the first table in a database, wherein the database comprises the executed query statement; analyzing the query statement into a plurality of sub-statements; determining that the first field is included in the multiple sub-statements and the field is a target sub-statement obtained by modification; and determining a source of the first field according to the target sub-statement, wherein the source represents that the field is obtained by modifying a second field in a second table. According to the scheme, the modification relation of the field can be traced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of databases, and more particularly to a method, apparatus, system, device, cluster, product, and medium for field tracing. Background Technology

[0002] When users operate on data tables in a database, they need to use query statements (such as SQL statements). A single SQL statement often involves operations on multiple fields of multiple tables. When an error occurs during the execution of an SQL statement, it is necessary to use tracing techniques to determine which field of which table has the error.

[0003] Current tracing techniques can only trace back to fields with relationships within the SQL syntax tree. However, in real-world scenarios, fields in different tables may have various complex relationships. For example... Figure 1 As shown, suppose table A has field 'a', table B has field 'b', and table C has field 'c'. Field 'c' is obtained by processing fields 'a' and 'b' (for example, adding field 'a' to field 'b'). When a user finds that the value in field 'c' is incorrect, the root cause of the problem may not be field 'c' itself, but rather in field 'a' or field 'b'. Therefore, to locate the error, it is necessary to trace back to field 'a' in table A and field 'b' in table B.

[0004] Alternatively, table D contains fields c and d. Field c in table C is obtained by filtering the fields in table D, removing field d. If field c is missing in table C, the root cause might be that field c was incorrectly filtered out during the filtering process in table D. Therefore, locating the error requires tracing back to table D.

[0005] However, according to current tracing technology, it is only possible to trace back to the 'c' field, and it is not possible to trace the 'c' field further. Summary of the Invention

[0006] This application provides a method, apparatus, system, device, cluster, product, and medium for tracing the source of field modifications, which can trace the source of field modification relationships.

[0007] Firstly, a method for tracing the origin of a field is provided. This method may include the following steps:

[0008] The tracing system obtains a tracing request. The tracing request includes the identifier of the first table and the identifier of the first field in the first table.

[0009] The tracing system searches the database for query statements that include the identifier of the first table. It parses the query statement into multiple sub-statements, identifies those sub-statements that include the first field and are modified to obtain the target sub-statement. Based on the target sub-statement, it determines the source of the first field, indicating that the field was obtained by modifying the second field in the second table. The database includes executed query statements. The modification operation includes one or more combinations of processing operations, filtering operations, and value retrieval operations. The processing operations include one or more combinations of mathematical operations, logical operations, bitwise operations, comparison operations, assignment operations, matrix operations, and vector operations. The data operations include one or more combinations of addition, subtraction, multiplication, and division operations. The logical operations include one or more combinations of AND, OR, and NOT operations. The filtering operation is used to filter based on the second field.

[0010] The value retrieval operation is used to take the value of the second field as the value of the first field.

[0011] In the above scheme, a query statement that includes the identifier of the first table can be found, and then a sub-statement in the query statement that includes the first field and whose field is modified to obtain the target field can be found. Based on the target sub-statement, the second field in the second table that has been modified to obtain the first field is determined, thus realizing the tracing of the modification relationship of obtaining the first field by modifying the second field.

[0012] In some possible designs, determining that the target sub-statement includes the first field among the plurality of sub-statements and that the field is modified to obtain the target sub-statement includes the following steps:

[0013] Find substatements that include the field. Substatements that include the field may include substatements containing keywords indicating a modification operation as well as substatements that do not contain keywords indicating a modification operation.

[0014] The target substatement is found among the substatements that include the field and contain the keyword indicating a modification operation.

[0015] In the above scheme, only the sub-statements that represent the keywords of the modification operation are used as target sub-statements, which can effectively reduce the number of sub-statements that need to be analyzed.

[0016] In some possible designs, determining the source of the field based on the target sub-statement includes the following steps:

[0017] The target sub-statement is matched according to preset relational rules. These relational rules represent the modification operations performed on the fields.

[0018] If the first field of the target sub-statement and the second field of the second table match the relation rule, then the second field of the second table is determined to be the source of the first field.

[0019] In the above scheme, the source of the second field in the second table as the first field can be found according to the preset relationship rules. By setting different preset relationship rules, different modification relationships can be traced back to their source.

[0020] In some possible designs, the source of the second field will be traced further. If no sub-statement containing the second field is found and the second field is modified to obtain the target sub-statement, the process will stop and the source of the first field will be output. If the second field is found and the second field is modified to obtain the target sub-statement, the source of the second field will be recorded.

[0021] The above scheme can achieve multi-level tracing of the first field, which facilitates the tracking of problems in the first field.

[0022] Secondly, a field tracing device is provided. The device includes:

[0023] The acquisition module is used to acquire the tracing request. The tracing request includes the identifier of the first table and the identifier of the first field in the first table.

[0024] The lookup module is used to search for query statements in a database that include the identifier of the first table, the database including executed query statements.

[0025] The parsing module is used to parse the query statement into multiple sub-statements.

[0026] A determination module is used to determine, among the plurality of sub-statements, a target sub-statement that includes the first field and whose field is modified.

[0027] The source tracing module is used to determine the source of the first field based on the target sub-statement. The source indicates that the field is obtained from the second field in the second table through a modification operation. The modification operation includes one or more combinations of processing operations, filtering operations, and value retrieval operations. The processing operations include one or more combinations of mathematical operations, logical operations, bitwise operations, comparison operations, assignment operations, matrix operations, and vector operations. The data operations include one or more combinations of addition, subtraction, multiplication, and division operations. The logical operations include one or more combinations of AND, OR, and NOT operations. The filtering operation is used to perform filtering based on the second field.

[0028] The value retrieval operation is used to take the value of the second field as the value of the first field.

[0029] In some possible designs, the determining module is further configured to search for substatements that include the field, and among the substatements that include the field, to find substatements that include keywords representing a modification operation as the target substatement. The substatements that include the field may include substatements that include keywords representing a modification operation as well as substatements that do not include keywords representing a modification operation.

[0030] In some possible designs, the tracing module is also used to match the target sub-statement according to a preset relational rule. If the first field of the target sub-statement and the second field of the second table match the relational rule, then the second field of the second table is determined to be the source of the first field.

[0031] In some possible designs, the tracing module is also used to continue tracing the second field. If no target substatement containing the second field is found and the second field is modified, the tracing stops and the source of the first field is output. If the second field is found and the second field is modified and the target substatement is found, the source of the second field is recorded.

[0032] Thirdly, a field tracing system is provided, the system comprising:

[0033] A client is used to send a tracing request, the tracing request including the identifier of the first table and the identifier of the first field in the first table;

[0034] A field tracing device is used to obtain a tracing request, search for a query statement in a database that includes the identifier of the first table, the database including executed query statements, parse the query statement into multiple sub-statements, determine the target sub-statement that includes the first field and that the field is modified, and determine the source of the first field based on the target sub-statement, the source indicating that the field was obtained by modifying the second field in the second table.

[0035] Fourthly, a chip system is provided, the chip system including a processor and a power supply circuit, the power supply circuit being used to supply power to the processor, the processor being used to perform the operation steps of the method as described in any of the first aspects.

[0036] Fifthly, a computing device is provided, the computing device including a processor and a memory;

[0037] The processor is configured to execute instructions stored in the memory to cause the computing device to perform the operational steps of the method as described in any of the first aspects.

[0038] In a sixth aspect, a computing device cluster is provided, including at least one computing device, each computing device including a processor and memory;

[0039] The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device to cause the cluster of computing devices to perform the operational steps of the method as described in any of the first aspects.

[0040] In a seventh aspect, a computer program product comprising instructions is provided, which, when executed by a cluster of computing devices, cause the cluster of computing devices to perform the operational steps of the method described in any of the first aspects.

[0041] Eighthly, a computer-readable storage medium is provided, including computer program instructions that, when executed by a cluster of computing devices, perform operational steps as described in any of the first aspects. Attached Figure Description

[0042] Figure 1 This is a schematic diagram of the structure of a database system provided in this application;

[0043] Figure 2 This is a schematic diagram of the structure of a database system provided in this application;

[0044] Figure 3 This is a flowchart illustrating a field tracing method provided in this application;

[0045] Figure 4 This is a schematic diagram of the structure of a target SQL syntax tree provided in this application;

[0046] Figure 5 This is a flowchart illustrating a process for obtaining the first field provided in this application;

[0047] Figure 6 This is a schematic diagram of the structure of a traceable SQL syntax tree provided in this application;

[0048] Figure 7 This is a flowchart illustrating a process for obtaining the second field provided in this application;

[0049] Figure 8 This is a schematic diagram of a tracing relationship provided in this application;

[0050] Figure 9 This is a schematic diagram of the structure of a field tracing system provided in this application;

[0051] Figure 10 This is a schematic diagram of the structure of a computing device provided in this application;

[0052] Figure 11 This is a schematic diagram of the structure of a computing device cluster provided in this application;

[0053] Figure 12 This is a schematic diagram of another computing device cluster provided in this application. Detailed Implementation

[0054] The database system will be described in detail below with reference to the accompanying diagram.

[0055] See Figure 2 , Figure 2 This is a schematic diagram of the structure of a database system provided in this application. For example... Figure 2 As shown, the database system of this application includes: a client 110 and a traceability system 120.

[0056] Client 110 is used to implement human-computer interaction and can be deployed on terminal devices or computing devices. Terminal devices include personal computers, smartphones, wearable devices, handheld processors, tablets, mobile laptops, augmented reality (AR) devices, virtual reality (VR) devices, all-in-one handheld consoles, wearable devices, in-vehicle devices, smart conferencing devices, smart advertising devices, smart home appliances, etc. Smart home appliances can be robot vacuums, robot mops, etc., and are not specifically limited here. Computing devices are described in the next paragraph.

[0057] Client 110 can be software or application running on a terminal device or computing device controlled by the user, such as a personal computer (PC) client, a web client accessed through a browser, an application (APP) client running on a mobile terminal, or a console of a cloud platform. This application does not make any specific limitations.

[0058] Client 110 can also be a client of a cloud platform, such as a cloud platform console. Specifically, it can be a console based on the World Wide Web (web) or a console based on an application programming interface (API). This application does not make any specific limitations.

[0059] Traceability System 120 is a system used to trace the origins of fields in a table. The following... Figure 3The details of how fields are traced in the relevant embodiments are not described here. The tracing system 120 can be deployed on computing devices, computing device clusters, or terminal devices. Computing devices include servers, virtual machines, containers, or edge computing devices. Virtual machines and containers both refer to computing systems composed of hardware resources such as computing, storage, and networks that are virtualized through a virtualization platform. Edge computing devices refer to devices that are closer to the data source and end users, featuring low latency and high bandwidth, such as intelligent routers and edge servers. A computing device cluster may include multiple of the above-mentioned computing devices, such as a data center; this application does not specifically limit this. The description of terminal devices can be found in the foregoing content and will not be repeated here.

[0060] Understandable. Figure 2 The database system shown is merely a specific example. In practical applications, a database system can include more devices and systems, such as storage systems, and the number of clients can also be greater. No specific limitations are made here.

[0061] After introducing the database system, the following section will detail the methods for field sourcing within that system. See also... Figure 3 , Figure 3 This is a flowchart illustrating a field tracing method provided in this application. For example... Figure 3 As shown, the field tracing method provided in this application includes the following steps:

[0062] S101: The client sends the identifier of the first table and the identifier of the first field in the first table to the traceability system. Correspondingly, the traceability system receives the identifier of the first table and the identifier of the first field in the first table sent by the client.

[0063] The first table can be any type of data table. It can include multiple fields, including the first field. The first field can vary depending on the business logic. For example, in a financial business, the first field could be quantity, unit price, total amount, exchange rate, etc.; in a management business, it could be progress completion rate, budget execution rate, defect rate, etc.; in a data analysis business, it could be average, standard deviation, correlation coefficient, etc.; and in a marketing business, it could be click-through rate, conversion rate, etc.

[0064] Besides the examples above, in practical applications, the first field can be any field specified by the user as needed; no specific restrictions are imposed here.

[0065] S102: The tracing system searches the database for the first query statement that includes the identifier of the first table.

[0066] A database can include multiple files, such as program files. Program files can include one or more executed query statements. In a specific embodiment, the program text can be an SQL file, etc. The SQL text includes one or more query statements. For example, SQL statements can include statements for creating a temporarily named result set in a query (WITH AS), data query statements for retrieving data from the database (SELECT statement), data insert statements for inserting new data rows into a database table (INSERT statement), data update statements for updating existing data rows in a database table (UPDATE statement), data delete statements for deleting data rows from a database table (DELETE statement), table creation statements for creating new database tables (CREATE TABLE statement), table modification statements for modifying the structure of database tables (ALTER TABLE statement), table deletion statements for deleting tables and all data in the tables (DROP TABLE statement), and other data manipulation language (DML) statements. Since the core complexity of complex DML statements is generally the SELECT query statement, the analysis of SELECT statements is crucial, and the following explanation focuses on SELECT statements.

[0067] The first query statement can be either a single clause or a compound clause. When the first query statement is a compound clause, it can include multiple clauses. Taking the SELECT statement as an example, a SELECT statement can include one or more clauses. For instance, when the first query statement is a single SELECT statement, it can include only the SELECT clause. When the SELECT statement is a compound statement, it can include not only the SELECT clause but also one or more FROM clauses, WHERE clauses, etc. The SELECT clause begins with the keyword SELECT, the FROM clause begins with the keyword FROM, and the WHERE clause begins with the keyword WHERE.

[0068] For example, suppose the SQL text contains two query statements:

[0069] (1) The first query statement is:

[0070] INSERT INTO PTP()

[0071] SELECT

[0072] 7.2*PRO.PO_AMT AS USD_AMT

[0073] FROM PRO

[0074] WHERE

[0075] PRO.BUSINESS_TYPE = 'GP'

[0076] INSERT INTO is a keyword used to insert new rows of data into a table. Therefore, INSERT INTOPTP() is an INSERT INTO clause that begins with the keyword INSERT INTO.

[0077] SELECT is the keyword used to retrieve data from a data table. Therefore, SELECT RATE.USD_RATE*PRO.AMT AS USD_AMT is a SELECT clause that begins with the keyword SELECT. AS is the keyword used to specify aliases for columns or tables in the query results. 7.2*PRO.AMT AS USD_AMT means that the result of 7.2*PRO.AMT is assigned the alias USD_AMT, where 7.2 is a constant, * is the multiplication operator, and PRO.AMT is a field in the data table PRO.

[0078] FROM specifies the name of the data table from which data is to be retrieved. Therefore, FROM PRO and RATE are FROM clauses that begin with the keyword FROM.

[0079] The WHERE clause specifies a condition to filter the retrieved data. Therefore, WHEREPRO.BUSINESS_TYPE = 'GP' is a WHERE clause starting with the keyword WHERE, PRO.BUSINESS_TYPE = 'GP' is the filtering condition, and PRO.BUSINESS_TYPE is a field in the PRO table.

[0080] In summary, the entire SQL statement means to filter data that meets the filtering conditions from the PRO data table, extract PRO.AMT from the data that meets the filtering conditions, assign the result of the 7.2*PRO.AMT operation as PO_AMT, and insert PO_AMT into the PTP data table.

[0081] (2) The second query statement is:

[0082] INSERT INTO PRO()

[0083] SELECT

[0084] PO.UNIT_PRICE*(PO.QUANTITY-PO.CANCEL_QTY)AS PO_AMT,

[0085] DECODE(PO.SOURCE_CODE,'ERP1','GP')AS BUSINESS_TYPE

[0086] FROM PO

[0087] INSERT INTO is a keyword used to insert new rows of data into a table. Therefore, INSERT INTOPTP() is an INSERT INTO clause that begins with the keyword INSERT INTO.

[0088] SELECT is the keyword used to retrieve data from a data table. Therefore, PO.UNIT_PRICE*(PO.QUANTITY-PO.CANCEL_QTY)AS PO_AMT and DECODE(PO.SOURCE_CODE,'ERP1','GP')ASBUSINESS_TYPE are SELECT clauses that begin with the keyword SELECT. AS is the keyword used to specify aliases for columns or tables in the query results. PO.UNIT_PRICE*(PO.QUANTITY-PO.CANCEL_QTY)AS PO_AMT means that the result of PO.UNIT_PRICE*(PO.QUANTITY-PO.CANCEL_QTY) is aliased as PO_AMT. Here, PO.UNIT_PRICE, PO.QUANTITY, and PO.CANCEL_QTY are all fields in the data table PO. * is the multiplication operator, and - is the subtraction operator. DECODE(PO.SOURCE_CODE,'ERP1','GP')AS The meaning of BUSINESS_TYPE is to compare the ERP1 field with the PO.SOURCE_CODE field. If the values ​​of ERP1 and PO.SOURCE_CODE match, GP is returned as the result, with the alias BUSINESS_TYPE. DECODE() is the comparison function, PO.SOURCE_CODE is the field in the data table PO, 'ERP1' is a string, and 'GP' is a string.

[0089] FROM specifies the name of the table from which data is to be retrieved. Therefore, FROM PO is a FROM clause that begins with the keyword FROM, where PO is the data table.

[0090] In summary, the entire SQL statement means to extract PO.UNIT_PRICE, PO.QUANTITY, PO.CANCEL_QTY, and PO.SOURCE_CODE from the PO data table, assign the alias PO_AMT to the result of the operation PO.UNIT_PRICE*(PO.QUANTITY-PO.CANCEL_QTY), assign the alias BUSINESS_TYPE to the result of the operation DECODE(PO.SOURCE_CODE,'ERP1','GP'), and insert PO_AMT and BUSINESS_TYPE into the PRO data table.

[0091] The first query statement used by the tracing system to search the database for identifiers from the first table can be:

[0092] Step 1: The tracing system performs table-level relationship analysis on the program text to obtain the data tables and relationships between them, as well as the correspondence between the data tables and the first query statement. Table-level relationship analysis can be found in existing technologies. After performing table-level relationship analysis on the program text, a directed graph is obtained. The nodes of the graph consist of tables, and the edges consist of DML statements. The edges point from the target table to the source table, where the target table is the table obtained by operating on the source table using DML statements.

[0093] Continuing with the example program text from step S102, after performing table-level relational analysis, a directed graph consisting of PTP, PRO, and PO tables will be obtained. The relationships between PTP, PRO, and PO tables are as follows: PTP points to PRO, and the edge between them represents the first query statement; PRO points to PO, and the edge between them represents the second query statement.

[0094] Step Two: Compare the identifier of the first field with each field in the data table to find the field that matches the identifier of the first field and the target data table containing that field. Continuing with the example from the previous step, when the identifier of the first field is USD_AMT, comparing the identifier of the first field with each field in the PTP table, PRO table, and PO table will find the field USD_AMT, thus determining that the target data table containing the field USD_AMT is the PTP table.

[0095] Step 3: Determine the first query statement based on the target data table and the correspondence between the data table and the query statement. Since the correspondence between the data table and the query statement was already obtained during the table-level relationship analysis of the program text, the first query statement can be obtained by finding the correspondence between the target data table and the query statement. Continuing with the example from the previous step, since the relationship between the data table and the query statement is as follows: the PRO table is the source table of the first query statement, and the PTP table is the target table of the first query statement; the PO table is the source table of the second query statement, and the PRO table is the target table of the second query statement, therefore, if the target data table is determined to be the PTP table, the target statement containing the USD_AMT field can be determined to be the first query statement in the example shown in Step 1.

[0096] S103: The tracing system parses the first query statement into multiple sub-statements, identifies the first target sub-statement that includes the first field and is modified from the first target sub-statement, and determines the source of the first field as the second field based on the first target sub-statement.

[0097] The second field is used for modification operations to obtain the first field. These modification operations can include one or more of the following: processing operations, filtering operations, and value retrieval operations. In other words, the relationship between the second and first fields mainly falls into two categories:

[0098] The first method involves processing the second field to obtain the first field. Processing operations can include mathematical operations, logical operations, bitwise operations, comparison operations, assignment operations, matrix operations, vector operations, etc. Data operations can include addition, subtraction, multiplication, and division. Logical operations can include AND, OR, and NOT operations. Taking USD_AMT as the first field and the target SQL statement as shown in step S102, we know from the target SQL statement that USD_AMT equals 7.2 * PRO.AMT. Here, the second field is the field PRO.AMT, and the processing operation is to multiply 7.2 by the field PRO.AMT.

[0099] The second method involves filtering the data based on a filtering operation that includes the second field to obtain the first field. The filtering operation can specify conditions that must be met when retrieving or processing data. Taking USD_AMT as the first field and the target SQL statement as exemplified in step S102, the filtering logic of the WHERE clause in the target SQL statement is: PRO.BUSINESS_TYPE = 'GP'. Here, the second field included in the filtering logic is PRO.BUSINESS_TYPE.

[0100] The third method involves retrieving values ​​from the second field to obtain the first field. In other words, the value obtained from the second field is used as the first field without any further processing or filtering.

[0101] Parsing the first query statement into multiple sub-statements, and determining which sub-statements include the first field and whose fields are modified to obtain the first target sub-statement, can be done as follows:

[0102] The target syntax tree is obtained by parsing the first query statement. Based on the target syntax tree, the first query statement is parsed into multiple sub-statements. Among the multiple sub-statements, the first field is identified and modified to obtain the first target sub-statement.

[0103] The target syntax tree consists of nodes and the relationships between them. Each node represents a syntax element in the first query statement, and the relationships between nodes represent the hierarchical structure and dependencies between syntax elements. Syntax elements can include keywords, constants, variables, operators, etc.

[0104] Keywords can be keywords in the first query statement, such as SELECT, FROM, WHERE, AS, etc. in the first query statement exemplified in step S102.

[0105] The constant can be a constant in the first query statement, such as 7.2 in the first query statement of the example in step S102, etc.

[0106] The variable can be a variable in the first query statement, such as PRO.PO_AMT and USD_AMT in the first query statement in the example in step S102.

[0107] Operators are symbols in the first query statement, such as *, =, etc. in the two query statements exemplified in step S102.

[0108] The hierarchical structure and dependencies between syntax elements are illustrated in the statement `SELECT 7.2*PRO.PO_AMT AS USD_AMT`. The hierarchical structure is as follows: under the keyword `SELECT` are the constant `7.2`, the variable `PRO.PO_AMT`, the keyword `AS`, and the variable `USD_AMT`. Alternatively, the constant `7.2`, the variable `PRO.PO_AMT`, the keyword `AS`, and the variable `USD_AMT` depend on the keyword `SELECT`.

[0109] Correspondingly, the nodes corresponding to these syntax elements can include:

[0110] The nodes corresponding to the keywords are, for example, SELECT nodes, FROM nodes, WHERE nodes, etc. Specifically, the SELECT node corresponds to the keyword SELECT in the first query statement, the FROM node corresponds to the keyword FROM in the first query statement, the WHERE node corresponds to the keyword WHERE in the first query statement, and the AS node corresponds to the keyword AS in the first query statement.

[0111] The nodes corresponding to constants, such as the 7.2 node, etc. The 7.2 node corresponds to the constant 7.2 in the first query statement.

[0112] The nodes corresponding to the variables, such as the PRO.PO_AMT node, the USD_AMT node, etc. Specifically, the PRO.PO_AMT node corresponds to the variable PRO.PO_AMT in the first query statement, and the USD_AMT node corresponds to the variable USD_AMT in the first query statement.

[0113] The nodes corresponding to the operators, such as the multiplication sign (*) node and the equals sign (=) node. Specifically, the multiplication sign node corresponds to the * operator in the first query statement, and the equals sign node corresponds to the = operator in the first query statement.

[0114] In addition to the grammatical elements and their corresponding nodes mentioned above, the target syntax tree also includes other grammatical elements and their corresponding nodes, which are not specifically limited here.

[0115] The relationships between nodes correspond to the hierarchical structure and dependencies between syntax elements. For example, the keyword SELECT includes the constant 7.2, the variable PRO.PO_AMT, the keyword AS, and the variable USD_AMT. Therefore, the relationships between the nodes are as follows: the SELECT node is the parent node, and the child nodes under the SELECT node are the 7.2 node, the PRO.PO_AMT node, the AS node, and the USD_AMT node.

[0116] In a specific embodiment, when the first query statement is a target SQL statement, the target syntax tree can be a target SQL syntax tree (SQL syntax tree), etc. Continuing with the example of the target SQL statement in step S102, the target SQL syntax tree corresponding to this target SQL statement can be as follows: Figure 4 As shown:

[0117] The target SQL syntax tree includes: a Query_BLOCK node, under which are SELECT, FROM, and WHERE nodes. Under the SELECT node is the express1 node, which in turn includes the USD_AMT, 7.2, multiplication sign, PRO.PO_AMT, and AS nodes. Under the FROM node is the PO node. Under the WHERE node is the express2 node, which in turn includes:

[0118] To make the relationships between nodes more intuitive, the target SQL syntax tree above is a simplified version. In practical applications, the target SQL syntax tree will have more nodes and the relationships between nodes will be more complex.

[0119] The source tracing system parses the target SQL statement to obtain the target SQL syntax tree by inputting the target SQL statement into a specialized tool or library. Specialized tools can include Another Tool for Language Recognition (ANTLR), ANTLR4, PLY (PythonLex-Yacc), tree-sitters, and ANTLRWorks, among others. Specialized libraries can include the sqlparse library in Python.

[0120] Based on the target syntax tree, the first query statement is parsed into multiple sub-statements. The process of determining that the first field is the source of the second field, and identifying the first target sub-statement that includes the first field and is modified from it, can be as follows: Continue using... Figure 4 The target syntax tree shown is an example of the target SQL syntax tree, such as... Figure 5 As shown, based on the target syntax tree, the first query statement is parsed into multiple sub-statements. The process of determining that the first field is derived from the first target sub-statement, and that the first field is modified from the first target sub-statement, is as follows:

[0121] S1031: The traceability system interprets the WITH AS node of the target SQL syntax tree and the nodes under the WITH AS node to obtain the WITH AS clause, and determines whether the WITH AS clause includes the first field and the field is modified to obtain the first target sub-statement. If the WITH AS clause is the first target sub-statement, the source of the first field is determined to be the second field based on the WITH AS clause.

[0122] The tracing system traverses the target SQL syntax tree to search for the WITH AS node. If no WITH AS node is found after traversing the target SQL syntax tree, it proceeds directly to step S1032. When a WITH AS node is found, the WITH AS clause is located. The WITH AS node and its subordinate nodes are analyzed. For example, it checks whether any of the subordinate nodes of the WITH AS node contain an AS node. After finding the AS node, it determines whether the node to the right of the AS node corresponds to the first field. If the node to the right of the AS node is the USD_AMT node, it checks whether any variable nodes exist among the nodes to the left of the AS node. If variable nodes exist, the WITH AS clause is determined to be the first target sub-statement, and the variable corresponding to the variable node is used as the second field, proceeding to step S1032. If no AS node exists or no variable node exists to the left of the AS node, it proceeds to step S1032.

[0123] The target SQL statement exemplified in step S102 and Figure 4 Taking the target SQL syntax tree shown as an example, since the target syntax tree does not include the WITH AS node, we can directly proceed to step S1032.

[0124] S1032: The tracing system interprets the SELECT node and the nodes under the SELECT node of the target SQL syntax tree to obtain the SELECT clause, and determines whether the SELECT clause includes the first field and the field is modified to obtain the first target sub-statement. If the SELECT clause is the first target sub-statement, the source of the first field is determined to be the second field based on the SELECT clause.

[0125] The tracing system traverses the target SQL syntax tree to search for the SELECT node. If no SELECT node is found after traversing the target SQL syntax tree, it proceeds directly to step S1033. When a SELECT node is found, the SELECT clause is located. The SELECT node and its subordinate nodes are analyzed. For example, it checks whether an AS node exists among the subordinate nodes of the SELECT node. After finding the AS node, it determines whether the node to the right of the AS node is the node corresponding to the first field (e.g., the USD_AMT node). If the node to the right of the AS node is the USD_AMT node, it checks whether a variable node exists among the nodes to the left of the AS node. If a variable node exists, it determines that the SELECT clause is the first target sub-statement, and the variable corresponding to the variable node is used as the second field, proceeding to step S1033. If no AS node exists or no variable node exists to the left of the AS node, it proceeds to step S1033.

[0126] Continuing with the target SQL statement exemplified in step S102, and Figure 4 Taking the target SQL syntax tree shown as an example, after finding the SELECT node, the AS node, a child node of the SELECT node, is searched. After finding the AS node, it is determined whether the node to the right of the AS node is the node corresponding to the first field (i.e., the USD_AMT node). If the node to the right of the AS node is the USD_AMT node, then the nodes to the left of the AS node are found, including the 7.2 node, the multiplication sign node, the PRO.PO_AMT node, etc. Among them, the PRO.PO_AMT node is a variable node, therefore, PRO.PO_AMT can be extracted as the second field.

[0127] S1033: The source tracing system interprets the FORM node and the nodes under the FORM node of the target SQL syntax tree to obtain the FORM clause, and determines whether the FORM clause includes the first field and the field is modified to obtain the first target sub-statement. If the FORM clause is the first target sub-statement, the source of the first field is determined to be the second field according to the FORM clause.

[0128] The tracing system traverses the target SQL syntax tree to search for the FORM node. If no FORM node is found after traversing the target SQL syntax tree, it directly proceeds to step S1034. When a FORM node is found, the FORM clause is located. The FORM node and its subordinate nodes are analyzed. For example, it checks whether there is an equals sign node among the subordinate nodes of the FORM node. After finding the equals sign node, it determines whether the node to the right of the equals sign node is a constant node. If the node to the right of the equals sign node is a constant node, it checks whether there is a variable node among the nodes to the left of the equals sign node. If a variable node exists, it determines that the FORM clause is the first target sub-statement, and the variable corresponding to the variable node is used as the second field, proceeding to step S1034. If no equals sign node exists or no variable node exists to the left of the equals sign node, it proceeds to step S1034.

[0129] Continuing with the target SQL statement exemplified in step S102, and Figure 4 Taking the target SQL syntax tree shown as an example, although the target syntax tree includes the FROM node, it only includes the PRO node under the FROM node and does not include the equal sign node. Therefore, we directly proceed to step S1034.

[0130] S1034: The source tracing system interprets the WHERE node and the nodes under the WHERE node of the target SQL syntax tree to obtain the WHERE clause, and determines whether the WHERE clause includes the first field and the field is modified to obtain the first target sub-statement. If the WHERE clause is the first target sub-statement, the source of the first field is determined to be the second field based on the WHERE clause.

[0131] The tracing system traverses the target SQL syntax tree to search for the WHERE node. If no WHERE node is found after traversing the target SQL syntax tree, it directly proceeds to step S1035. When a WHERE node is found, the SELECT clause is located. The WHERE node and its subordinate nodes are analyzed. For example, it checks whether an equals sign node exists among the subordinate nodes of the WHERE node. After finding an equals sign node, it determines whether the node to the right of the equals sign node is a constant node. If the node to the right of the equals sign node is a constant node, it checks whether a variable node exists among the nodes to the left of the equals sign node. If a variable node exists, it determines that the FORM clause is the first target sub-statement, and uses the variable corresponding to the variable node as the second field, proceeding to step S1035. If no equals sign node exists or no variable node exists to the left of the equals sign node, it proceeds to step S1035.

[0132] Continuing with the target SQL statement exemplified in step S102, and Figure 4 Taking the target SQL syntax tree shown as an example, when the WHERE node is found, the WHERE node and the nodes under the WHERE node are analyzed to determine that there are equal sign nodes among the subordinate nodes of the WHERE node. After finding the equal sign node, it is determined that the node to the right of the equal sign node is a constant node (GP node). The node to the left of the equal sign node is found to be the variable node PRO.BUSINESS_TYPE node. Therefore, the variable PRO.BUSINESS_TYPE corresponding to the PRO.BUSINESS_TYPE node is extracted as the second field.

[0133] S1035: The tracing system finds the second table containing the second field based on the FROM node in the target SQL syntax tree.

[0134] Since the existence of a second field implies the existence of a second table containing that second field, the target SQL statement will always contain a FROM clause if the second field exists. Therefore, the target SQL syntax tree will naturally include a FROM node. Because the relationship between fields and tables was already established during data lineage analysis, once the second field is obtained, the second table containing it can be determined based on the second field and the relationship between fields and tables.

[0135] Continuing with the target SQL statement exemplified in step S102, and Figure 4 Taking the target SQL syntax tree shown as an example, the second field includes the fields PRO.PO_AMT and PRO.BUSINESS_TYPE. Based on the correspondence between the field PRO.PO_AMT and the PRO table, it can be determined that the table containing the second field PRO.PO_AMT is the PRO data table, and based on the correspondence between the field PRO.BUSINESS_TYPE and the PRO table, it can be determined that the table containing the second field PRO.BUSINESS_TYPE is the PRO data table.

[0136] It is understood that the execution steps S1031 to S1034 can be performed in any order. For example, step S1033 can be executed first, followed by step S1034, or step S1034 can be executed first, followed by step S1033, or steps S1033 and S1034 can be executed simultaneously. No specific limitation is made here.

[0137] S104: The tracing system searches the database for a second query statement that includes the identifier of the second table.

[0138] The second query statement can be a single clause or a compound clause. When the second query statement is a compound clause, it can include multiple clauses. Taking a SELECT statement as an example, a SELECT statement can include one or more clauses. For instance, when the SELECT statement is a single clause, it can only include the SELECT clause; when the SELECT statement is a compound clause, it can include one or more clauses such as FROM and WHERE, in addition to the SELECT clause. The SELECT clause begins with the keyword SELECT, the FROM clause begins with the keyword FROM, and the WHERE clause begins with the keyword WHERE.

[0139] The tracing system can find the second query statement containing the second field from the program text using the second field as a basis, which could be done as follows:

[0140] The second query statement is determined based on the correspondence between the second table, the data table, and the query statement. Since the correspondence between the data table and the query statement was already obtained during the table-level relationship analysis of the program text, the second query statement can be obtained by finding the correspondence between the data table and the query statement. Continuing with the example in step S102, since the relationship between the data table and the query statement is as follows: the PRO table is the source table of the first query statement, and the PTP table is the target table of the first query statement; the PO table is the source table of the second query statement, and the PRO table is the target table of the second query statement, therefore, given that the second table is the PRO table, finding the statement with the PRO table as the target table as the second query statement allows us to determine that the second query statement containing the fields PRO.BUSINESS_TYPE and PRO.PO_AMT is the second query statement in the example shown in step S102.

[0141] S105: The tracing system parses the second query statement into multiple sub-statements, identifies the sub-statement that includes the second field and is modified to obtain the second target sub-statement, and determines the source of the second field as the third field based on the second target sub-statement.

[0142] The third field is used for modification operations to obtain the second field. These modification operations can include one or more of the following: processing operations, filtering operations, and value retrieval operations. In other words, the relationship between the third field and the second field mainly includes two types:

[0143] The first method involves processing the third field to obtain the second field. Processing operations can include mathematical operations, logical operations, bitwise operations, comparison operations, assignment operations, matrix operations, vector operations, etc. Data operations can include addition, subtraction, multiplication, and division. Logical operations can include AND, OR, and NOT operations. Taking the second field as PO_AMT and the second query statement as the example in step S104, we know from the second query statement that PO_AMT equals PO.UNIT_PRICE * (PO.QUANTITY - PO.CANCEL_QTY). Here, the third field includes the fields PO.UNIT_PRICE, PO.QUANTITY, and PO.CANCEL_QTY. The processing operation is the difference between PO.QUANTITY and PO.CANCEL_QTY, multiplied by PO.UNIT_PRICE. Taking BUSINESS_TYPE as the second field and the second query statement as the example in step S104, we can see from the second query statement that BUSINESS_TYPE is equal to DECODE(PO.SOURCE_CODE,'ERP1','GP'). Here, the third field is PO.SOURCE_CODE, and the processing operation is to input PO.SOURCE_CODE as a parameter into the function for processing.

[0144] The second method involves filtering based on a third field to obtain the second field. The filtering operation can be found in the description above.

[0145] The third method involves retrieving the value from the third field to obtain the value of the second field. In other words, the value obtained from the third field is used as the value of the second field without any further processing or filtering.

[0146] Parsing the second query statement into multiple sub-statements, and determining which sub-statements include the second field and whose fields are modified to obtain the second target sub-statement, can be done as follows:

[0147] The source syntax tree is obtained by parsing the second query statement. Based on the source syntax tree, the second query statement is parsed into multiple sub-statements. Among the multiple sub-statements, the second target sub-statement is obtained by determining that the second field is included and that the field is modified.

[0148] The source syntax tree consists of nodes and the relationships between them. Each node represents a syntax element in the second query statement, and the relationships between nodes represent the hierarchical structure and dependencies between syntax elements. Syntax elements can include keywords, constants, variables, operators, etc.

[0149] Keywords can be keywords in the second query statement, such as SELECT, FROM, AS, etc. in the second query statement exemplified in step S102.

[0150] The constant can be a constant in the second query statement, such as ERP1, GP, etc. in the second query statement exemplified in step S102.

[0151] The variables can be variables in the second query statement, such as PO.UNIT_PRICE, PO.QUANTITY, PO.CANCEL_QTY, PO_AMT, etc. in the second query statement exemplified in step S102.

[0152] Operators are symbols in the second query statement, such as *, -, etc. in the second query statement exemplified in step S102.

[0153] The hierarchical structure and dependencies between syntactic elements, for example, in the statement `SELECT PO.UNIT_PRICE*(PO.QUANTITY-PO.CANCEL_QTY)AS PO_AMT`, the hierarchical structure of the syntactic elements is as follows: under the keyword `SELECT` are the variable `PO.UNIT_PRICE`, the operator `*`, the variable `PO.QUANTITY`, the operator `-`, the variable `PO.CANCEL_QTY`, the keyword `AS`, and the variable `PO_AMT`. Alternatively, it can be said that the variables `PO.UNIT_PRICE`, `*`, `PO.QUANTITY`, `-`, `PO.CANCEL_QTY`, the keyword `AS`, and the variable `PO_AMT` depend on the keyword `SELECT`.

[0154] Correspondingly, the nodes corresponding to these syntax elements can include:

[0155] The nodes corresponding to the keywords are, for example, SELECT nodes, FROM nodes, WHERE nodes, etc. Specifically, the SELECT node corresponds to the keyword SELECT in the second query statement, the FROM node corresponds to the keyword FROM in the second query statement, and the AS node corresponds to the keyword AS in the second query statement.

[0156] The nodes corresponding to constants are, for example, the ERP1 node, the GP node, etc. Among them, the ERP1 node corresponds to the constant ERP1 in the second query statement, and the GP node corresponds to the constant GP in the second query statement.

[0157] The nodes corresponding to the variables are, for example, the PO.UNIT_PRICE node, the PO.QUANTITY node, the PO.CANCEL_QTY node, the PO_AMT node, etc. Specifically, the PO.UNIT_PRICE node corresponds to the variable PO.UNIT_PRICE in the second query statement, the PO.CANCEL_QTY node corresponds to the variable PO.CANCEL_QTY in the second query statement, and the PO_AMT node corresponds to the variable PO_AMT in the second query statement.

[0158] The nodes corresponding to the operators, such as the multiplication node and the - node. Specifically, the multiplication node corresponds to the * operator in the second query statement, and the - node corresponds to the - operator in the second query statement.

[0159] In addition to the grammatical elements and their corresponding nodes mentioned above, the source syntax tree also includes other grammatical elements and their corresponding nodes, which are not specifically limited here.

[0160] The relationships between nodes correspond to the hierarchical structure and dependencies between syntax elements. For example, the keyword SELECT includes the variable PO.UNIT_PRICE, the operator *, the variable PO.QUANTITY, the operator -, the variable PO.CANCEL_QTY, the keyword AS, and the variable PO_AMT. Therefore, the relationships between the nodes are as follows: the SELECT node is the parent node, and the child nodes under the SELECT node are the PO.UNIT_PRICE node, the multiplication sign node, the PO.QUANTITY node, the - node, the PO.CANCEL_QTY node, the AS node, and the PO_AMT node.

[0161] In a specific embodiment, when the second query statement is an SQL statement, the source syntax tree can be a source SQL syntax tree, etc. Continuing with the example of the second query statement in step S102, the source SQL syntax tree corresponding to this second query statement can be as follows: Figure 6 As shown:

[0162] The source SQL syntax tree includes: the Query_BLOCK node, which contains SELECT and FROM nodes. The SELECT node contains express3 and express4 nodes. The express3 node contains PO.UNIT_PRICE, multiplication, PO.QUANTITY, -, PO.CANCEL_QTY, AS, and PO_AMT nodes. The express4 node contains DECODE, PO.SOURCE_CODE, ERP1, GP, AS, and BUSINESS_TYPE nodes. The FROM node contains PO nodes. In this context, the Query_BLOCK node represents SELECTPO.UNIT_PRICE*(PO.QUANTITY-PO.CANCEL_QTY)AS PO_AMT, DECODE(PO.SOURCE_CODE,'ERP1','GP')AS BUSINESS_TYPE FROM PO, the express3 node represents PO.UNIT_PRICE*(PO.QUANTITY-PO.CANCEL_QTY)AS PO_AMT, and the express4 node represents DECODE(PO.SOURCE_CODE,'ERP1','GP')AS BUSINESS_TYPE.

[0163] To make the relationships between nodes more intuitive, the source SQL syntax tree above is a simplified version. In practical applications, the source SQL syntax tree will have more nodes and the relationships between nodes will be more complex.

[0164] The source tracing system parses the source SQL statement to obtain the source SQL syntax tree by inputting the source SQL statement into a specialized tool or library. Specialized tools can include Another Tool for Language Recognition (ANTLR), ANTLR4, PLY (PythonLex-Yacc), tree parsers, and ANTLRWorks, among others. Specialized libraries can include the sqlparse library in Python.

[0165] Based on the source SQL syntax tree, the second query statement is parsed into multiple sub-statements. The process of determining that the second field is the source of the third field, and identifying the second target sub-statement that includes the second field and is modified from it, can be as follows: Continue using... Figure 6The source syntax tree shown is an example of a source SQL syntax tree, such as... Figure 7 As shown, based on the source syntax tree, the second query statement is parsed into multiple sub-statements. The process of determining that the second field is derived from the second target sub-statement, and then determining that the source of the second field is the third field based on the second target sub-statement, is as follows:

[0166] S1051: The traceability system interprets the WITH AS node and the nodes under the WITH AS node in the traceability SQL syntax tree to obtain the WITH AS clause, and determines whether the WITH AS clause includes the second field and the field is modified to obtain the second target sub-statement. If the WITH AS clause is the second target sub-statement, the source of the second field is determined to be the third field based on the WITH AS clause.

[0167] The tracing system traverses the source SQL syntax tree to search for the WITH AS node. If no WITH AS node is found after traversing the entire source SQL syntax tree, it proceeds directly to step S1052. When a WITH AS node is found, the WITH AS clause is located. The WITH AS node and its subordinate nodes are analyzed. For example, it checks whether any of the subordinate nodes of the WITH AS node contain an AS node. After finding the AS node, it determines whether the node to the right of the AS node corresponds to the second field. If the node to the right of the AS node corresponds to the second field, it checks whether any variable nodes exist among the nodes to the left of the AS node. If variable nodes exist, the WITH AS clause is determined to be the second target sub-statement, and the variable corresponding to the variable node is used as the third field, proceeding to step S1052. If no AS node exists or no variable node exists to the left of the AS node, it proceeds to step S1052.

[0168] The source SQL statement exemplified in step S104 and Figure 6 Taking the traceability SQL syntax tree shown as an example, since the traceability syntax tree does not include the WITH AS node, we can directly proceed to step S1052.

[0169] S1052: The tracing system interprets the SELECT node and the nodes under the SELECT node in the tracing SQL syntax tree to obtain the SELECT clause, and determines whether the SELECT clause includes the second field and the field is modified to obtain the second target sub-statement. If the SELECT clause is the second target sub-statement, the source of the second field is determined to be the third field based on the SELECT clause.

[0170] The tracing system traverses the source SQL syntax tree to search for the SELECT node. If no SELECT node is found after traversing the entire source SQL syntax tree, it proceeds directly to step S1053. When a SELECT node is found, the SELECT clause is located. The SELECT node and its subordinate nodes are analyzed. For example, it checks if an AS node exists among the subordinate nodes of the SELECT node. After finding the AS node, it determines whether the node to the right of the AS node corresponds to the second field (e.g., the PO_AMT node). If the node to the right of the AS node corresponds to the second field, it checks if a variable node exists among the nodes to the left of the AS node. If a variable node exists, it determines that the SELECT clause is the second target sub-statement, and the variable corresponding to the variable node is used as the third field, proceeding to step S1053. If no AS node exists or no variable node exists to the left of the AS node, it proceeds to step S1053.

[0171] For example, check if a function node (e.g., a DECODE function node) exists in the subordinate nodes of the SELECT node. After finding the function node, determine if a variable node exists in the subordinate nodes of the function node. If a variable node exists, use the variable corresponding to the variable node as the third field and proceed to step S1053. If no function node exists, or if no variable node exists in the subordinate nodes of the function node, proceed to step S1053.

[0172] Continuing with the source SQL statement example in step S104 and Figure 6Taking the source SQL syntax tree shown as an example, after finding the SELECT node, the AS node, a child node of the SELECT node, is searched. After finding the AS node, it is determined whether the node to the right of the AS node is the node corresponding to the second field (i.e., the PO_AMT node). If the node to the right of the AS node is the PO_AMT node, then the nodes to the left of the AS node are found, including the PO.UNIT_PRICE node, the multiplication sign node, the PO.QUANTITY node, the - node, the PO.CANCEL_QTY node, etc. Among them, the PO.UNIT_PRICE node, the PO.QUANTITY node, and the PO.CANCEL_QTY node are variable nodes. Therefore, the PO.UNIT_PRICE node, the PO.QUANTITY node, and the PO.CANCEL_QTY node can be extracted as the third field. Then, the function node, namely the DECODE function node, is found among the subordinate nodes of the SELECT node. After finding the DECODE function node, it is determined that there is a variable node, namely the PO.SOURCE_CODE node, among the subordinate nodes of the DECODE function node, and the variable PO.SOURCE_CODE corresponding to the PO.SOURCE_CODE node is used as the third field.

[0173] S1053: The source tracing system interprets the FORM node and the nodes under the FORM node in the source SQL syntax tree to obtain the FORM clause, and determines whether the FORM clause includes the second field and the field is modified to obtain the second target sub-statement. If the FORM clause is the second target sub-statement, the source of the second field is determined to be the third field based on the FORM clause.

[0174] The tracing system traverses the source SQL syntax tree to search for the FORM node. If no FORM node is found after traversing the target SQL syntax tree, it proceeds directly to step S1054. When a FORM node is found, the FORM clause is located. The FORM node and its subordinate nodes are analyzed. For example, it checks whether an equals sign node exists among the subordinate nodes of the FORM node. After finding the equals sign node, it determines whether the node to the right of the equals sign node is a constant node. If the node to the right of the equals sign node is a constant node, it checks whether a variable node exists among the nodes to the left of the equals sign node. If a variable node exists, it determines that the FORM clause is the second target sub-statement, and the variable corresponding to the variable node is used as the third field, proceeding to step S1054. If no equals sign node exists or no variable node exists to the left of the equals sign node, it proceeds to step S1054.

[0175] Continuing with the source SQL statement example in step S104 and Figure 6Taking the source SQL syntax tree shown as an example, although the target syntax tree includes the FROM node, it only includes the PO node and does not include the equal sign node. Therefore, it directly proceeds to step S1054.

[0176] S1054: The tracing system finds the third table containing the third field based on the FROM node in the tracing SQL syntax tree.

[0177] Since the existence of a third field implies the existence of a second table containing that third field, the source SQL statement will always contain a FROM clause if a third field exists. Therefore, the source SQL syntax tree will naturally include a FROM node. Because the relationship between fields and tables has already been established through data lineage analysis, once the third field is obtained, the third table containing it can be determined based on the third field and its relationship with the tables.

[0178] Continuing with the source SQL statement example in step S104 and Figure 6 Taking the traceability SQL syntax tree shown as an example, the third field includes fields PO.UNIT_PRICE, PO.QUANTITY, PO.CANCEL_QTY, and PO.SOURCE_CODE. Based on the correspondence between fields PO.UNIT_PRICE, PO.QUANTITY, PO.CANCEL_QTY, and PO.SOURCE_CODE and the PO table, it can be determined that the third field, namely, fields PO.UNIT_PRICE, PO.QUANTITY, PO.CANCEL_QTY, and PO.SOURCE_CODE, is located in the third table PRO.PO_AMT, which is the PO data table.

[0179] It is understood that the execution steps S1051 to S1053 can be performed in any order. For example, step S1053 can be executed first, followed by step S1054, or step S1054 can be executed first, followed by step S1053, or steps S1053 and S1054 can be executed simultaneously. No specific limitation is made here.

[0180] Therefore, by following the steps described above, we can find and identify... Figure 8The relationships shown are as follows: the field USD_AMT can be traced back to the fields PRO.BUSINESS_TYPE, PRO.AMT, and RATE.USD_RATE; the field PRO.BUSINESS_TYPE can be traced back to the field PO.SOURCE_CODE; and the field PRO.AMT can be traced back to the fields PO.UNIT_PRICE, PO.QUANTITY, and PO.CANCEL_QTY.

[0181] It is understandable that the above example only illustrates the two-level tracing method. In practical applications, tracing can continue. For example, tracing can continue on the field PO.CANCEL_QTY until the tracing reaches the specified number of levels or until the last level is reached.

[0182] The following sections will provide a detailed introduction to field tracing systems, field tracing devices, computing equipment, computing equipment clusters, computer program products, and computer-readable storage media.

[0183] See Figure 9 , Figure 9 This is a structural diagram of a field tracing system provided in this application. For example... Figure 9 As shown, the field tracing system of this application includes: a client 210 and a field tracing device 220.

[0184] Client 210 is used to send a tracing request, which includes the identifier of the first table and the identifier of the first field in the first table.

[0185] The field tracing device 220 is used to obtain a tracing request, search for a query statement in the database that includes the identifier of the first table, the database including executed query statements, parse the query statement into multiple sub-statements, determine the target sub-statement that includes the first field and that the field is modified, and determine the source of the first field based on the target sub-statement, the source indicating that the field is obtained by modifying the second field in the second table.

[0186] Both the field tracing device 220 and the client 210 can be implemented in software or hardware. For example, the implementation of the field tracing device 220 will be described below. Similarly, the implementation of the client 210 can refer to the implementation of the field tracing device 220.

[0187] As an example of a software functional unit, the field tracing device 220 may include code running on a computing instance. The computing instance may be at least one of a physical host (computing device), a virtual machine, a container, or other computing devices. Further, the aforementioned computing device may be one or more. For example, the field tracing device 220 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the application may be distributed in the same region or in different regions. The multiple hosts / virtual machines / containers used to run the code may be distributed in the same Availability Zone (AZ) or in different AZs, each AZ including one or more geographically proximate data centers. Typically, a region may include multiple AZs.

[0188] Similarly, multiple hosts / virtual machines / containers used to run this code can be distributed within the same VPC or across multiple VPCs. Typically, a VPC is set up within a single region. Communication between two VPCs within the same region, and between VPCs in different regions, requires a communication gateway to be set up within each VPC to enable interconnection between VPCs.

[0189] As an example of a hardware functional unit, the field tracing device 220 may include at least one computing device, such as a server. Alternatively, the field tracing device 220 may also be a device implemented using a CPU, ASIC, PLD, CPLD, FPGA, GAL, DPU, NPU, SoC, offload card, accelerator card, etc. The aforementioned PLD may be implemented using a CPLD, FPGA, GAL, or any combination thereof.

[0190] The field tracing device 220 includes multiple computing devices that can be distributed in the same region or in different regions. Similarly, the multiple computing devices in the field tracing device 220 can be distributed in the same Availability Zone (AZ) or in different AZs. Likewise, the multiple computing devices in the field tracing device 220 can be distributed in the same Virtual Private Cloud (VPC) or in multiple VPCs. These multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, GALs, DPUs, NPUs, SoCs, offloading cards, and accelerator cards.

[0191] Furthermore, this application also provides a field tracing device 220, such as... Figure 9 As shown, it includes:

[0192] The acquisition module 221 is used to acquire a tracing request, wherein the tracing request includes the identifier of the first table and the identifier of the first field in the first table;

[0193] The lookup module 222 is used to look up a query statement in a database that includes the identifier of the first table, the database including executed query statements;

[0194] Parsing module 223 is used to parse the query statement into multiple sub-statements;

[0195] Determining module 224 is used to determine, among the plurality of sub-statements, a target sub-statement that includes the first field and the field is modified.

[0196] The tracing module 225 is used to determine the source of the first field based on the target sub-statement, wherein the source indicates that the field is obtained by modifying the second field in the second table.

[0197] The acquisition, search, parsing, determination, and tracing modules can all be implemented in software or hardware. For example, the implementation of the parsing module will be described below. Similarly, the implementation methods of the acquisition, search, determination, and tracing modules can refer to the implementation method of the parsing module.

[0198] As an example of a software functional unit, a parsing module may include code running on a compute instance. A compute instance may include at least one of a physical host (computing device), a virtual machine, or a container. Furthermore, the aforementioned compute instance may be one or more. For example, a parsing module may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed within the same region or in different regions. Further, the multiple hosts / virtual machines / containers used to run the code may be distributed within the same availability zone (AZ) or in different AZs, each AZ comprising one or more geographically proximate data centers. Typically, a region may include multiple AZs.

[0199] Similarly, multiple hosts / virtual machines / containers used to run this code can be distributed within the same Virtual Private Cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Communication between two VPCs within the same region, as well as between VPCs in different regions, requires a communication gateway to be set up within each VPC to enable interconnection between VPCs.

[0200] As an example of a hardware functional unit, a parsing module may include at least one computing device, such as a server. Alternatively, a parsing module may be implemented using a central processing unit (CPU), an application-specific integrated circuit (ASIC), or a programmable logic device (PLD). The aforementioned PLD may be implemented using a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), a data processing unit (DPU), a neural network processing unit (NPU), a system-on-chip (SoC), an offload card, an accelerator card, or any combination thereof.

[0201] The multiple computing devices included in the parsing module can be distributed within the same region or in different regions. Similarly, they can be distributed within the same Availability Zone (AZ) or in different AZs. Likewise, they can be distributed within the same Virtual Private Cloud (VPC) or multiple VPCs. These multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, GALs, DPUs, NPUs, SoCs, offloading cards, and accelerator cards.

[0202] It should be noted that, in other embodiments, the parsing module can be used to execute any step in the field tracing, and the acquisition module, search module, determination module, and tracing module can be used to execute any step in the field tracing method. The steps implemented by the parsing module, acquisition module, search module, determination module, and tracing module can be specified as needed. The field tracing device 220 can achieve all its functions by implementing different steps in the field tracing method through the parsing module, acquisition module, search module, determination module, and tracing module.

[0203] This application also provides a chip system including a processor and a power supply circuit. The power supply circuit supplies power to the processor, which executes the operation steps corresponding to the field tracing method. For simplicity, further details are omitted here. The processor can be implemented using a GPU, or it can be implemented using computing devices such as a DPU, NPU, XPU, SoC, offload card, or accelerator card.

[0204] This application also provides a computing device 300. For example... Figure 10 As shown, the computing device 300 includes a bus 302, a processor 304, a memory 306, and a communication interface 308. The processor 304, the memory 306, and the communication interface 308 communicate with each other via the bus 302. The computing device 300 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in the computing device 300.

[0205] Bus 302 can be a Peripheral Component Interconnect Express (PCIe) bus, an Extended Industry Standard Architecture (EISA) bus, a Unified Bus (Ubus or UB), a Compute Express Link (CXL), a Cache Coherent Interconnect for Accelerators (CCIX), etc. The Unified Bus is also known as the Lingqu Bus. Buses can be divided into address buses, data buses, control buses, etc. For ease of representation, Figure 11 The bus 304 is represented by a single line, but this does not mean that there is only one bus or one type of bus. Bus 304 may include pathways for transmitting information between various components of computing device 300 (e.g., memory 306, processor 304, communication interface 308). The unified bus may also be referred to as the Lingqu bus.

[0206] Processor 304 may include any one or more computing devices such as central processing unit (CPU), graphics processing unit (GPU), microprocessor (MP) or digital signal processor (DSP), ASIC, FPGA, CPLD, NPU, SoC, offload card, accelerator card, etc.

[0207] Memory 306 may include volatile memory, such as random access memory (RAM). Processor 304 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD). Furthermore, memory 306 may also be implemented using storage class memory (SCM), phase change memory (PCM), or other types of storage media.

[0208] It is worth noting that the same type of storage medium can be configured in the same computing device to realize the function of memory 306, or two or more types of storage media can be configured to realize the function of memory 306. This application does not limit this.

[0209] The memory 306 stores executable program code, which the processor 304 executes to implement the functions of the aforementioned parsing module, acquisition module, search module, determination module, and tracing module, thereby realizing the field tracing method. In other words, the memory 306 stores instructions for executing the field tracing method.

[0210] Alternatively, the memory 306 stores executable code, which the processor 304 executes to implement the functions of the aforementioned field tracing device 220 and client 210, thereby realizing the field tracing method. That is, the memory 306 stores instructions for executing the field tracing method.

[0211] The communication interface 308 uses transceiver modules, such as, but not limited to, network interface cards and transceivers, to enable communication between the computing device 300 and other devices or communication networks.

[0212] As one possible implementation, the computing device 300 may also include a chip system, which includes a processor and a power supply circuit. The power supply circuit supplies power to the processor, and the processor executes the operation steps corresponding to the field tracing method. For simplicity, further details are omitted here. The processor can be implemented using a GPU, or it can be implemented using computing devices or AI chips such as a DPU, NPU, XPU, SoC, offloading card, or accelerator card.

[0213] As one possible implementation, the computing device 300 may include multiple types of processors 304, meaning the computing device 300 is a heterogeneous device. For example, the computing device 300 may include a CPU and a GPU, and the operation steps corresponding to the field tracing method can be executed by at least one of the processors 304. For the sake of brevity, further details will not be elaborated here.

[0214] This application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.

[0215] like Figure 11 As shown, the computing device cluster includes at least one computing device 300. The memory 306 in one or more computing devices 300 within the computing device cluster may store the same instructions for executing field tracing methods.

[0216] In some possible implementations, the memory 306 of one or more computing devices 300 in the computing device cluster may also store partial instructions for executing the field tracing method. In other words, a combination of one or more computing devices 300 can jointly execute the instructions for executing the field tracing method.

[0217] It should be noted that the memory 306 in different computing devices 300 within the computing device cluster can store different instructions, each used to execute a portion of the functions of the field tracing device 220. That is, the instructions stored in the memory 306 of different computing devices 300 can implement the functions of one or more modules among the parsing module, acquisition module, search module, determination module, and tracing module.

[0218] In some possible implementations, one or more computing devices in a computing device cluster can be connected via a network. This network can be a wide area network (WAN) or a local area network (LAN), etc. Figure 12 One possible implementation is shown. For example... Figure 12As shown, the two computing devices 300A and 300B are connected via a network. Specifically, they are connected to the network through communication interfaces in each computing device. In this possible implementation, the memory 306 in computing device 300A stores instructions for executing the parsing module. Simultaneously, the memory 306 in computing device 300B stores instructions for executing the acquisition module, search module, determination module, and tracing module.

[0219] Figure 12 The connection method between the computing device clusters shown can be such that, considering the field tracing method provided in this application requires a large amount of data storage and a large amount of computation, the functions implemented by the acquisition module, search module, determination module and tracing module are delegated to the computing device 300B for execution.

[0220] It should be understood that Figure 12 The functions of the computing device 300A shown can also be performed by multiple computing devices 300. Similarly, the functions of the computing device 300B can also be performed by multiple computing devices 300.

[0221] This application also provides another computing device cluster. The connection relationships between the computing devices in this computing device cluster can be similarly referred to... Figure 11 as well as Figure 12 The connection method of the computing device cluster is different in that the memory 306 of one or more computing devices 300 in the computing device cluster can store the same instructions for executing the field tracing method.

[0222] In some possible implementations, the memory 306 of one or more computing devices 300 in the computing device cluster may also store partial instructions for executing the field tracing method. In other words, a combination of one or more computing devices 300 can jointly execute the instructions for executing the field tracing method.

[0223] It should be noted that the memory 306 in different computing devices 300 within the computing device cluster can store different instructions for executing some functions of the field traceability system. That is, the instructions stored in the memory 306 of different computing devices 300 can implement the functions of one or more devices in the field traceability device 220 and the client 210.

[0224] This application also provides a computer program product containing instructions. The computer program product may be a software or program product containing instructions, capable of running on a computing device or stored on any usable medium. When the computer program product is run on at least one computing device, it causes the at least one computing device to execute a field tracing method, or a field tracing method.

[0225] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computing device can store, or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to perform a field tracing method, or instruct the computing device to perform a field tracing method.

[0226] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of this application.

Claims

1. A method for tracing the origin of a field, characterized in that, The method includes: Obtain a tracing request, wherein the tracing request includes the identifier of the first table and the identifier of the first field in the first table; Search the database for query statements that include the identifier of the first table, the database including executed query statements; The query statement is parsed into multiple sub-statements; Among the plurality of sub-statements, the first field is identified, and the field is the target sub-statement obtained by modification. The source of the first field is determined based on the target sub-statement, where the source indicates that the field is obtained by modifying the second field in the second table.

2. The method according to claim 1, characterized in that, The step of determining the target sub-statement that includes the first field among the plurality of sub-statements and that the field is modified to obtain the target sub-statement includes: Find the sub-statement that includes the field; The target substatement is found among the substatements that include the field and contain the keyword indicating a modification operation.

3. The method according to claim 1, characterized in that, Determining the source of the field based on the target sub-statement includes: The target sub-statement is matched according to a preset relational rule, which is used to represent the modification operation performed on the field; If the first field of the target sub-statement and the second field of the second table match the relation rule, then the second field of the second table is determined to be the source of the first field.

4. The method according to claim 1, characterized in that, The modification operation includes one or more combinations of processing operations, filtering operations, and value retrieval operations, wherein... The processing operations include one or more of the following: mathematical operations, logical operations, bitwise operations, comparison operations, assignment operations, matrix operations, and vector operations; the data operations include one or more of the following: addition, subtraction, multiplication, and division operations; and the logical operations include one or more of the following: AND, OR, and NOT operations. The filtering operation is used for filtering based on the second field; The value retrieval operation is used to take the value of the second field as the value of the first field.

5. The method according to any one of claims 1 to 4, characterized in that, The method further includes: Continue tracing the source of the second field. If no sub-statement containing the second field is found that modifies the target field, stop and output the source of the first field. If the second field is found and the second field is the target sub-statement that was modified, then the source of the second field is recorded.

6. A field tracing device, characterized in that, The device includes: The acquisition module is used to acquire the tracing request, which includes the identifier of the first table and the identifier of the first field in the first table; A search module is used to search for a query statement in a database that includes the identifier of the first table, the database including executed query statements; The parsing module is used to parse the query statement into multiple sub-statements; A determining module is configured to determine, among the plurality of sub-statements, a target sub-statement that includes the first field and the field is modified to obtain the target sub-statement; The source tracing module is used to determine the source of the first field based on the target sub-statement, wherein the source indicates that the field is obtained by modifying the second field in the second table.

7. The apparatus according to claim 6, characterized in that, The determining module is further configured to search for sub-statements that include the field, and among the sub-statements that include the field, to find the sub-statement that includes a keyword indicating a modification operation as the target sub-statement.

8. The apparatus according to claim 6, characterized in that, The tracing module is also used to match the target sub-statement according to a preset relational rule. The relational rule is used to represent the modification operation performed on the field. If the first field of the target sub-statement and the second field of the second table match the relational rule, the second field of the second table is determined to be the source of the first field.

9. The apparatus according to claim 6, characterized in that, The modification operation includes one or more combinations of processing operations, filtering operations, and value retrieval operations, wherein... The processing operations include one or more of the following: mathematical operations, logical operations, bitwise operations, comparison operations, assignment operations, matrix operations, and vector operations; the data operations include one or more of the following: addition, subtraction, multiplication, and division operations; and the logical operations include one or more of the following: AND, OR, and NOT operations. The filtering operation is used for filtering based on the second field; The value retrieval operation is used to take the value of the second field as the value of the first field.

10. The apparatus according to any one of claims 6 to 9, characterized in that, The tracing field is also used to continue tracing the second field. If no target sub-statement containing the second field is found and the second field is modified to obtain the target sub-statement, the tracing stops and the source of the first field is output. If the second field is found and the second field is modified to obtain the target sub-statement, the source of the second field is recorded.

11. A computing device, characterized in that the computing device includes a processor and a memory; The processor is configured to execute instructions stored in the memory to cause the computing device to perform the operational steps of the method as described in any one of claims 1 to 5.

12. A computing device cluster, characterized in that, It includes multiple computing devices, each of which includes a processor and memory; The processors of the plurality of computing devices are configured to execute instructions stored in the memory of the plurality of computing devices, such that the cluster of computing devices performs the operational steps of the method as described in any one of claims 1 to 5.

13. A computer program product containing instructions, characterized in that, When the instruction is executed by the computing device cluster, the computing device cluster causes the computing device cluster to perform the operation steps of the method as described in any one of claims 1 to 5.

14. A computer-readable storage medium, characterized in that, It includes computer program instructions, which, when executed by a cluster of computing devices, perform the operational steps of the method as described in any one of claims 1 to 5.