Computing link processing method and device, equipment and storage medium
By responsive to user input node addition and orchestration instructions, SQL statements and computing links are optimized, SQL writing difficulty and thread waiting problems are solved, automatic optimization and execution plan generation are realized, and writing costs and time are reduced.
Patent Information
- Application Number
- CN202411242478.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2025-01-03
AI Technical Summary
The writing of existing SQL statements is difficult, and requires certain SQL language writing capabilities. It is easy to cause threads to wait and tasks to run empty when processing a large amount of data.
By responding to node addition and arrangement instructions input by users, create and optimize the calculation link, generate optimized SQL statements and execution plans, use the preset correspondence between SQL nodes and syntax tree node groups to determine the new SQL node, and write it in a drag-and-drop manner SQL statements to realize automatic optimization of computing links.
It reduces the time for manually editing and learning SQL statements, reduces the writing cost, realizes automatic optimization of the computing link and the generation of execution plans, and facilitates staff to intuitively understand and adjust the orchestration order.
Smart Images

Figure CN119248812A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing and big data technology, and in particular to a computing link processing method, device, equipment and storage medium. Background Art
[0002] As the process of informatization continues to deepen, the amount of data processing is gradually increasing. Currently, when a large amount of data is involved, SQL (Structured Query Language) statements can be used for data processing.
[0003] Currently, the writing of SQL statements usually requires staff to have certain SQL language writing capabilities.
[0004] However, the inventors have discovered that the prior art has at least the following technical problems: it is difficult to write SQL statements. Summary of the invention
[0005] The embodiments of the present application provide a computing link processing method, apparatus, device and storage medium to solve the problem in the prior art that a large number of threads created are in a waiting state, causing tasks to be in an idle state.
[0006] In a first aspect, the present application provides a computing link processing method, comprising: in response to receiving a node adding instruction input by a user, adding a structured query language SQL node corresponding to the node adding instruction; in response to receiving an orchestration instruction input by a user, connecting the SQL nodes corresponding to the orchestration instruction to obtain a computing link; in response to receiving a trigger signal for an automatic optimization button, optimizing the computing link to obtain a corresponding optimized SQL statement; determining an optimized syntax tree corresponding to the optimized SQL statement; determining at least one new SQL node corresponding to the optimized syntax tree according to a preset correspondence between an SQL node and a syntax tree node group; splicing the new SQL node according to the structure of the optimized syntax tree to obtain an optimized computing link; determining an execution plan corresponding to the optimized computing link; and outputting the optimized computing link and the execution plan.
[0007] In one possible implementation, at least one new SQL node corresponding to the optimized syntax tree is determined according to a preset correspondence between SQL nodes and syntax tree node groups, including: searching for a preset correspondence between SQL nodes and syntax tree node groups to obtain a target syntax tree node group corresponding to a target SQL node, wherein the target syntax tree node group includes at least one target syntax tree node and a connection relationship between target syntax tree nodes, and the target SQL node is any SQL node; if the optimized syntax tree node group in the optimized syntax tree is the same as the target syntax tree node group, the target SQL node group is determined as a candidate node, wherein the optimized syntax tree node group includes at least one optimized syntax tree node and a connection relationship between optimized syntax tree nodes; and in the candidate nodes, a new SQL node is determined.
[0008] In one possible implementation, a new SQL node is determined in the candidate nodes, including: if the target syntax tree node corresponding to the target candidate node does not overlap with the target syntax tree nodes corresponding to the remaining candidate nodes, the target candidate node is determined as the new SQL node; if the target syntax tree nodes corresponding to at least two candidate nodes overlap, the candidate node with the most corresponding target syntax tree nodes among the at least two candidate nodes is determined as the new SQL node.
[0009] In one possible implementation, in a candidate node, a new SQL node is determined, including: generating a serial number for each syntax tree node; determining a total serial number range corresponding to all syntax tree nodes according to the serial number of each syntax tree node; determining a serial number value corresponding to each candidate node according to the serial numbers of the target syntax tree node and the syntax tree node corresponding to each candidate node; and determining a new SQL node in the candidate node using the serial number value corresponding to each candidate node and the total serial number range.
[0010] In a possible implementation, determining an execution plan corresponding to the optimized computing link includes: combining input parameters, output parameters, and node names of each SQL node in the optimized computing link to obtain an execution plan.
[0011] In a possible implementation, after the new SQL node is spliced according to the structure of the optimized syntax tree to obtain the optimized computing link, it also includes: in response to receiving a trigger signal of the user for the run button, obtaining the configuration information of the target SQL node in the optimized computing link; if the configuration information includes data source information, loading the target data corresponding to the data source information; using the target data to establish a temporary table mapping; if the configuration information includes execution SQL configuration information, submitting the execution SQL corresponding to the execution SQL configuration information to obtain a result set; if the configuration information includes result output configuration information, writing the result set into the storage location corresponding to the result output configuration information according to the result output configuration information.
[0012] In a second aspect, the present application provides a computing link processing device, including: a node adding module, which is used to add a structured query language SQL node corresponding to the node adding instruction in response to receiving a node adding instruction input by a user; a link obtaining module, which is used to connect the SQL nodes corresponding to the orchestration instruction in response to receiving an orchestration instruction input by the user to obtain a computing link; a statement optimization module, which is used to optimize the computing link in response to receiving a trigger signal for an automatic optimization button to obtain an optimized SQL statement; a syntax tree determination module, which is used to determine the optimized syntax tree corresponding to the optimized SQL statement; a node determination module, which is used to determine at least one new SQL node corresponding to the optimized syntax tree according to a preset correspondence between SQL nodes and syntax tree node groups; a link obtaining module, which is used to splice the new SQL node according to the structure of the optimized syntax tree to obtain an optimized computing link; a plan determination module, which is used to determine the execution plan corresponding to the optimized computing link; and a data output module, which is used to output the optimized computing link and the execution plan.
[0013] In a third aspect, an embodiment of the present application provides an electronic device, comprising: at least one processor and a memory; the memory stores computer execution instructions; at least one processor executes the computer execution instructions stored in the memory, so that the at least one processor executes the computing link processing method as described in the first aspect above and various possible designs of the first aspect.
[0014] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the computing link processing method as described in the first aspect and various possible designs of the first aspect is implemented.
[0015] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the computing link processing method as described in the first aspect and various possible designs of the first aspect.
[0016] The computing link processing method, device, equipment and storage medium provided by the present application add a SQL node corresponding to a node adding instruction, and connect the SQL nodes according to the requirements of the orchestration instruction to obtain a computing link, optimize the SQL statement corresponding to the computing link to obtain an optimized SQL statement, determine the optimized syntax tree corresponding to the optimized SQL statement, determine the corresponding new SQL node of the optimized syntax tree, use the new SQL node to splice to obtain the optimized SQL statement, and output the computing link and execution plan of the optimized SQL statement. Since the SQL statement can be written by dragging and dropping, the time and learning cost of manually editing the SQL statement are reduced, and the automatic optimization of the computing link is realized, the time of manually optimizing the SQL statement is reduced, and the generation of the corresponding execution plan is realized, which is convenient for the staff to intuitively understand the execution plan, optimize and adjust the orchestration order, and reduce the writing time of the SQL statement. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0018] Figure 1 This is an application scenario diagram of the computing link processing method according to the embodiment of the present application;
[0019] Figure 2 A flowchart of a computing link processing method provided in an embodiment of the present application;
[0020] Figure 3 A schematic diagram of the comparison between the new SQL node connection relationship and the optimized syntax tree provided in the embodiment of the present application;
[0021] Figure 4 A schematic diagram of the structure of a computing link processing device provided in an embodiment of the present application;
[0022] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0023] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0024] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0025] With the rapid development of information technology, the amount of data processing has shown a significant growth trend. Faced with huge data sets, structured query language has become the preferred tool for efficiently processing these data. SQL, with its powerful query and processing capabilities, shows unique advantages in dealing with large-scale data processing tasks.
[0026] However, it is worth noting that writing efficient and accurate SQL statements often requires the executor to have certain SQL programming skills and knowledge reserves. This means that in order to fully utilize the potential of SQL in data processing, staff need to continuously learn and improve their ability in SQL language application.
[0027] In response to the above technical problems, the inventors proposed the following technical concept: by adding SQL nodes in a node-based manner and connecting the SQL nodes to obtain a computing link, after receiving a trigger signal for an automatic optimization button, optimizing the computing link to obtain an optimized SQL statement, determining the optimized computing link corresponding to the optimized SQL statement, and the execution plan corresponding to the optimized computing link, and outputting the optimized computing link and the corresponding execution plan.
[0028] In the technical solution of this application, the collection, storage, use, processing, transmission, provision and disclosure of information such as financial data or user data involved shall comply with the provisions of relevant laws and regulations and shall not violate public order and good morals.
[0029] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0030] Figure 1 FIG. 1 is an application scenario diagram of the computing link processing method according to the embodiment of the present application. Figure 1 As shown, the application scenario includes: a terminal device 101 and a database 102 .
[0031] In a specific implementation process, the terminal device 101 may include a computer, a server, a tablet, a mobile phone, a PDA (Personal Digital Assistant), a notebook, etc., which can input data.
[0032] The database 102 may include a single database or a combination of multiple databases, such as Oracle database, MySQL (relational database management system), DRDS (Distribute Relational Database Service, distributed relational database) database, ES (Elasticsearch, elastic search) database, etc., and this application does not impose any special restrictions on this.
[0033] The terminal device 101 is used to accept the control of the user, create the SQL computing link, optimize the SQL computing link, generate the execution plan corresponding to the optimized computing link, and use the optimized computing link to process the data in the database 102.
[0034] Figure 2 This is a flow chart of a computing link processing method provided in an embodiment of the present application. Figure 2 As shown, the calculation link processing method includes:
[0035] S201: In response to receiving a node adding instruction input by a user, adding a structured query language SQL node corresponding to the node adding instruction.
[0036] In this step, the node adding instruction can be a user dragging a node, dragging a node displayed at a preset position to a link display area, or triggering a preset node and an add button. Adding a structured query language SQL node corresponding to the node adding instruction can include displaying the structured query language SQL node in the link display area, or writing the structured query language SQL node into a to-be-linked area of a computing link.
[0037] Among them, SQL nodes can include pre-packaged SQL statements, and can also include predefined operators such as data extraction, data loading, mapping functions, sorting, specified format parsing, splitting, custom operators, etc.
[0038] S202: In response to receiving the orchestration instruction input by the user, connect the SQL nodes corresponding to the orchestration instruction to obtain a computing link.
[0039] In this step, the arrangement instruction may include an instruction to add a connection between at least two SQL nodes, or may include clicking on at least two SQL nodes respectively after clicking on a link instruction.
[0040] S203: In response to receiving a trigger signal for the automatic optimization button, optimizing the computing link to obtain a corresponding optimized SQL statement.
[0041] In this step, the trigger signal for the automatic optimization button may include clicking or long pressing the automatic optimization button. The process of optimizing the calculation link includes linking the information of the SQL nodes in the calculation link to obtain the SQL statement, optimizing the SQL statement using the preset RBO (Rule-Based Optimization) rule, and obtaining the optimized SQL statement. The method of optimizing the SQL statement using the RBO rule may include optimizing the structure of the SQL statement (replacing the preset fields), creating indexes for query conditions, connection conditions, sorting, etc. whose occurrence frequency exceeds the preset frequency threshold, and caching the data set that needs to be repeatedly calculated.
[0042] S204: Determine the optimized syntax tree corresponding to the optimized SQL statement.
[0043] In this step, it may include inputting the optimized SQL statement into a preset parser to obtain a corresponding optimized syntax tree; it may also include performing lexical analysis, grammatical analysis, and semantic analysis on the optimized SQL statement to obtain an optimized syntax tree.
[0044] S205: Determine at least one new SQL node corresponding to the optimized syntax tree according to a preset correspondence relationship between SQL nodes and syntax tree node groups.
[0045] In this step, it includes reading the preset node group corresponding to each preset SQL node (the preset node group includes at least one preset node) in the correspondence between the SQL node and the syntax tree node group, and by comparing the syntax tree nodes in the optimized syntax tree with the preset nodes, determining the preset SQL node whose corresponding preset node is the same as the syntax tree node as the new SQL node; it may also include comparing the syntax tree nodes in the optimized syntax tree, the connection relationship between the syntax tree nodes, and the connection relationship between the preset nodes and the preset nodes, and determining the preset SQL node whose nodes and connection relationship are the same as the new SQL node.
[0046] The correspondence between the preset SQL nodes and the syntax tree node groups may be preset by the staff and stored in a format such as a table, a file, or a key-value pair.
[0047] S206: Connect the new SQL nodes according to the structure of the optimized syntax tree to obtain an optimized computing link.
[0048] In this step, the process may include connecting each new SQL node according to the position of the preset node corresponding to the new SQL node in the optimized syntax tree to obtain an optimized calculation link.
[0049] Figure 3 This is a schematic diagram of the new SQL node connection relationship and the optimized syntax tree comparison relationship provided in the embodiment of the present application. Figure 3 As shown in the figure, the new SQL node is on the left and the optimized syntax tree is on the right. The syntax tree node selected by the dashed line in the optimized syntax tree corresponds to the new SQL node on the left. The connection relationship between the nodes is marked by a solid curve with an arrow, and the corresponding relationship between the syntax tree node and the new SQL node is represented by a dashed line with an arrow. The corresponding SQL nodes are spliced according to the structure of the optimized syntax tree to obtain the optimized computing link.
[0050] S207: Determine the execution plan corresponding to the optimized computing link.
[0051] In this step, the SQL statements of the optimized computing link are subjected to lexical analysis and syntax analysis, the corresponding syntax tree is generated, the syntax tree is traversed in a new way using semantic analysis, and the correctness of the semantics is determined. If the semantics are correct, the tables, indexes, and operations accessed by the computing link are obtained, and the accessed tables, indexes, and operations are used together as the execution plan.
[0052] S208: Outputting the optimized computing link and execution plan.
[0053] In this step, the optimized computing link and the execution plan may be displayed and outputted. Specifically, the optimized computing link may be outputted in the link display area, and the execution plan may be outputted in the plan display area.
[0054] From the description of the above embodiments, it can be seen that the embodiments of the present application add SQL nodes corresponding to node addition instructions, and connect the SQL nodes according to the requirements of the orchestration instructions to obtain a calculation link, optimize the SQL statement corresponding to the calculation link, obtain an optimized SQL statement, determine the optimized syntax tree corresponding to the optimized SQL statement, determine the corresponding new SQL node of the optimized syntax tree, use the new SQL node to splice to obtain the optimized SQL statement, and output the calculation link and execution plan of the optimized SQL statement. Since SQL statements can be written by dragging and dropping, the time and learning cost of manual editing of SQL statements are reduced, and at the same time, automatic optimization of the calculation link is realized, the time of manual optimization of SQL statements is reduced, and the generation of corresponding execution plans is also realized, which is convenient for staff to intuitively understand the execution plan, optimize and adjust the orchestration order, and reduce the writing time of SQL statements.
[0055] In a possible implementation, the above step S2042: determining at least one new SQL node corresponding to the optimized syntax tree according to a preset correspondence relationship between SQL nodes and syntax tree node groups, includes:
[0056] S421: Search for a correspondence between a preset SQL node and a syntax tree node group, and obtain a target syntax tree node group corresponding to a target SQL node, wherein the target syntax tree node group includes at least one target syntax tree node and a connection relationship between target syntax tree nodes, and the target SQL node is any SQL node.
[0057] In this step, the target syntax tree node group may be stored in the format of node name and node connection relationship.
[0058] For example, the correspondence between SQL nodes and syntax tree node groups can be read to obtain syntax tree node group A corresponding to SQL node A, which includes syntax tree node a, syntax tree node b, and syntax tree node c, and the output of syntax tree node a is connected to the input of syntax tree node b and syntax tree node c. For another example, the correspondence between SQL nodes and syntax tree node groups can be read to obtain syntax tree node group B corresponding to SQL node B, which includes syntax tree node 1, syntax tree node 2, and syntax tree node 3, the output of syntax tree node 1 is connected to the input of syntax tree node 2, and the output of syntax tree node 2 is connected to the input of syntax tree node 3.
[0059] S422: If the optimized syntax tree node group in the optimized syntax tree is the same as the target syntax tree node group, determining the target SQL node group as a candidate node, wherein the optimized syntax tree node group includes at least one optimized syntax tree node and a connection relationship between the optimized syntax tree nodes.
[0060] In this step, for example, the node group in the optimized syntax tree includes syntax tree node a, syntax tree node b, and syntax tree node c, the output of syntax tree node a is connected to the input of syntax tree node b, and the output of syntax tree node b is connected to the input of syntax tree node c, and the target syntax tree node group also includes syntax tree node a, syntax tree node b, and syntax tree node c, and the output of syntax tree node a is connected to the input of syntax tree node b, and the output of syntax tree node b is connected to the input of syntax tree node c, then the optimized syntax tree node group is the same as the target syntax tree node group, and the target SQL node is determined as a candidate node. For another example, the node group in the optimized syntax tree includes syntax tree nodes E and F, and the output of syntax tree node E is used as the input of syntax tree node F, and the target syntax tree node group also includes syntax tree nodes E and F, and the output of syntax tree node E is used as the input of syntax tree node F, then the optimized syntax tree node group is the same as the target syntax tree node group, and the target SQL node is determined as a candidate node.
[0061] S423: Determine a new SQL node among the candidate nodes.
[0062] In this step, it may include determining non-overlapping candidate nodes among the candidate nodes as new SQL nodes.
[0063] From the description of the above embodiments, it can be seen that the embodiments of the present application obtain the target syntax tree node group corresponding to the target SQL node by finding the correspondence between the preset SQL node and the syntax tree node group, and compare whether the optimized syntax tree node group and the target syntax tree node group are the same. If they are the same, the target SQL node is determined as a candidate node, and a new SQL node is selected from the candidate node to obtain the new SQL node that needs to be displayed from the syntax tree in reverse, which is convenient for the subsequent composition of the optimized computing link and the display of the optimized computing link.
[0064] In a possible implementation, in the above step S423, determining a new SQL node from the candidate nodes includes: step S23A1 and step S23A2.
[0065] S23A1: If the target syntax tree node corresponding to the target candidate node is not repeated with the target syntax tree nodes corresponding to the remaining candidate nodes, the target candidate node is determined as a new SQL node.
[0066] In this step, the remaining candidate nodes may be candidate nodes other than the target candidate node.
[0067] The target candidate node is any candidate node.
[0068] For example, if the target syntax tree node corresponding to candidate node 1 is syntax tree node A, and the remaining candidate nodes do not correspond to syntax tree node A, candidate node 1 is determined as a new SQL node. For another example, if the target syntax tree node corresponding to candidate node 2 is syntax tree node C, and the remaining candidate nodes do not correspond to syntax tree node C, candidate node 2 is determined as a new SQL node.
[0069] S23A2: If the target syntax tree nodes corresponding to at least two candidate nodes are repeated, the candidate node corresponding to the most target syntax tree nodes among the at least two candidate nodes is determined as the new SQL node.
[0070] In this step, for example, candidate node 1 corresponds to target syntax tree nodes A, B, and C, and candidate node 2 corresponds to target syntax tree nodes C and D. These two candidate nodes have repeated target syntax tree nodes C. Since candidate node 1 corresponds to more target syntax tree nodes, candidate node 1 is determined as a new SQL node. For another example, candidate node 2 corresponds to target syntax tree nodes A, B, and C, candidate node 2 corresponds to target syntax tree nodes C and D, and candidate node 3 corresponds to target syntax tree nodes A, B, C, D, and E. These three candidate nodes have repeated target syntax tree nodes A, B, and C. Since candidate node 3 corresponds to more target syntax tree nodes, candidate node 3 is determined as a new SQL node.
[0071] From the description of the above embodiments, it can be seen that the embodiments of the present application directly determine the target candidate node as the new SQL node when the target syntax tree node corresponding to the target candidate node does not repeat with the target syntax tree nodes corresponding to the remaining candidate nodes. In the case of duplication, the candidate node with the most corresponding target syntax tree nodes is determined as the new SQL node, thereby reducing the number of new SQL nodes and making the subsequently established computing chain more concise.
[0072] In a possible implementation, in the above step S423, determining a new SQL node from the candidate nodes includes steps S23B1, S23B2, S23B3 and S23B4.
[0073] S23B1: Generate serial numbers for each syntax tree node.
[0074] In this step, the process may include sorting the syntax tree nodes according to the order in which the nodes appear in the syntax tree to obtain the sequence number of the syntax tree nodes.
[0075] S23B2: Determine the total sequence number range corresponding to all syntax tree nodes according to the sequence number of each syntax tree node.
[0076] In this step, the maximum and minimum sequence numbers of the sequence numbers of the syntax tree nodes may be determined as the endpoints of the total sequence number range to obtain the total sequence number range.
[0077] For example, the minimum value of the sequence number of the current syntax tree node is 1 and the maximum value is 20, then the total sequence number range is "[1, 20]"; for another example, the minimum value of the sequence number of the current syntax tree node is 0 and the maximum value is 30, then the total sequence number range is "[0, 30]".
[0078] S23B3: Determine the serial number value corresponding to each candidate node according to the target syntax tree node and the serial number of the syntax tree node corresponding to each candidate node.
[0079] In this step, it can include taking the serial number of the target syntax tree node corresponding to the candidate node as the serial number value corresponding to the candidate node; specifically, it can include determining the target syntax tree node corresponding to any candidate node based on the correspondence between the candidate node and the target syntax tree node, and then searching for the correspondence between the syntax tree node and the serial number based on the corresponding target syntax tree node to obtain the serial number value corresponding to this candidate node.
[0080] For example, candidate node A corresponds to target syntax tree nodes a, b, and c, and the serial numbers of target syntax tree nodes a, b, and c are 1, 3, and 4 respectively, then the serial number values corresponding to candidate node A are 1, 3, and 4.
[0081] S23B4: Using the sequence number value corresponding to each candidate node and the total sequence number range, determine the new SQL node among the candidate nodes.
[0082] In this step, a greedy algorithm may be used to determine how to use the sequence number values corresponding to the least number of candidate nodes to cover the sequence number range, and the candidate nodes to be used may be determined as new SQL nodes.
[0083] From the description of the above embodiments, it can be seen that the embodiments of the present application generate serial numbers for each syntax tree node, determine the total serial number range based on the serial numbers of the syntax tree nodes, determine the serial number value corresponding to each candidate node, and use the minimum number of candidate nodes whose corresponding serial number values can cover the serial number range as new SQL nodes, thereby achieving the use of the minimum number of candidate nodes as new SQL nodes, reducing the length of the output optimized calculation link, and making the output more concise.
[0084] In a possible implementation, in the above step S207, determining the execution plan corresponding to the optimized computing link includes:
[0085] S2071: Combine the input parameters, output parameters, and node name of each SQL node in the optimized computing link to obtain an execution plan.
[0086] In this step, the input parameters, output parameters and node name of each SQL node may be read, and written as text in a preset format to obtain an execution plan.
[0087] From the description of the above embodiment, it can be seen that the embodiment of the present application combines the input parameters, output parameters and node names of each SQL node in the optimized computing link into an execution plan, which facilitates the subsequent detailed display of the input and output of each SQL node.
[0088] In a possible implementation, after the new SQL nodes are spliced according to the structure of the optimized syntax tree to obtain the optimized calculation link in the above step S206, the following steps are further included: step S220 to step S223.
[0089] S220: In response to receiving a trigger signal of a run button from a user, obtaining configuration information of a target SQL node in the optimized computing link.
[0090] In this step, the trigger signal for the run button may include click, long press, etc. of the run button. The target SQL node may be any SQL node, and the configuration information may include information input by the user, information preset in the SQL node, etc.
[0091] S221: If the configuration information includes data source information, then load the target data corresponding to the data source information; and establish a temporary table mapping using the target data.
[0092] In this step, the data source information may include the storage location of the data, the connection string of the database, the URL (Uniform Resource Locator) of the data source, the file path, etc. Establishing a temporary table mapping includes loading the target data into a temporary table and establishing a corresponding mapping relationship.
[0093] A temporary table is a table that exists during a database session and is used to store intermediate results or temporary data.
[0094] S222: If the configuration information includes SQL execution configuration information, submit the SQL execution corresponding to the SQL execution configuration information to obtain a result set.
[0095] In this step, the execution SQL configuration information may include one or more SQL statements, or a reference to a SQL statement. Submitting the execution SQL corresponding to the execution SQL configuration information includes submitting the SQL query statement contained in the execution SQL configuration information to the database for execution. The result set may include the execution result of the SQL query received from the database server, which may be a multi-row and multi-column data in a table format.
[0096] S223: If the configuration information includes result output configuration information, write the result set into a storage location corresponding to the result output configuration information according to the result output configuration information.
[0097] In this step, the result output configuration information may include the format of the result output, the storage location, etc.
[0098] From the description of the above embodiments, it can be seen that the embodiments of the present application obtain the configuration information of the target SQL node in the optimized computing link by responding to the trigger signal of the run button, read, process and write data according to the configuration information, and realize data processing using the optimized computing link.
[0099] In a possible implementation, the above-mentioned steps S221 to S223 include instantiating the configuration of the SQL node, creating an execution instance and passing in the instantiated SQL node configuration, obtaining the execution instance status, and traversing the next node in the computing link when the execution status is successful, and ending the processing when the execution status is failed.
[0100] In a possible implementation, a computing link is created by receiving node addition instructions and orchestration instructions input by a user. After receiving a trigger signal for an automatic optimization button, the computing link is optimized using a preset RBO rule to obtain a corresponding optimized SQL statement, and an optimized syntax tree of the optimized SQL statement is established. The optimized syntax tree contains five syntax tree nodes, namely A, B, C, D, and E. The syntax tree nodes in the optimized syntax tree are compared with target syntax tree nodes corresponding to preset SQL nodes to determine that A and B correspond to target SQL node 1, and syntax trees C, D, and E correspond to target SQL node 2. The target SQL node 1 and the target SQL node 2 are connected to obtain an optimized computing link, and an execution plan for the target SQL node 1 and the target SQL node 2 is generated. The optimized computing link and the execution plan are output in a display interface.
[0101] Figure 4 This is a schematic diagram of the structure of the computing link processing device provided in the embodiment of the present application. Figure 4 As shown, the computing link processing device 400 includes: a node adding module 401, a link obtaining module 402, a statement optimizing module 403, a link determining module 404, a plan determining module 405 and a data output module 406.
[0102] The node adding module 401 is used to add a structured query language SQL node corresponding to the node adding instruction in response to receiving the node adding instruction input by the user;
[0103] The link obtaining module 402 is used to connect the SQL nodes corresponding to the orchestration instruction in response to receiving the orchestration instruction input by the user to obtain a computing link;
[0104] The statement optimization module 403 is used to optimize the calculation link in response to receiving a trigger signal for the automatic optimization button to obtain an optimized SQL statement;
[0105] A syntax tree determination module 404 is used to determine an optimized syntax tree corresponding to the optimized SQL statement;
[0106] A node determination module 405 is used to determine at least one new SQL node corresponding to the optimized syntax tree according to a preset correspondence relationship between SQL nodes and syntax tree node groups;
[0107] The link acquisition module 406 is used to splice the new SQL node according to the structure of the optimized syntax tree to obtain an optimized calculation link;
[0108] A plan determination module 407 is used to determine an execution plan corresponding to the optimized computing link;
[0109] The data output module 408 is used to output the optimized computing link and execution plan.
[0110] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.
[0111] In one possible implementation, the node determination module 405 is used to find the correspondence between the preset SQL node and the syntax tree node group, and obtain the target syntax tree node group corresponding to the target SQL node, wherein the target syntax tree node group includes at least one target syntax tree node and the connection relationship between the target syntax tree nodes, and the target SQL node is any SQL node; if the optimized syntax tree node group in the optimized syntax tree is the same as the target syntax tree node group, the target SQL node group is determined as a candidate node, wherein the optimized syntax tree node group includes at least one optimized syntax tree node and the connection relationship between the optimized syntax tree nodes; and in the candidate node, a new SQL node is determined.
[0112] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.
[0113] In one possible implementation, the node determination module 405 is used to determine the target candidate node as a new SQL node if the target syntax tree node corresponding to the target candidate node does not overlap with the target syntax tree nodes corresponding to the remaining candidate nodes; if the target syntax tree nodes corresponding to at least two candidate nodes overlap, then the candidate node with the most corresponding target syntax tree nodes among the at least two candidate nodes is determined as the new SQL node.
[0114] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.
[0115] In one possible implementation, the node determination module 405 is specifically used to generate a serial number for each syntax tree node; determine a total serial number range corresponding to all syntax tree nodes according to the serial number of each syntax tree node; determine a serial number value corresponding to each candidate node according to the serial numbers of the target syntax tree node and the syntax tree node corresponding to each candidate node; and determine a new SQL node in the candidate node using the serial number value corresponding to each candidate node and the total serial number range.
[0116] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.
[0117] In a possible implementation, the plan determination module 407 is used to combine the input parameters, output parameters and node names of each SQL node in the optimized computing link to obtain an execution plan.
[0118] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.
[0119] In a possible implementation, the computing link processing device 400 further includes: a link operation module 409 .
[0120] The link operation module 409 is used to obtain the configuration information of the target SQL node in the optimized calculation link in response to receiving a trigger signal of the user for the run button; if the configuration information includes data source information, the target data corresponding to the data source information is loaded; a temporary table mapping is established using the target data; if the configuration information includes execution SQL configuration information, the execution SQL corresponding to the execution SQL configuration information is submitted to obtain a result set; if the configuration information includes result output configuration information, the result set is written into the storage location corresponding to the result output configuration information according to the result output configuration information.
[0121] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.
[0122] In order to implement the above embodiment, the embodiment of the present application also provides an electronic device.
[0123] refer to Figure 5 , which shows a schematic diagram of the structure of an electronic device 500 suitable for implementing the embodiment of the present application, and the electronic device 500 may be a terminal device or a server. The terminal device may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (Portable Media Players, PMPs), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0124] like Figure 5 As shown, the electronic device 500 may include a processor (such as a central processing unit, a graphics processing unit, etc.) 501, and a memory 502 connected to the processor in communication, which can perform various appropriate actions and processes according to the program stored in the memory 502, the computer execution instruction, or the program loaded from the storage device 508 to the random access memory (Random Access Memory, referred to as RAM) 503, to implement the computing link processing method in any of the above embodiments, wherein the memory may be a read-only memory (Read Only Memory, referred to as ROM). In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the memory 502, and the RAM 503 are connected to each other via a bus 504. The input / output (I / O) interface 505 is also connected to the bus 504.
[0125] Typically, the following devices may be connected to the I / O interface 505: input devices 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 508 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Figure 5 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0126] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 509, or installed from the storage device 508, or installed from the memory 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present application are executed.
[0127] It should be noted that the computer-readable storage medium mentioned above in the present application may be a computer-readable signal medium or a computer storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable storage medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0128] The computer-readable storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.
[0129] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.
[0130] The computer program code for performing the operation of the present application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).
[0131] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0132] The modules involved in the embodiments described in this application can be implemented by software or hardware. The name of the unit does not constitute a limitation on the module itself in some cases. For example, the node adding module can also be described as a "SQL node adding module".
[0133] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0134] The present application also provides a computer-readable storage medium, which stores computer execution instructions. When the processor executes the computer execution instructions, the technical solution of the computing link processing method in any of the above embodiments is implemented. Its implementation principle and beneficial effects are similar to the implementation principle and beneficial effects of the computing link processing method. Please refer to the implementation principle and beneficial effects of the computing link processing method, which will not be repeated here.
[0135] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0136] The present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the technical solution of the computing link processing method in any of the above-mentioned embodiments. Its implementation principle and beneficial effects are similar to the implementation principle and beneficial effects of the computing link processing method. Please refer to the implementation principle and beneficial effects of the computing link processing method, and no further details will be given here.
[0137] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in this application (but not limited to) by each other to form a technical solution.
[0138] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0139] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A computing link processing method, characterized in that: include: In response to receiving a node adding instruction input by a user, adding a structured query language SQL node corresponding to the node adding instruction; In response to receiving an orchestration instruction input by a user, connecting SQL nodes corresponding to the orchestration instruction to obtain a computing link; In response to receiving a trigger signal for an automatic optimization button, optimizing the computing link to obtain a corresponding optimized SQL statement; Determine an optimized syntax tree corresponding to the optimized SQL statement; Determine at least one new SQL node corresponding to the optimized syntax tree according to a preset correspondence relationship between SQL nodes and syntax tree node groups; splicing the new SQL nodes according to the structure of the optimized syntax tree to obtain an optimized calculation link; Determine an execution plan corresponding to the optimized computing link; The optimized computing link and the execution plan are output.
2. The method according to claim 1, characterized in that: The determining, according to a preset correspondence relationship between SQL nodes and syntax tree node groups, at least one new SQL node corresponding to the optimized syntax tree comprises: Searching for a correspondence between a preset SQL node and a syntax tree node group, and obtaining a target syntax tree node group corresponding to a target SQL node, wherein the target syntax tree node group includes at least one target syntax tree node and a connection relationship between the target syntax tree nodes, and the target SQL node is any SQL node; If the optimized syntax tree node group in the optimized syntax tree is the same as the target syntax tree node group, determining the target SQL node group as a candidate node, wherein the optimized syntax tree node group includes at least one optimized syntax tree node and a connection relationship between the optimized syntax tree nodes; Among the candidate nodes, a new SQL node is determined.
3. The method according to claim 2, characterized in that Determining a new SQL node among the candidate nodes includes: If the target syntax tree node corresponding to the target candidate node does not overlap with the target syntax tree nodes corresponding to the remaining candidate nodes, the target candidate node is determined as a new SQL node; If the target syntax tree nodes corresponding to at least two candidate nodes are repeated, the candidate node corresponding to the most target syntax tree nodes among the at least two candidate nodes is determined as the new SQL node.
4. The method according to claim 2, characterized in that: Determining a new SQL node among the candidate nodes includes: Generate the sequence number of each syntax tree node; Determine the total sequence number range corresponding to all syntax tree nodes according to the sequence numbers of the syntax tree nodes; Determine the sequence number value corresponding to each candidate node according to the target syntax tree node corresponding to each candidate node and the sequence number of the syntax tree node; The new SQL node among the candidate nodes is determined by using the sequence number value corresponding to each candidate node and the total sequence number range.
5. The method according to any one of claims 1 to 4, characterized in that The determining the execution plan corresponding to the optimized computing link includes: The input parameters, output parameters and node names of each SQL node in the optimized calculation link are combined to obtain an execution plan.
6. The method according to any one of claims 1 to 4, characterized in that After the new SQL nodes are spliced according to the structure of the optimized syntax tree to obtain the optimized calculation link, the method further includes: In response to receiving a trigger signal of a run button from a user, obtaining configuration information of a target SQL node in the optimized computing link; If the configuration information includes data source information, then loading the target data corresponding to the data source information; using the target data to establish a temporary table mapping; If the configuration information includes SQL execution configuration information, submitting the SQL execution configuration information corresponding to the SQL execution configuration information to obtain a result set; If the configuration information includes result output configuration information, the result set is written into a storage location corresponding to the result output configuration information according to the result output configuration information.
7. A computing link processing device, characterized in that: include: A node adding module, configured to, in response to receiving a node adding instruction input by a user, add a structured query language SQL node corresponding to the node adding instruction; A link acquisition module, configured to connect SQL nodes corresponding to the orchestration instruction in response to receiving the orchestration instruction input by the user to obtain a computing link; A statement optimization module, configured to optimize the computing link in response to receiving a trigger signal for an automatic optimization button, and obtain an optimized SQL statement; A syntax tree determination module, used to determine an optimized syntax tree corresponding to the optimized SQL statement; A node determination module, used to determine at least one new SQL node corresponding to the optimized syntax tree according to a preset correspondence relationship between SQL nodes and syntax tree node groups; A link acquisition module, used for splicing the new SQL node according to the structure of the optimized syntax tree to obtain an optimized calculation link; A plan determination module, used to determine the execution plan corresponding to the optimized computing link; A data output module is used to output the optimized computing link and the execution plan.
8. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the computing link processing method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the computing link processing method according to any one of claims 1 to 6.
10. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor, implements the computing link processing method according to any one of claims 1 to 6.
