Data query method and apparatus

By dividing and scheduling data query execution plans in parallel, the problem of long time-consuming data resource queries is solved, efficient data integration is achieved, and the needs of inter-organizational data integration are met.

WO2024221908A1PCT designated stage expired Publication Date: 2024-10-31ANT BLOCKCHAIN TECHNOLOGY (SHANGHAI) CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/135018
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-04-25
Filing Date
2023-11-29
Publication Date
2024-10-31

AI Technical Summary

Technical Problem

Due to data security and privacy protection considerations, data resource queries are limited, resulting in long-term execution of data resource queries for remote interaction on large-scale data, making it difficult to meet the needs of inter-agency data integration application scenarios.

Method used

By obtaining the execution plan of the target query statement, it is divided into multiple subgraphs and converted into multiple scheduling nodes. A relationship graph is constructed based on dependencies to achieve parallel scheduling of multiple data table queries and improve data query efficiency.

Benefits of technology

It realizes parallel processing of data queries, significantly improves the overall execution efficiency of data queries, and meets the needs of efficient data integration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023135018_31102024_PF_FP_ABST
    Figure CN2023135018_31102024_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present specification provide a data query method and apparatus. The method comprises: obtaining an execution plan of a target query statement to be executed, wherein the target query statement is used for joint query of a plurality of data tables, the execution plan comprises a plurality of nodes and connection edges between the nodes, a leaf node in the plurality of nodes is a query invoking node for a data table in the plurality of data tables, the plurality of nodes have several branch nodes, and the several branch nodes each have a plurality of child nodes and a dependency relationship between the corresponding child nodes; dividing the execution plan into a plurality of sub-graphs along the several branch nodes, and converting the plurality of sub-graphs into a plurality of scheduling nodes, wherein a single sub-graph comprises at least one node; constructing a relationship graph between the plurality of scheduling nodes on the basis of the dependency relationship; and performing concurrent scheduling on the plurality of scheduling nodes on the basis of the relationship graph.
Need to check novelty before this filing date? Find Prior Art

Description

Data query method and device

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on April 25, 2023, with application number 202310458769.7 and application name “Data Query Method and Device”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The embodiments of this specification belong to the field of computer technology, and more particularly, to a data query method and device. Background Art

[0003] Due to data security and privacy concerns, many data resources are query-restricted, typically exposed through data service interfaces. In the current context of data as a factor of production, inter-institutional data integration applications are increasing, and the demand for integrating query-restricted data resources is also growing. Because data resource queries inherently operate on large-scale data and interact with data resources remotely, data resource queries typically take a long time to execute.

[0004] Summary of the Invention

[0005] The purpose of the present invention is to provide a data query solution that can improve the overall execution efficiency of data queries.

[0006] The first aspect of the present specification provides a data query method, including: obtaining an execution plan of a target query statement to be executed, the target query statement is used for a joint query of multiple data tables, the execution plan includes multiple nodes and connecting edges between the nodes, the leaf nodes among the multiple nodes are query call nodes for a data table in the multiple data tables, and there are several branch nodes among the multiple nodes, the several branch nodes all have multiple child nodes, and the corresponding child nodes have dependency relationships; along the several branch nodes, the execution plan is divided into multiple subgraphs, and the multiple subgraphs are converted into multiple scheduling nodes; wherein a single subgraph includes at least one node; based on the dependency relationship, a relationship graph between the multiple scheduling nodes is constructed; based on the relationship graph, the multiple scheduling nodes are concurrently scheduled.

[0007] The second aspect of this specification provides a data query device, including: an acquisition unit, configured to acquire an execution plan of a target query statement to be executed, the target query statement is used for a joint query of multiple data tables, the execution plan includes multiple nodes and connecting edges between nodes, a leaf node among the multiple nodes is a query call node for a data table in the multiple data tables, and there are several branch nodes among the multiple nodes, each of the several branch nodes has multiple child nodes and dependency relationships between the corresponding child nodes; a splitting unit, configured to split the execution plan into multiple subgraphs along the several branch nodes, and convert the multiple subgraphs into multiple scheduling nodes; wherein a single subgraph includes at least one node; a generation unit, configured to construct a relationship graph between the multiple scheduling nodes based on the dependency relationship; a scheduling unit, configured to concurrently schedule the multiple scheduling nodes based on the relationship graph.

[0008] A third aspect of this specification provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed in a computer, the computer is caused to execute the method described in any implementation manner in the first aspect.

[0009] A fourth aspect of this specification provides a computing device, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method described in any implementation manner in the first aspect is implemented.

[0010] A fifth aspect of this specification provides a computer program product, which, when executed in a computer, causes the computer to execute the method described in any implementation manner in the first aspect.

[0011] In the solution provided in the embodiment of this specification, an execution plan for a target query statement to be executed can be obtained, wherein the target query statement is used for a joint query of multiple data tables, and the execution plan includes multiple nodes and connecting edges between the nodes, and the leaf nodes among the multiple nodes are query call nodes for a data table in the multiple data tables, and there are several branch nodes among the multiple nodes, and the several branch nodes all have multiple child nodes and corresponding dependencies between the child nodes. Afterwards, the execution plan can be divided into multiple subgraphs along the several branch nodes, and the multiple subgraphs can be converted into multiple scheduling nodes. Then, a relationship graph between the multiple scheduling nodes can be constructed based on the dependency relationship. Then, the multiple scheduling nodes can be concurrently scheduled based on the relationship graph. In this way, the parallelization of the multiple data table queries can be achieved, thereby improving the overall execution efficiency of the data query. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0013] FIG1 is a schematic diagram of an application scenario in which the embodiments of this specification can be applied;

[0014] FIG2 is a flow chart of a data query method according to an embodiment of the present specification;

[0015] FIG3 is a flow chart of the conversion process from a logical execution plan to a physical execution plan;

[0016] FIG4 is a schematic diagram of the conversion process from a logical execution plan to a physical execution plan;

[0017] FIG5 is a flow chart of the subgraph processing process;

[0018] FIG6 is a flow chart of the subgraph processing process;

[0019] FIG7 is a flow chart of the subgraph processing process;

[0020] FIG8 is a schematic diagram of the subgraph processing process;

[0021] FIG9 is a schematic diagram of a relationship diagram between multiple scheduling nodes;

[0022] FIG10 is a schematic diagram of a concurrent scheduling process based on a relationship diagram;

[0023] FIG11 is a schematic diagram of the structure of a data query device in an embodiment of this specification. DETAILED DESCRIPTION

[0024] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the embodiments described are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without making creative work should fall within the scope of protection of this specification. In addition, the words "first", "second", "third", etc. in the embodiments of this specification are only used for information distinction and do not play any limiting role.

[0025] As mentioned earlier, due to data security and privacy concerns, many data resources are query-restricted, typically exposing data through data service interfaces. In the current context of data as a factor of production, inter-institutional data integration applications are increasing, and the demand for integrating query-restricted data resources is also growing. Because data resource queries inherently operate on large-scale data and interact with data resources remotely, data resource queries typically take a long time to execute.

[0026] In order to improve the overall execution efficiency of data query, the embodiments of this specification provide a data query solution.

[0027] Figure 1 is a schematic diagram of an application scenario in which embodiments of this specification may be applied. The application scenario shown in Figure 1 may include a user device 101 used by user A and a target platform 102 that supports joint queries across multiple data tables. Target platform 102 may be, for example, a data flow hub platform, a data development platform, a privacy collaboration application platform, or a data matrix service platform.

[0028] The aforementioned multiple data tables may be associated with multiple organizations (e.g., enterprises, etc.). User A may be one of the multiple organizations, or another user with permission to query the aforementioned multiple data tables. The aforementioned multiple data tables may be ordinary data tables located on the organization side; alternatively, the aforementioned multiple data tables may be multiple virtual data tables located in the target platform 102, and the multiple virtual data tables may be formed by abstracting the data resources of the multiple organizations. Any virtual data table may correspond to at least one data resource, and the target platform 102 may perform data queries on the data resource corresponding to the virtual data table based on query operations on the virtual data table.

[0029] When user A wants to perform a joint query on the above-mentioned multiple data tables, he can submit a target query statement for the joint query of the above-mentioned multiple data tables to the target platform 102 through the user device 101. The target platform 102 can obtain the execution plan PlanA of the target query statement. Among them, the execution plan PlanA can be a tree-like execution plan. The execution plan PlanA may include multiple nodes and connecting edges between nodes, and the leaf nodes among the multiple nodes are query call (QueryCall) nodes for the data tables in the above-mentioned multiple data tables. Among them, the multiple nodes correspond to multiple operations, and the leaf nodes among the multiple nodes correspond to query call operations for the data tables in the above-mentioned multiple data tables. In addition, there are several branch nodes among the multiple nodes, and the several branch nodes all have multiple child nodes, and the corresponding child nodes have dependencies.

[0030] Any of the several branch nodes may include any one of a union node, a join node, and a correlated query node. The Union node can be used to find the union of the result data of its child nodes. The dependency relationship between the child nodes corresponding to the Union node may be, for example, that the child nodes of the Union node are not dependent on each other. The Join node can be used to perform a join operation on the result data of its child nodes. The dependency relationship between the child nodes corresponding to the Join node may be, for example, that the child nodes of the Join node are not dependent on each other. The Correlate node can be used to use the data in the result data of one of its child nodes as the input parameter of another child node, so that the other child node performs data query based on the input parameter. The dependency relationship between the child nodes corresponding to the Correlate node may be, for example, that the query of one child node of the Correlate node depends on another child node.

[0031] Next, target platform 102 can split execution plan PlanA into multiple subgraphs along the aforementioned branch nodes and convert these subgraphs into multiple scheduling nodes. Each subgraph includes at least one node. Target platform 102 can then construct a relationship graph between these multiple scheduling nodes based on the dependencies between the subnodes corresponding to these branch nodes, and concurrently schedule these multiple scheduling nodes based on this relationship graph. This enables parallelization of the aforementioned multiple data table queries, thereby improving the overall efficiency of data query execution.

[0032] The data query solution provided by the embodiments of this specification is introduced below in conjunction with specific embodiments.

[0033] 2 is a flowchart of a data query method according to an embodiment of the present disclosure. The method can be executed by any device, platform, or device cluster with data storage, computing, and processing capabilities, for example, the target platform 102 shown in FIG1 can be executed.

[0034] As shown in Figure 2, first, in step S201, the execution plan of the target query statement to be executed is obtained. The target query statement is used for a joint query of multiple data tables. The execution plan includes multiple nodes and connecting edges between the nodes. The leaf nodes among the multiple nodes are query call nodes for the data tables in the multiple data tables, and there are several branch nodes among the multiple nodes. The several branch nodes all have multiple child nodes, and the corresponding child nodes have dependency relationships.

[0035] The target query statement may specify the above-mentioned multiple data tables and include query conditions. The query conditions may include filtering conditions for data tables in the above-mentioned multiple data tables and association conditions between data tables. In one example, the target query statement may include an SQL (Structured Query Language) statement. The SQL statement may include a from clause and a where clause, wherein the from clause specifies the above-mentioned multiple data tables and the where clause includes the query conditions.

[0036] The branch node in the embodiment of this specification may refer to a node with multiple child nodes. Any branch node may include any one of a union node, a join node, and a correlated query (Correlate) node. The Union node can be used to find the union of the result data of its child nodes. The dependency relationship between the child nodes corresponding to the Union node may be, for example, that the child nodes of the Union node are not dependent on each other. The Join node can be used to perform a join operation on the result data of its child nodes. The dependency relationship between the child nodes corresponding to the Join node may be, for example, that the child nodes of the Join node are not dependent on each other. The Correlate node can be used to use the data in the result data of one of its child nodes as the input parameter of another child node, so that the other child node performs data query based on the input parameter. The dependency relationship between the child nodes corresponding to the Correlate node may be, for example, that the query of a child node (for example, the right child node) of the Correlate node depends on another child node (for example, the left child node).

[0037] In one example, the execution plan of the target query statement can be a logical execution plan. A logical execution plan can be understood as an execution plan composed of logical operations, which primarily describes the content to be executed to implement the data query. The logical execution plan of the target query statement can include multiple logical nodes and connecting edges between the nodes. The leaf nodes among the multiple logical nodes are logical query call nodes for data tables in the aforementioned multiple data tables. In addition, the multiple logical nodes contain several logical branch nodes, each having multiple child nodes, and the several logical branch nodes respectively correspond to the dependency relationships between the child nodes. It should be noted that a logical node can be understood as a logical operation.

[0038] In practice, the above-mentioned multiple data tables can all support a read method, and the read method can use some fields of the corresponding data table to perform a filtered query. The logical QueryCall node may, for example, include the read method supported by its corresponding data table and the filter condition for the data table, wherein the filter condition satisfies the read method. In addition, the filter condition may be a filter condition included in the target query statement, or may be determined based on the association condition between the data table and other data tables in the target query statement. The logical Join node may include an association condition, which is determined based on the association condition between the data tables corresponding to each child node of the logical Join node.

[0039] In another example, the execution plan of the target query statement can be a physical execution plan. The physical execution plan can be understood as an execution plan composed of physical operations, which mainly describes the implementation plan of the data query execution content. The physical execution plan of the target query statement can include multiple physical nodes and connecting edges between nodes, and the leaf nodes among the multiple physical nodes are physical query call nodes for the data tables in the above-mentioned multiple data tables, and there are several physical branch nodes among the multiple physical nodes, each of which has multiple child nodes, and the several physical branch nodes respectively correspond to the dependency relationships between the child nodes. It should be pointed out that the physical node can be understood as a physical operation.

[0040] Based on this, in step S201, the logical execution plan of the target query statement can be obtained and converted into a physical execution plan. Specifically, when converting the logical execution plan of the target query statement into a physical execution plan, the execution plan conversion process shown in Figure 3 can be performed. Figure 3 is a flowchart of the conversion process from a logical execution plan to a physical execution plan.

[0041] As shown in FIG3 , in step S301 , each logical QueryCall node in the logical execution plan is converted into a corresponding physical QueryCall node.

[0042] In step S303, several logical branch nodes in the logical execution plan are converted into corresponding physical branch nodes.

[0043] In step S307 , a physical execution plan is constructed based on the nodes and the relationships between the nodes obtained through the transformation.

[0044] In one embodiment, a logical execution plan may further include a logical Project node and several logical Filter nodes. During the conversion of the logical execution plan into a physical execution plan, the logical Project nodes and logical Filter nodes may also be converted. For example, the result of merging adjacent logical Filter nodes and logical Project nodes may be converted into corresponding physical Calculate nodes. The several logical Filter nodes may be one or more logical Filter nodes. A logical Project node may be used to return data required for a query. A logical Filter node may be used to filter the result data of its child nodes.

[0045] Specifically, before step S307, step S305 may also be executed.

[0046] In step S305, for any first Filter node in the logical execution plan, if there is a connection edge between the first Filter node and the logical Project node, the first Filter node and the logical Project node are merged, and the merged result is converted into a corresponding physical Calculate node; if there is no connection edge between the first Filter node and the logical Project node, the first Filter node is converted into a corresponding physical Calculate node.

[0047] Taking the target query statement's logical execution plan, as shown on the left side of Figure 4, as an example, the conversion process from a logical execution plan to a physical execution plan is illustrated. Figure 4 is a schematic diagram of the conversion process from a logical execution plan to a physical execution plan. The logical execution plan shown in Figure 4 includes logical query call nodes LCall1, LCall2, and LCall3, a logical correlation query node LCorr, logical filter nodes LFilt1 and LFilt2, a logical join node LJoin, and a logical projection node LProj. In the process of converting the logical execution plan shown in Figure 4 into a physical execution plan, the logical query call nodes LCall1, LCall2, and LCall3 can be converted into corresponding physical query call nodes PCall1, PCall2, and PCall3, the logical association query node LCorr can be converted into the corresponding physical association query node PCorr, the logical filtering node LFilt2 can be converted into the corresponding physical calculation node PCalc2, the logical connection node LJoin can be converted into the corresponding physical connection node PJoin, and the merge result of the adjacent logical filtering node LFilt1 and the logical projection node LProj can be converted into the corresponding physical calculation node PCalc1. Then, based on the relationship between the nodes obtained by the conversion, the physical execution plan shown in the right part of Figure 4 can be generated.

[0048] It should be noted that during the conversion of a logical execution plan into a physical execution plan, logical nodes can be converted into corresponding physical nodes based on pre-defined conversion logic. Furthermore, to facilitate identification of physical nodes as physical branch nodes with multiple child nodes when subsequently sub-graphing the physical execution plan, a target identifier can be added to each physical node with multiple child nodes in the physical execution plan. This target identifier indicates that the corresponding physical node is a physical branch node.

[0049] In step S203, the execution plan is divided into multiple subgraphs along the branch nodes, and the multiple subgraphs are converted into multiple scheduling nodes; wherein a single subgraph includes at least one node.

[0050] In one embodiment, for any branch node among the above-mentioned several branch nodes (hereinafter referred to as the first branch node), if the number of child nodes of each node on a branch path of the first branch node (hereinafter referred to as the first branch path) is not greater than 1, and each node does not depend on the nodes on other branch paths of the first branch node, then the subgraph processing process shown in Figure 5 can be executed. Figure 5 is a flow chart of the subgraph processing process. As shown in Figure 5, in step S501, if the number of child nodes of each node on the first branch path of the first branch node is not greater than 1, and each node does not depend on the nodes on other branch paths of the first branch node, then the nodes are divided into the same first subgraph. In step S503, the execution statement list of each node on the first branch path is obtained, and a first execution function is generated based on the execution statement list. In step S505, a first scheduling node including the first execution function corresponding to the first subgraph is generated.

[0051] If the number of child nodes of each node on the first branch path of the first branch node is no greater than 1, and each node depends on nodes on other branch paths of the first branch node, the subgraph processing process shown in Figure 6 can be executed. Figure 6 is a flowchart of the subgraph processing process. As shown in Figure 6, in step S601, if the number of child nodes of each node on the first branch path of the first branch node is no greater than 1, and each node depends on nodes on other branch paths of the first branch node, then each node and the first branch node are divided into the same second subgraph. In step S603, the execution statement list of each node on the first branch path is obtained, and a second execution function is generated based on the execution statement list, and a sub-process node including the second execution function is generated. In step S605, the execution statement list of the first branch node is obtained, and a third execution function is generated based on the execution statement list, and a main process node including the third execution function is generated; wherein the third execution function calls the second execution function. In step S607, the combination of the main process node and the sub-process node is used as the second scheduling node corresponding to the second subgraph.

[0052] If the first branch node is connected to the root node by a connection edge and no scheduling node associated with the first branch node is generated, the subgraph processing process shown in Figure 7 can be executed. Figure 7 is a flow chart of the subgraph processing process. As shown in Figure 7, in step S701, if the first branch node is connected to the root node by a connection edge and no scheduling node associated with the first branch node is generated, the first branch node and the root node are divided into the same third subgraph. In step S703, the execution statement list of the first branch node and the root node is obtained, and the fourth execution function is generated based on the execution statement list. In step S705, a third scheduling node including the fourth execution function corresponding to the third subgraph is generated.

[0053] It should be noted that the logic for obtaining the execution statement list of the node and generating the execution function based on the execution statement list may be pre-compiled, and corresponding processing may be performed according to the pre-compiled logic.

[0054] Taking the physical execution plan shown in Figure 4 as an example, the implementation process of step S203 is described in conjunction with Figure 8. In the physical execution plan shown in Figure 4, the query of the right child node of the PCorr node depends on the left child node. Figure 8 is a schematic diagram of the subgraph processing process.

[0055] Specifically, let's take the left subtree of the PJoin node as an example. This left subtree contains only one branch path, with two nodes, PCall1 and PCalc2, on this branch path. Since the number of child nodes for PCall1 is 0 and the number of child nodes for PCalc2 is 1, we can determine that neither node is a branch node with multiple child nodes. Furthermore, neither node depends on nodes on other branch paths of the PJoin node. Therefore, the PCall1 and PCalc2 nodes can be grouped into a subgraph, as indicated by reference numeral 801 in Figure 8 . Since queries on the PCall1 node do not depend on other nodes, the PCalc2 node is only used to calculate the result data of the PCall1 node, allowing this subgraph to be independently invoked. When converting this subgraph into a scheduling node, we can obtain the execution statement lists for the PCall1 and PCalc2 nodes, and generate the execution function Func1 based on this execution statement list. This, in turn, generates a scheduling node A corresponding to this subgraph and including the execution function Func1, as shown in Figure 8 .

[0056] Taking the right subtree of the PJoin node as an example, in this right subtree, there is only the PCall2 node on the left branch path of the PCorr node. The PCall2 node is a leaf node with 0 child nodes. Based on the dependency relationship between the child nodes corresponding to the PCorr node, it can be known that the query of the PCall2 node does not depend on the PCall3 node. Therefore, the PCall2 node can be executed independently, and the PCall2 node can be divided into a subgraph such as the one pointed to by label 802. When converting this subgraph into a scheduling node, the execution statement list of the PCall2 node can be obtained, and the execution function Func2 is generated based on the execution statement list, thereby generating a scheduling node B corresponding to the subgraph and including the execution function Func2 as shown in Figure 8.

[0057] There is only PCall3 node on the right branch path of PCorr node, and PCall3 node is a leaf node with 0 child nodes. Based on the dependency relationship between the child nodes corresponding to PCorr node, it can be known that the query of PCall3 node depends on PCall2 node, and PCorr node needs to use the data in the result data of PCall2 node as the input parameter of PCall3 node, so that PCall3 node performs data query based on the input parameter, and thus PCall3 node and PCorr node can be divided into the subgraph pointed to by label 803. When converting the subgraph into a scheduling node, the execution statement list of PCall3 node can be obtained, and the execution function Func3 is generated based on the execution statement list, and then the sub-process node D including the execution function Func3 as shown in Figure 8 is generated. In addition, the execution statement list of PCorr node can be obtained, and the execution function Func4 is generated based on the execution statement list, and then the main process node C including the execution function Func4 as shown in Figure 8 is generated. Among them, the execution function Func4 can call the execution function Func3. For example, the data in the execution result of the execution function Func2 is used as the input parameter of the execution function Func3, so that the execution function Func3 performs data query based on the input parameter. Then, as shown in Figure 8, the combination of the main process node C and the sub-process node D can be used as the scheduling node corresponding to the subgraph pointed to by label 803.

[0058] After processing the left and right subtrees of the PJoin node, the PJoin node and the PCalc1 node can be partitioned into a subgraph indicated by reference numeral 804 in response to the PJoin node being connected to the root node PCalc1 by an edge. When converting this subgraph into a scheduling node, an execution statement list of the PJoin node and the PCalc1 node can be obtained, and an execution function Func5 can be generated based on the execution statement list. Furthermore, a scheduling node E corresponding to the subgraph and including the execution function Func5 can be generated, as shown in FIG8 .

[0059] In one embodiment, the execution plan of the target query statement can be traversed in a depth-first manner, thereby dividing the execution plan into multiple subgraphs along the aforementioned branch nodes, and converting the multiple subgraphs into multiple scheduling nodes. The idea of ​​depth-first traversal can be: first, starting with an unvisited point as the starting vertex, try to visit unvisited vertices along the edge of the current vertex; when there are no unvisited vertices, return to the previous vertex and continue to try to visit other vertices until all vertices have been visited. Obviously, depth-first traversal is to traverse along a branch of the graph to the end, then backtrack and traverse along another edge until all vertices have been visited.

[0060] Taking the physical execution plan shown in FIG4 as an example, the process of traversing the physical execution plan in a depth-first manner is introduced, thereby dividing the physical execution plan into multiple subgraphs along several physical branch nodes, and converting the multiple subgraphs into multiple scheduling nodes.

[0061] First, starting from the PCalc1 node, a node traversal can be performed in the direction from the PCalc1 node to the PCall1 node. When traversing to the PCall1 node, in response to the fact that it has no child nodes, an execution statement list for the PCall1 node can be generated, and then the traversal can be performed back to the PCalc2 node. Next, in response to the fact that the PCalc2 node has only one child node, PCall1, the execution statement list of the PCall1 node can be obtained. Based on this execution statement list, an execution statement list for the PCalc2 node can be generated, and then the traversal can be performed back to the PJoin node. It should be noted that by generating an execution statement list for the PCalc2 node based on the execution statement list of the PCall1 node, the PCall1 and PCalc2 nodes can be merged. Next, in response to the fact that the PJoin node is a branch node, the PJoin node can be added to the pre-order node stack. The pre-order node stack can be used to maintain branch nodes. Then, in response to the fact that the PCalc2 node and the PCall1 node do not depend on nodes on other branch paths of the PJoin node, the PCalc2 node and the PCall1 node can be divided into the same subgraph, and the execution statement list of the PCalc2 node can be obtained. An execution function is generated based on the execution statement list, and then a scheduling node corresponding to the subgraph and including the execution function is generated.

[0062] Next, a node traversal can be performed from the PCorr node to the PCall2 node. When the PCall2 node is traversed, an execution statement list for the PCall2 node can be generated in response to the fact that the node has no child nodes, and then the process can be traced back to the PCorr node. Next, in response to the fact that the PCorr node is a branch node, the PCorr node can be added to the previous node stack. In response to the fact that the PCall2 node does not depend on the PCorr node's child node PCall3, the PCall2 node can be divided into a subgraph, and the execution statement list of the PCall2 node can be obtained. Based on the execution statement list, an execution function can be generated, and then a scheduling node corresponding to the subgraph and including the execution function can be generated.

[0063] Next, the PCorr node's child node PCall3 can be traversed, and in response to the PCall3 node having no child nodes, an execution statement list of the PCall3 node can be generated, and then the PCorr node can be traced back. Next, in response to the query of the PCall3 node being dependent on the PCall2 child node of the PCorr node, the PCorr node and the PCall3 node can be divided into the same subgraph. Afterwards, the PCall3 node's execution statement list can be obtained, and an execution function can be generated based on the execution statement list, and then a sub-process node including the execution function can be generated. Next, the PCorr node's execution statement list can be generated, and an execution function can be generated based on the execution statement list, and then a main process node including the execution function can be generated. Next, the combination of the sub-process node and the main process node can be used as the scheduling node corresponding to the subgraph. In addition, the PCorr node can be popped out from the previous node stack, and then the PJoin node can be traced back.

[0064] Next, in response to the completion of processing of all child nodes of the PJoin node, an execution statement list for the PJoin node can be generated, and the PJoin node can be popped from the previous node stack, and then backtracking to the PCalc1 node can be performed. Next, in response to the PCalc1 node being the root node, the PJoin node and the PCalc1 node can be divided into the same subgraph, and the execution statement list of the PJoin node, a child node of the PCalc1 node, can be obtained. Based on this execution statement list, an execution statement list for the PCalc1 node can be generated, thereby merging the PJoin node and the PCalc1 node. Then, an execution function can be generated based on the execution statement list of the PCalc1 node, and then a scheduling node corresponding to the subgraph and including the execution function can be generated.

[0065] In step S205, a relationship graph between the plurality of scheduling nodes is constructed based on the dependency relationships between the sub-nodes corresponding to the plurality of branch nodes, wherein the relationship graph may be a directed acyclic graph (DAG).

[0066] Taking the scheduling node shown in Figure 8 as an example, based on the dependency relationship between the sub-nodes corresponding to the PJoin node and the PCorr node respectively, it can be analyzed that scheduling node A and scheduling node B can be executed in parallel, scheduling node B and the scheduling node formed by the combination of sub-process node D and main process node C need to be executed serially, the formed scheduling node and scheduling node E need to be executed serially, and scheduling node A and scheduling node E need to be executed serially. Based on the analysis results, a relationship diagram between scheduling nodes A, B, E and the formed scheduling node can be constructed. Among them, the relationship diagram can be shown in Figure 9. Figure 9 is a schematic diagram of the relationship diagram between multiple scheduling nodes. In Figure 9, scheduling node A and scheduling node B are leaf nodes, and scheduling node E is the root node.

[0067] It should be noted that the construction logic of the relationship graph may be pre-compiled, and the relationship graph between the above-mentioned multiple scheduling nodes may be constructed according to the construction logic based on the dependency relationships between the sub-nodes corresponding to the above-mentioned several branch nodes.

[0068] In step S207, the multiple scheduling nodes are concurrently scheduled based on the relationship graph.

[0069] Specifically, the multiple scheduling nodes may be concurrently scheduled based on the relationship graph in a direction from the leaf node to the root node.

[0070] Furthermore, a first execution task corresponding to each leaf node in the relationship graph can be generated. The first execution task may, for example, include the execution function included in its corresponding leaf node, or the execution code obtained by compiling the execution function. Afterwards, each first execution task can be executed in parallel. As an example, an execution scheduler can be used to generate the first execution tasks corresponding to each leaf node, and each first execution task can be added to a task queue, and multiple execution threads can be used to obtain and execute the first execution task from the task queue. It should be noted that an execution scheduling trigger statement for the relationship graph can be generated, and the execution scheduler can be enabled to generate execution tasks by executing the trigger statement.

[0071] In addition, in response to the completion of the first execution task in each of the above-mentioned first execution tasks, based on the relationship between the parent node of the leaf node corresponding to the first execution task and other scheduling nodes, it can be determined whether the parent node can be executed. If the result of the determination is yes, a second execution task corresponding to the parent node can be generated and executed.

[0072] Taking the relationship diagram shown in Figure 9 as an example, execution tasks corresponding to scheduling nodes A and B can be generated, and then the execution tasks corresponding to scheduling nodes A and B can be executed in parallel. After the execution task corresponding to scheduling node B is completed, an execution task corresponding to the scheduling node formed by the combination of sub-process node D and main process node C can be generated and executed. After both the execution task and the execution task corresponding to scheduling node A are completed, an execution task corresponding to scheduling node E can be generated and executed. After the execution task corresponding to scheduling node E is completed, execution can be determined to be complete.

[0073] In practice, as shown in Figure 10, the execution scheduler can add the generated execution task to the task queue, and the execution thread in the execution thread pool can obtain the execution task from the task queue, execute the obtained execution task, and notify the execution scheduler of the execution result after the execution of the execution task is completed. The execution scheduler can determine whether the execution is completed based on the received execution result. If it is determined that the execution is completed, the execution scheduler can return the final execution result. If it is determined that the execution is not completed, the execution scheduler can trigger subsequent execution tasks based on the relationship between nodes and add them to the task queue. Among them, Figure 10 is a schematic diagram of the concurrent scheduling process based on the relationship graph.

[0074] In one embodiment, the relationship graph may be compiled to generate execution code, and the multiple scheduling nodes may be concurrently scheduled based on the execution code, thereby achieving compilation-based concurrent execution.

[0075] The solution provided by the embodiment corresponding to Figure 2 can obtain the execution plan of the target query statement to be executed, wherein the target query statement is used for the joint query of multiple data tables, and the execution plan includes multiple nodes and connecting edges between the nodes. The leaf nodes among the multiple nodes are query call nodes for the data tables in the multiple data tables, and there are several branch nodes among the multiple nodes. The several branch nodes all have multiple child nodes and the dependency relationship between the corresponding child nodes. Afterwards, the execution plan can be divided into multiple subgraphs along the several branch nodes, and the multiple subgraphs can be converted into multiple scheduling nodes. Then, based on the dependency relationship, a relationship graph between the multiple scheduling nodes can be constructed. Then, based on the relationship graph, the multiple scheduling nodes can be concurrently scheduled. In this way, the parallelization of the multiple data table queries can be achieved, thereby improving the overall execution efficiency of the data query.

[0076] Figure 11 is a schematic diagram of the structure of a data query device according to an embodiment of the present disclosure. The device can be applied to any device, platform or device cluster with data storage, computing and processing capabilities, for example, it can be applied to the target platform 102 shown in Figure 1 .

[0077] As shown in FIG11 , the data query apparatus 1100 in an embodiment of the present specification may include: an acquisition unit 1101, a splitting unit 1102, a generation unit 1103, and a scheduling unit 1104. The acquisition unit 1101 is configured to acquire an execution plan for a target query statement to be executed, the target query statement being used for a joint query of multiple data tables, the execution plan comprising multiple nodes and connecting edges between the nodes, a leaf node among the multiple nodes being a query call node for a data table in the multiple data tables, and a plurality of branch nodes among the multiple nodes, each of the multiple branch nodes having multiple child nodes and corresponding dependencies between the child nodes; the splitting unit 1102 is configured to split the execution plan into multiple subgraphs along the multiple branch nodes, and convert the multiple subgraphs into multiple scheduling nodes; a single subgraph includes at least one node; the generation unit 1103 is configured to construct a relationship graph between the multiple scheduling nodes based on the dependency; and the scheduling unit 1104 is configured to concurrently schedule the multiple scheduling nodes based on the relationship graph.

[0078] In one embodiment, a single branch node includes any one of the following: a union node, a join node, and an association query node; wherein the union node is used to union the result data of its child nodes, the join node is used to perform a join operation on the result data of its child nodes, and the association query node is used to use the data in the result data of one of its child nodes as an input parameter of another child node, so that the other child node performs data query based on the input parameter.

[0079] In one embodiment, the execution plan is a physical execution plan, the multiple nodes are multiple physical nodes, the query calling node is a physical query scheduling node, and the multiple branch nodes are multiple physical branch nodes.

[0080] In one embodiment, the acquisition unit 1101 can be further configured to: obtain a logical execution plan of the target query statement, the logical execution plan including multiple logical nodes and connecting edges between the nodes, the leaf nodes among the multiple logical nodes are logical query call nodes for the data tables in the above-mentioned multiple data tables, and there are several logical branch nodes among the multiple logical nodes, each of which has multiple child nodes; and convert the logical execution plan into a physical execution plan.

[0081] In one embodiment, the acquisition unit 1101 can be further configured to: convert each logical query call node in the above-mentioned multiple logical nodes into a corresponding physical query call node; convert several logical branch nodes into corresponding physical branch nodes; and construct a physical execution plan based on the relationship between the nodes obtained by the conversion.

[0082] In one embodiment, the multiple logical nodes further include a logical projection node and several logical filtering nodes; and the acquisition unit 1101 may further be configured to: before constructing a physical execution plan based on the relationship between the nodes obtained by the conversion, for any first filtering node among the several logical filtering nodes, if there is a connection edge between the first filtering node and the logical projection node, merge the first filtering node and the logical projection node, and convert the merged result into a corresponding physical computing node; if there is no connection edge between the first filtering node and the logical projection node, convert the first filtering node into a corresponding physical computing node.

[0083] In one embodiment, the segmentation unit 1102 can be further configured to: for any first branch node among the above-mentioned branch nodes, if the number of child nodes of each node on the first branch path of the first branch node is not greater than 1, and each node does not depend on the nodes on other branch paths of the first branch node, then divide the nodes into the same first subgraph; obtain the execution statement list of each node, and generate a first execution function based on the execution statement list; generate a first scheduling node corresponding to the first subgraph including the first execution function.

[0084] In one embodiment, the splitting unit 1102 can be further configured to: if the number of child nodes of each of the above-mentioned nodes is not greater than 1, and each of the above-mentioned nodes depends on the nodes on the above-mentioned other branch paths, then the above-mentioned nodes and the first branch node are divided into the same second subgraph; obtain the execution statement list of each of the above-mentioned nodes, generate a second execution function based on the execution statement list, and generate a sub-process node including the second execution function; obtain the execution statement list of the first branch node, generate a third execution function based on the execution statement list, and generate a main process node including the third execution function; wherein the third execution function calls the second execution function; and use the combination of the main process node and the sub-process node as the second scheduling node corresponding to the second subgraph.

[0085] In one embodiment, the segmentation unit 1102 can be further configured to: if the first branch node is connected to the root node by a connecting edge and no scheduling node associated with the first branch node is generated, then the first branch node and the root node are divided into the same third subgraph; obtain the execution statement list of the first branch node and the root node, and generate a fourth execution function based on the execution statement list; generate a third scheduling node corresponding to the third subgraph including the fourth execution function.

[0086] In one embodiment, the relationship graph is a directed acyclic graph.

[0087] In one embodiment, the scheduling unit 1104 may be further configured to: concurrently schedule the plurality of scheduling nodes based on the relationship graph in a direction from the leaf node to the root node.

[0088] In one embodiment, the scheduling unit 1104 may be further configured to: generate a first execution task corresponding to each leaf node in the above relationship graph; and execute each first execution task in parallel.

[0089] In one embodiment, the scheduling unit 1104 may be further configured to: add each first execution task to a task queue; and utilize multiple execution threads to obtain and execute the first execution task from the task queue.

[0090] In one embodiment, the scheduling unit 1104 can be further configured to: in response to the completion of the first execution task in each first execution task, determine whether the parent node of the leaf node corresponding to the first execution task can be executed based on the relationship between the parent node and other scheduling nodes; if the determination result is yes, generate the second execution task corresponding to the parent node, and execute the second execution task.

[0091] In the device embodiment corresponding to FIG11 , for further explanation of each unit, reference may be made to the relevant description in the related method embodiment above, which will not be repeated here.

[0092] An embodiment of this specification further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed in a computer, the computer is caused to execute the data query method described in the method embodiment above.

[0093] An embodiment of this specification also provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the data query method described in the method embodiment above is implemented.

[0094] The embodiments of this specification also provide a computer program product, wherein when the computer program product is executed in a computer, the computer is caused to execute the data query method described in the method embodiment above.

[0095] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures like diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages ​​and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.

[0096] The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to implementing the controller in a purely computer-readable program code format, the controller can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules that implement the method and structures within the hardware component.

[0097] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a server system. Of course, this application does not exclude that with the future development of computer technology, the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, an in-vehicle human-computer interaction device, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0098] Although one or more embodiments of this specification provide method operation steps as described in the embodiments or flow charts, more or fewer operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way of executing the order of many steps and does not represent the only execution order. When the device or terminal product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment). The term "comprise", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, product or equipment including a series of elements includes not only those elements, but also includes other elements that are not clearly listed, or also includes elements inherent to such process, method, product or equipment. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or equipment including the elements. For example, if the words first, second, etc. are used to represent the name, they do not represent any particular order.

[0099] For the convenience of description, the above devices are described in terms of functions divided into various modules. Of course, when implementing one or more of the present specifications, the functions of each module can be implemented in the same or multiple software and / or hardware, or the module that implements the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0100] The present invention is described with reference to the flowcharts and / or block diagrams of the methods, apparatus (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one or more processes in the flowchart and / or one or more blocks in the block diagram.

[0101] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0102] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0103] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0104] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0105] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage, graphene storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.

[0106] Those skilled in the art will appreciate that one or more embodiments of this specification may be provided as a method, system, or computer program product. Thus, one or more embodiments of this specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0107] One or more embodiments of this specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. One or more embodiments of this specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0108] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between the various embodiments can be referenced across them. Each embodiment focuses on the differences from the other embodiments. In particular, since the system embodiments are generally similar to the method embodiments, their description is relatively simple. For relevant parts, reference can be made to the description of the method embodiments. Throughout this specification, reference to the terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with that embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic representations of these terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, those skilled in the art may combine and integrate the different embodiments or examples, and features of different embodiments or examples, described in this specification, without conflict.

[0109] The foregoing description is merely an example of one or more embodiments of this specification and is not intended to limit the one or more embodiments of this specification. Those skilled in the art will appreciate that various modifications and variations of one or more embodiments of this specification are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of this specification are intended to be included within the scope of the claims.

Claims

1. A data query method, comprising: Obtaining an execution plan of a target query statement to be executed, the target query statement is used for a joint query of multiple data tables, the execution plan includes multiple nodes and connecting edges between the nodes, a leaf node among the multiple nodes is a query call node for a data table among the multiple data tables, and there are multiple branch nodes among the multiple nodes, each of the multiple branch nodes has multiple child nodes, and the corresponding child nodes have dependency relationships; Along the plurality of branch nodes, the execution plan is divided into a plurality of subgraphs, and the plurality of subgraphs are converted into a plurality of scheduling nodes; wherein a single subgraph includes at least one node; Based on the dependency relationship, construct a relationship graph between the multiple scheduling nodes; Based on the relationship graph, the multiple scheduling nodes are concurrently scheduled.

2. The method according to claim 1, wherein: A single branch node includes any one of the following: a union node, a connection node, and an associated query node; wherein the union node is used to calculate the union of the result data of its child nodes, the connection node is used to perform a connection operation on the result data of its child nodes, and the associated query node is used to use the data in the result data of one of its child nodes as an input parameter of another child node, so that the other child node performs data query based on the input parameter.

3. The method according to claim 1, wherein: The execution plan is a physical execution plan, the multiple nodes are multiple physical nodes, the query calling node is a physical query scheduling node, and the multiple branch nodes are multiple physical branch nodes.

4. The method according to claim 3, wherein: The step of obtaining the execution plan of the target query statement to be executed includes: Obtaining a logic execution plan of the target query statement, the logic execution plan comprising a plurality of logic nodes and connection edges between the nodes, a leaf node among the plurality of logic nodes being a logic query call node for a data table among the plurality of data tables, and a plurality of logic branch nodes each having a plurality of child nodes being present among the plurality of logic nodes; The logical execution plan is converted into the physical execution plan.

5. The method according to claim 4, wherein: The converting the logical execution plan into the physical execution plan includes: Convert each logical query calling node in the plurality of logical nodes into a corresponding physical query calling node; Convert the plurality of logical branch nodes into corresponding physical branch nodes respectively; The physical execution plan is constructed based on the nodes and the relationships between the nodes obtained through the transformation.

6. The method according to claim 5, wherein: The plurality of logical nodes also include a logical projection node and a plurality of logical filtering nodes; as well as Before constructing the physical execution plan based on the relationship between the nodes obtained by the transformation, the following steps are also included: For any first filtering node among the plurality of logical filtering nodes, if the first filtering node is connected to the logical projection node by a connection edge, the first filtering node and the logical projection node are merged, and the merged result is converted into a corresponding physical computing node; If there is no connection edge between the first filtering node and the logical projection node, the first filtering node is converted into a corresponding physical computing node.

7. The method according to claim 1, wherein: The step of dividing the execution plan into a plurality of subgraphs along the plurality of branch nodes, and converting the plurality of subgraphs into a plurality of scheduling nodes includes: For any first branch node among the plurality of branch nodes, if the number of child nodes of each node on the first branch path of the first branch node is not greater than 1, and each node does not depend on nodes on other branch paths of the first branch node, then the nodes are divided into the same first subgraph; Obtaining an execution statement list of each node, and generating a first execution function based on the execution statement list; A first scheduling node including the first execution function corresponding to the first subgraph is generated.

8. The method according to claim 7, wherein: The method further includes dividing the execution plan into a plurality of subgraphs along the plurality of branch nodes, and converting the plurality of subgraphs into a plurality of scheduling nodes. If the number of child nodes of each of the nodes is not greater than 1, and each of the nodes depends on nodes on the other branch paths, then each of the nodes and the first branch nodes are divided into the same second subgraph; Obtaining an execution statement list of each node, generating a second execution function based on the execution statement list, and generating a sub-process node including the second execution function; Acquire the execution statement list of the first branch node, generate a third execution function based on the execution statement list, and generate a main process node including the third execution function; wherein the third execution function calls the second execution function; A combination of the main process node and the sub-process node is used as a second scheduling node corresponding to the second subgraph.

9. The method according to any one of claims 7-8, wherein: The method further includes dividing the execution plan into a plurality of subgraphs along the plurality of branch nodes, and converting the plurality of subgraphs into a plurality of scheduling nodes. If the first branch node is connected to the root node by a connection edge and no scheduling node associated with the first branch node is generated, the first branch node and the root node are divided into the same third subgraph; Obtaining an execution statement list of the first branch node and the root node, and generating a fourth execution function based on the execution statement list; A third scheduling node including the fourth execution function corresponding to the third subgraph is generated.

10. The method according to claim 1, wherein: The relationship graph is a directed acyclic graph.

11. The method according to claim 1, wherein: The concurrently scheduling the multiple scheduling nodes based on the relationship graph includes: The multiple scheduling nodes are concurrently scheduled based on the relationship graph in a direction from the leaf node to the root node.

12. The method according to claim 11, wherein: The concurrently scheduling the multiple scheduling nodes based on the relationship graph along the direction from the leaf node to the root node includes: Generate first execution tasks corresponding to each leaf node in the relationship graph; The first execution tasks are executed in parallel.

13. The method according to claim 12, further comprising: Adding each first execution task to a task queue; The parallel execution of the first execution tasks includes: A first execution task is acquired from the task queue and executed by using a plurality of execution threads.

14. The method according to claim 12, wherein: The concurrently scheduling the plurality of scheduling nodes based on the relationship graph along the direction from the leaf node to the root node further includes: In response to the completion of the execution of the first execution task among the first execution tasks, determining whether the parent node of the leaf node corresponding to the first execution task can be executed based on the relationship between the parent node of the leaf node and other scheduling nodes; If the determination result is yes, a second execution task corresponding to the parent node is generated, and the second execution task is executed.

15. A data query device, comprising: an acquisition unit, configured to acquire an execution plan of a target query statement to be executed, the target query statement being used for a joint query of multiple data tables, the execution plan comprising multiple nodes and connecting edges between the nodes, a leaf node among the multiple nodes being a query call node for a data table among the multiple data tables, and a plurality of branch nodes being present among the multiple nodes, each of the multiple branch nodes having a plurality of child nodes, and corresponding dependencies between the child nodes; A splitting unit is configured to split the execution plan into a plurality of subgraphs along the plurality of branch nodes, and convert the plurality of subgraphs into a plurality of scheduling nodes; wherein a single subgraph includes at least one node; A generating unit configured to construct a relationship graph between the plurality of scheduling nodes based on the dependency relationship; The scheduling unit is configured to concurrently schedule the multiple scheduling nodes based on the relationship graph.

16. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 14.

17. A computing device comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method according to any one of claims 1 to 14 is implemented.

Citation Information

Patent Citations

  • Data query method and device based on artificial intelligence, electronic equipment and medium

    CN114969261A

  • Data query method and device

    CN116483858A

  • Data query method and device

    CN116483859A

  • Efficient computation of multiple group by queries

    US20060253422A1