Query processing method and apparatus, and electronic device

By generating multiple physical execution plans and performing operator relationship matching and cost calculation, the problem that the target physical execution plan cannot be determined after the adaptive query execution method (AQE) optimization is solved, and a reliable calculation method based on cost optimization in Apache Spark is realized.

WO2025153904A1PCT designated stage expired Publication Date: 2025-07-24CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PTE LTD

Patent Information

Application Number
PCT/IB2025/050076
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-01-18
Filing Date
2025-01-03
Publication Date
2025-07-24

AI Technical Summary

Technical Problem

In the prior art, after the adaptive query execution method (AQE) optimizes the Apache Spark physical execution plan, it is impossible to calculate the cost based on the optimized runtime indicators, resulting in the inability to determine the target physical execution plan.

Method used

By receiving the target query statement, multiple first physical execution plans are generated, the runtime index data of each first physical operator is obtained, and the target physical execution plan is determined based on the operator relationship matching and cost calculation.

Benefits of technology

It realizes cost calculation based on the runtime indicators of the optimized physical execution plan, identify the operator relationship, and determine a good physical execution plan, solving the problem that the runtime indicators cannot match after AQE optimization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure IB2025050076_24072025_PF_FP_ABST
    Figure IB2025050076_24072025_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of data processing. Disclosed are a query processing method and apparatus, and an electronic device. The method comprises: receiving a target query statement, and on the basis of the target query statement, generating an original physical execution plan for query processing to obtain a plurality of first physical execution plans; acquiring first runtime metric data of each first physical operator in each first physical execution plan; on the basis of the first runtime metric data, calculating execution cost corresponding to each first physical execution plan, and on the basis of the execution cost, determining a target physical execution plan from among the plurality of first physical execution plans; and executing the target physical execution plan to obtain a query result corresponding to the target query statement. The present application solves the technical problem in the prior art of it not being possible to determine a target physical execution plan caused by the fact that costs cannot be calculated on the basis of runtime metrics of an optimized physical execution plan.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application claims priority to Chinese patent application number 202410077322.X, filed with the Patent Office of the People's Republic of China on January 18, 2024, entitled "Query Processing Method, Apparatus, and Electronic Device," the entire contents of which are incorporated herein by reference. Technical Field: This application relates to the field of data processing technology, and more specifically, to a query processing method, apparatus, and electronic device. Background: The computing engine Apache Spark provides a Structured Query Language (SQL) development model that can convert SQL text into multiple physical execution plans. Cost-based optimization is a query optimization technique that selects a better execution plan from multiple physical execution plans and obtains query results based on that plan. Adaptive Query Execution (AQE) is a key feature introduced in Apache Spark version 3.0. AQE can dynamically optimize physical execution plans based on the application's runtime metrics and adjust the physical operators within them. However, in related art, when AQE is used to optimize the original physical execution plan, it is not possible to calculate costs based on the runtime metrics of the optimized physical execution plan, resulting in an inability to determine a target physical execution plan. Currently, no effective solution has been proposed to address the aforementioned issues. Embodiments of the present application provide a query processing method, apparatus, and electronic device to at least address the technical issue in related art where adaptive query execution is used to optimize the original physical execution plan, but costs cannot be calculated based on the runtime metrics of the optimized physical execution plan, resulting in an inability to determine a target physical execution plan.According to one aspect of an embodiment of the present application, a query processing method is provided, comprising: receiving a target query statement, and generating an original physical execution plan for query processing based on the target query statement to obtain multiple first physical execution plans, wherein each first physical execution plan includes multiple first physical operators, and each first physical operator is used to implement query processing; obtaining first runtime indicator data for each first physical operator in each first physical execution plan, wherein the first runtime indicator data is determined by matching an operator relationship between the first physical operator and a second physical operator, and the second physical operator is a physical operator of a second physical execution plan obtained by optimizing the first physical execution plan according to an adaptive query execution method; calculating an execution cost corresponding to each first physical execution plan based on the first runtime indicator data, and determining a target physical execution plan from the multiple first physical execution plans based on the execution cost; and executing the target physical execution plan to obtain a query result corresponding to the target query statement. Furthermore, obtaining first runtime indicator data of each first physical operator in each first physical execution plan includes: traversing each first physical execution plan and each second physical execution plan according to a target traversal algorithm, and matching operator relationships between the first physical operator and the second physical operator according to a target rule during the traversal process to obtain a matching result; and determining the first runtime indicator data of each first physical operator based on the matching result. Furthermore, each first physical execution plan and each second physical execution plan are traversed separately according to the target traversal algorithm, including: for each second physical execution plan, traversing the second physical execution plan according to the target traversal algorithm to determine the second target physical operator from multiple second physical operators; for each first physical execution plan, traversing the first physical execution plan based on the second target physical operator according to the target traversal algorithm to determine the first target physical operator from multiple first physical operators; using the next physical operator of the first target physical operator in the first physical execution plan as the next physical operator to be matched by the second physical execution plan; and traversing the first physical execution plan based on the next physical operator to be matched by the second physical execution plan according to the target traversal algorithm to determine a sub-physical operator of the first target physical operator from among the first physical operators other than the first target physical operator.Furthermore, during the traversal process, operator relationship matching is performed on the first physical operator and the second physical operator according to the target rule to obtain a matching result, including: obtaining operator information of the first physical operator and operator information of the second physical operator; judging the operator information of the first physical operator and the operator information of the second physical operator according to the target rule to obtain a judgment result; if the judgment result indicates that the operator information of the first physical operator and the operator information of the second physical operator meet the target rule, then determining that the matching result is that the first physical operator and the second physical operator are successfully matched. Furthermore, first runtime indicator data of each first physical operator is determined based on the matching result, including: for each first physical operator, if the matching result is that the first physical operator successfully matches the second physical operator, then determining the operator correspondence relationship between the first physical operator and the second physical operator; obtaining second runtime indicator data of the second physical operator, and converting the second runtime indicator data based on the target mapping relationship to obtain target indicator information, wherein the target mapping relationship is used to characterize the correspondence between semantic representation information and runtime indicators; assigning the target indicator information to the first physical operator based on the operator correspondence relationship to obtain the first runtime indicator data of each first physical operator. Furthermore, assigning target indicator information to the first physical operator based on the operator correspondence to obtain first runtime indicator data for each first physical operator includes: for each first physical operator, assigning semantic representation information in the target indicator information to the key field of the first runtime indicator of the first physical operator based on the operator correspondence, and assigning numerical information in the target indicator information to the value field of the first runtime indicator of the first physical operator; and combining the key field of the first runtime indicator and the value field of the first runtime indicator to form the first runtime indicator data for the first physical operator. Furthermore, calculating the execution cost corresponding to each first physical execution plan based on the first runtime indicator data includes: for each first physical execution plan, summing the runtime indicator data of multiple sub-physical operators of the first target physical operator in the first physical execution plan to obtain an initial indicator data sum; summing the initial indicator data sum with the runtime indicator data of the first target physical operator to obtain a target indicator data sum; and using the target indicator data sum as the execution cost corresponding to the first physical execution plan. Furthermore, determining a target physical execution plan from the plurality of first physical execution plans based on the execution cost includes: sorting target indicator data corresponding to the plurality of first physical execution plans to obtain a sorting result; and determining the target physical execution plan from the plurality of first physical execution plans based on the sorting result.Furthermore, before receiving the target query statement, the method further includes: acquiring a plurality of runtime indicators, wherein the plurality of runtime indicators include a first runtime indicator and a second runtime indicator; and processing the plurality of runtime indicators according to semantic representation information of the runtime indicators to obtain a target mapping relationship. According to another aspect of an embodiment of the present application, a query processing method is further provided, including: obtaining a target query statement uploaded by a client; generating, in a cloud server, an original physical execution plan for query processing based on the target query statement, to obtain multiple first physical execution plans, wherein each first physical execution plan includes multiple first physical operators, and each first physical operator is used to implement query processing; obtaining first runtime indicator data of each first physical operator in each first physical execution plan, wherein the first runtime indicator data is determined by matching an operator relationship between the first physical operator and a second physical operator, and the second physical operator is a physical operator of a second physical execution plan obtained by optimizing the first physical execution plan according to an adaptive query execution method; calculating an execution cost corresponding to each first physical execution plan based on the first runtime indicator data, and determining a target physical execution plan from the multiple first physical execution plans based on the execution cost; executing the target physical execution plan to obtain a query result corresponding to the target query statement; and feeding back the query result corresponding to the target query statement to the client. According to another aspect of an embodiment of the present application, a query processing apparatus is further provided, comprising: a first receiving unit, configured to receive a target query statement and generate an original physical execution plan for query processing based on the target query statement, thereby obtaining multiple first physical execution plans, wherein each first physical execution plan includes multiple first physical operators, each of which is used to implement query processing; a first acquiring unit, configured to acquire first runtime indicator data of each first physical operator in each first physical execution plan, wherein the first runtime indicator data is determined by matching an operator relationship between the first physical operator and a second physical operator, and the second physical operator is a physical operator of a second physical execution plan obtained by optimizing the first physical execution plan according to an adaptive query execution method; a first determining unit, configured to calculate an execution cost corresponding to each first physical execution plan based on the first runtime indicator data, and determine a target physical execution plan from the multiple first physical execution plans based on the execution cost; and a first processing unit, configured to execute the target physical execution plan to obtain a query result corresponding to the target query statement.Furthermore, the first acquisition unit includes: a first processing subunit, configured to traverse each first physical execution plan and each second physical execution plan according to a target traversal algorithm, and perform operator relationship matching on the first physical operator and the second physical operator according to a target rule during the traversal process to obtain a matching result; and a first determination subunit, configured to determine first runtime indicator data of each first physical operator based on the matching result. Furthermore, the first processing sub-unit includes: a first determination module, configured to traverse the second physical execution plan according to a target traversal algorithm for each second physical execution plan, so as to determine the second target physical operator from a plurality of second physical operators; a second determination module, configured to traverse the first physical execution plan based on the second target physical operator according to the target traversal algorithm for each first physical execution plan, so as to determine the first target physical operator from a plurality of first physical operators; a third determination module, configured to use the next physical operator of the first target physical operator in the first physical execution plan as the next physical operator to be matched by the second physical execution plan; and a fourth determination module, configured to traverse the first physical execution plan based on the next physical operator to be matched by the second physical execution plan according to the target traversal algorithm, so as to determine a sub-physical operator of the first target physical operator from among the first physical operators other than the first target physical operator. Furthermore, the first processing sub-unit further includes: a first acquisition module, configured to acquire operator information of the first physical operator and operator information of the second physical operator; a first judgment module, configured to judge the operator information of the first physical operator and the operator information of the second physical operator according to a target rule to obtain a judgment result; and a fifth determination module, configured to determine that the matching result is that the first physical operator and the second physical operator are successfully matched if the judgment result indicates that the operator information of the first physical operator and the operator information of the second physical operator meet the target rule. Furthermore, the first determination subunit includes: a sixth determination module, which is configured to, for each first physical operator, if the matching result is that the first physical operator and the second physical operator are successfully matched, determine the operator correspondence relationship between the first physical operator and the second physical operator; a first processing module, which is configured to obtain the second runtime indicator data of the second physical operator, and convert the second runtime indicator data according to the target mapping relationship to obtain target indicator information, wherein the target mapping relationship is used to characterize the correspondence between the semantic representation information and the runtime indicator; a second processing module, which is configured to assign the target indicator information to the first physical operator according to the operator correspondence relationship to obtain the first runtime indicator data of each first physical operator.Furthermore, the second processing module includes: a first processing submodule configured to, for each first physical operator, assign semantic representation information in the target metric information to a key field of a first runtime metric of the first physical operator based on an operator correspondence, and assign numerical information in the target metric information to a value field of the first runtime metric of the first physical operator; a second processing submodule configured to combine the key field and the value field of the first runtime metric into first runtime metric data for the first physical operator. Furthermore, the first determination unit includes: a first calculation subunit configured to, for each first physical execution plan, sum the runtime metric data of multiple sub-physical operators of the first target physical operator in the first physical execution plan to obtain an initial metric data sum; a second calculation subunit configured to sum the initial metric data sum with the runtime metric data of the first target physical operator to obtain a target metric data sum; and a second determination subunit configured to use the target metric data sum as the execution cost corresponding to the first physical execution plan. Furthermore, the first determination unit further includes: a sorting subunit configured to sort the target indicator data corresponding to the multiple first physical execution plans to obtain a sorting result; and a third determination subunit configured to determine a target physical execution plan from the multiple first physical execution plans based on the sorting result. Furthermore, the query processing apparatus further includes: a second acquisition unit configured to acquire multiple runtime indicators before receiving the target query statement, wherein the multiple runtime indicators include a first runtime indicator and a second runtime indicator; and a second processing unit configured to process the multiple runtime indicators based on semantic representation information of the runtime indicators to obtain a target mapping relationship. According to another embodiment of the present application, a computer-readable storage medium is provided, wherein the storage medium stores a program, wherein when the program is executed, the device containing the storage medium is controlled to execute any one of the query processing methods described above. According to another embodiment of the present application, an electronic device is provided, comprising: a memory storing an executable program; and a processor configured to execute the program, wherein when the program is executed, the device executes any one of the query processing methods described above.In an embodiment of the present application, a target query statement is received and an original physical execution plan for query processing is generated based on the target query statement to obtain multiple first physical execution plans. Each first physical execution plan includes multiple first physical operators, each used to implement query processing. First runtime indicator data is obtained for each first physical operator in each first physical execution plan. The first runtime indicator data is determined by matching an operator relationship between the first physical operator and a second physical operator, where the second physical operator is a physical operator of a second physical execution plan obtained by optimizing the first physical execution plan according to an adaptive query execution method. An execution cost corresponding to each first physical execution plan is calculated based on the first runtime indicator data, and a target physical execution plan is determined from the multiple first physical execution plans based on the execution cost. The target physical execution plan is executed to obtain a query result corresponding to the target query statement. This solves the technical problem in related arts where optimizing original physical execution plans using an adaptive query execution method cannot calculate the cost based on the runtime indicators of the optimized physical execution plans, resulting in an inability to determine the target physical execution plan. By matching physical operator relationships, the operator relationship between the AQE-adjusted physical execution plan (i.e., the second physical execution plan obtained after optimization) and the original physical execution plan (i.e., the first physical execution plan) can be identified, providing an intuitive understanding of the operator optimization results and enabling a better evaluation of the optimization effect and operating cost of the original execution plan. By extracting the runtime indicator data of the physical operators of the AQE-adjusted physical execution plan and providing it to the original physical execution plan, the problem of mismatching the runtime indicators of the physical execution plan adjusted and optimized by AQE is resolved. This provides a reliable cost calculation method for the implementation of cost optimization in Apache Spark 3, achieving the goal of effectively identifying the operator relationship between the AQE-adjusted physical execution plan and the original physical execution plan. This enables cost calculation based on the runtime indicators of the optimized physical execution plan, thereby determining the technical effect of the optimal physical execution plan. BRIEF DESCRIPTION OF THE DRAWINGS The drawings described herein are used to provide a further understanding of the present application and constitute a part of this application. The illustrative embodiments of this application and their description are used to explain this application and do not constitute an undue limitation of this application.In the accompanying drawings: Figure 1 is a schematic diagram of a computer terminal according to the first embodiment of the present application; Figure 2 is a flow chart of a query processing method according to the first embodiment of the present application; Figure 3 is a schematic diagram of an optional process for screening physical execution plans according to the first embodiment of the present application; Figure 4 is a schematic diagram of an optional process for cost calculation according to the first embodiment of the present application; Figure 5 is a flow chart of a query processing method according to the second embodiment of the present application; Figure 6 is a schematic diagram of a query processing device according to the third embodiment of the present application; and Figure 7 is a schematic diagram of a computing terminal according to the fourth embodiment of the present application. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS To help those skilled in the art better understand the present invention, the technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the accompanying drawings. It should be understood that the described embodiments are merely a portion of the embodiments of the present application, and are not intended to be exhaustive. Based on the embodiments of the present application, all other embodiments derived by persons of ordinary skill in the art without inventive effort shall fall within the scope of protection of the present application. It should be noted that the terms "first," "second," and the like in the specification and claims of the present application and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device comprising a series of steps or units need not be limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such process, method, product, or device. It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, and displayed data, etc.) referred to in this application are all information and data authorized by the user or fully authorized by all parties. The collection, use, and processing of such data must comply with the relevant laws, regulations, and standards of the relevant region, and corresponding operation portals are provided for the user to choose to authorize or deny. First, some nouns or terms appearing in the description of the embodiments of this application are subject to the following interpretations: Runtime metrics: Metrics used to measure the performance and operating status of an application during program execution, which can provide real-time performance and efficiency information about the application.

[0002] Apache Spark physical execution plan: An execution plan defined in an Apache Spark application that describes the actual execution of a query or transformation written in Spark SQL. The physical execution plan defines the process of converting a logical execution plan into specific physical operations and tasks. Example 1: According to an embodiment of the present application, a query processing method is also provided. It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system, such as a set of computer-executable instructions. Furthermore, although the flowcharts show a logical order, in some cases, the steps shown or described can be executed in a different order than shown. The method embodiment provided in Example 1 of the present application can be executed in a mobile terminal, computer terminal, or similar computing device. Figure 1 shows a hardware block diagram of a computer terminal (or mobile device) for implementing the query processing method. As shown in FIG1 , a computer terminal (or mobile device) 10 may include a processor assembly 102 (processor assembly 102 may include, but is not limited to, a processing device such as a microcontroller unit (MCU) or a field programmable gate array (FPGA), and processor assembly 102 may include a processor assembly, as shown in FIG1 by 102a, 102b, ..., 102n), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, the computer terminal 100 may include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of a BUS), a network interface, a power supply, and / or a camera. Those skilled in the art will appreciate that the structure shown in FIG1 is merely illustrative and does not limit the structure of the electronic device described above. For example, the computer terminal 10 may include more or fewer components than shown in FIG1 , or have a configuration different from that shown in FIG1 . It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuitry." The data processing circuitry may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuitry may be a single, independent processing module, or may be fully or partially integrated into any other component of the computer terminal 10 (or mobile device).Memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the query processing method in the embodiments of the present application. Processor 102 executes the software programs and modules stored in memory 104 to execute various functional applications and data processing, thereby implementing the query processing method described above. Memory 104 may include high-speed random access memory (RAM) and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 104 may further include memory remote from processor 102, which can be connected to computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Transmission device 106 is used to receive or transmit data via a network. Specific examples of such networks may include a wireless network provided by the telecommunications provider of computer terminal 10. In one example, transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module for wireless communication with the Internet. The display may be a touchscreen liquid crystal display that enables a user to interact with the user interface of the computer terminal 10 (or mobile device). The computing engine Apache Spark provides an SQL development mode that can convert SQL text into multiple physical execution plans. Cost-based optimization is a query optimization technique that selects a better execution plan from multiple physical execution plans and obtains query results based on that plan.

[0003] AQE is a key feature introduced in Apache Spark since version 3.0. AQE can dynamically optimize physical execution plans based on application runtime metrics and adjust the physical operators within them. However, cost optimization has encountered challenges since Apache Spark 3.0. The difficulty lies in the fact that AQE adjusts and optimizes the physical execution plan, resulting in a mismatch between the runtime metrics and the original physical execution plan. Consequently, cost calculation cannot be performed based on the runtime metrics of the optimized physical execution plan, resulting in an inability to determine a better physical execution plan. Against this technical background, the present application provides a query processing method as shown in FIG2 . FIG2 is a flowchart of the query processing method provided according to Embodiment 1 of the present application. The method includes: Step S201: Receive a target query statement and generate an original physical execution plan for query processing based on the target query statement, obtaining multiple first physical execution plans, each of which includes multiple first physical operators, each of which is used to implement query processing. Optionally, the target query statement may be an SQL statement written based on Spark SQL. Based on the target query statement, an original physical execution plan for query processing may be generated, i.e., multiple first physical execution plans may be obtained. Specifically, the first physical execution plan is an original physical execution plan, and the first physical operator is a physical operator in the original physical execution plan, referred to as an original physical operator. For example, an Apache Spark physical execution plan consists of multiple physical operators, which are responsible for executing computing tasks on a cluster. FIG3 is a flow chart of an optional process of screening physical execution plans provided in accordance with the first embodiment of the present application. As shown in FIG3 , the Apache Spark SQL text is first converted into an unparsed logical execution plan. Then, Apache Spark uses an analyzer to parse the plan to obtain a parsed logical execution plan. The planner is then used to optimize the plan to obtain an optimized logical execution plan. The optimized logical execution plan is then converted into multiple physical execution plans using a planner, and a better physical execution plan is selected based on cost optimization. For example, AQE dynamically optimizes the physical execution plan based on runtime indicators and adjusts the physical operators in the physical execution plan. By collecting and using statistical information and runtime indicator data, the costs of different physical execution plans can be estimated and compared (i.e., cost calculation is performed). The execution plan with the lower cost is selected as the target physical execution plan to obtain the screened physical execution plan. Among them, AQE can provide the following functions and optimizations: (1) Changing the join strategy.AQE can use runtime metrics to determine the size of tables involved in join calculations and replan the join strategy. For example, if the data volume of one table falls below a specified threshold, AQE can adjust the join operator in the physical execution plan to a broadcast hash join operator.

[0004] (2) Remove unnecessary sorting. Runtime indicators can collect the number of data rows. For example, if the number of sorted data rows in the physical execution plan is less than or equal to 1, AQE will remove the Sort operator in the physical execution plan to avoid performing unnecessary sorting calculations. Step S202: Obtain first runtime indicator data for each first physical operator in each first physical execution plan. The first runtime indicator data is determined by matching the operator relationship between the first physical operator and the second physical operator. The second physical operator is the physical operator of the second physical execution plan obtained after optimizing the first physical execution plan according to the adaptive query execution method. The first runtime indicator data is the indicator data generated during the execution of the physical operator. For example, a physical operator (i.e., the second physical operator) in the AQE-adjusted physical execution plan (i.e., the second physical execution plan) can be matched with a physical operator (i.e., the first physical operator) in the original physical execution plan (i.e., the first physical execution plan). If the match is successful, the runtime metric data of the physical operator in the AQE-adjusted physical execution plan can be synchronized with the corresponding physical operator in the original physical execution plan, thereby obtaining first runtime metric data for the first physical operator. The second physical execution plan can be the AQE-adjusted physical execution plan, and the second physical operator is the physical operator in the AQE-adjusted physical execution plan, referred to as the adjusted physical operator. In step S203, the execution cost corresponding to each first physical execution plan is calculated based on the first runtime metric data, and a target physical execution plan is determined from the multiple first physical execution plans based on the execution cost. In step S204, the target physical execution plan is executed to obtain a query result corresponding to the target query statement. The execution cost corresponding to the original physical execution plan can be calculated based on the runtime indicator data of the original physical operators (i.e., the first runtime indicator data). This allows a better physical execution plan (i.e., the target physical execution plan) to be determined from multiple original physical execution plans based on the execution cost. The selected better physical execution plan is then executed to obtain the query result corresponding to the SQL statement. For example, after matching operator relationships and synchronizing runtime indicator data, the runtime indicator data of all physical operators in the original physical execution plan can be obtained and used as the runtime cost of the physical operators. The runtime costs of all physical operators are then aggregated to obtain the total runtime cost (i.e., the execution cost) of the original physical execution plan. Taking runtime as an example, the runtime cost of the original physical execution plan can be calculated by aggregating the runtime data in the runtime indicator data of the physical operators.For example, the runtime costs of multiple original physical execution plans can be sorted, and the original physical execution plan with the lowest runtime cost in the sorted results can be used as the target physical execution plan. In this solution, physical operator relationship matching can be used to identify the operator relationship between the AQE-adjusted physical execution plan (i.e., the second physical execution plan obtained after optimization) and the original physical execution plan (i.e., the first physical execution plan), providing an intuitive understanding of the operator optimization results and enabling a better evaluation of the optimization effect and runtime cost of the original execution plan. By extracting runtime metric data for the physical operators of the AQE-adjusted physical execution plan and providing it to the original physical execution plan, this solves the problem of mismatching runtime metrics between the AQE-adjusted and optimized physical execution plan and the original physical execution plan, providing a reliable cost calculation method for implementing cost optimization in Apache Spark 3. In an optional embodiment, the schematic diagram shown in Figure 4 can be used to implement cost calculation. As shown in Figure 4 , runtime metrics are first abstractly represented. The start time, end time, runtime duration, parameters, data volume, number of output data rows, and peak memory usage are selected as runtime metrics for cost calculation. The physical execution plan is then dynamically adjusted using AQE. As shown in Figure 4 , the tree structure on the left represents the original physical execution plan, and the tree structure on the right represents the physical execution plan adjusted by AQE. Related operators are then identified and runtime metrics are associated. For example, through operator relationship matching, it is determined that the Broadcast Hash Join operator corresponds to the Sort Merge Join operator. The runtime metric data of the Broadcast Hash Join operator is synchronized with the Sort Merge Join operator, thereby obtaining the runtime metric data of the original physical execution plan. For example, the start time is "2023-06-13 17:27:31", the end time is "2023-06-13 17:28:00", the runtime is "29", and the parameters are "{"leftKeys": xxx}", the data volume is "800000000", the number of output data rows is "529035", and the peak memory usage is "262144". Then, the running cost of the original physical execution plan can be calculated based on the runtime indicator data of all original physical operators.To address the mismatch between runtime metrics and the original physical execution plan caused by AQE-adjusted and optimized physical execution plans, this solution provides a method for abstracting physical operator runtime metrics, matching AQE-adjusted physical execution plans with the original physical execution plan, and calculating costs based on the runtime metrics of the original physical execution plan. This provides a novel cost estimation capability for AQE-optimized Apache Spark SQL. First, the runtime metrics of all physical operators in Apache Spark are combined to create a unified metric representation, providing a foundation for resolving metric mismatches caused by AQE-adjusted physical operators. Then, a depth-first algorithm is used to traverse both the AQE-adjusted and original physical execution plans, matching operators in the two plans based on specific rules. Upon a successful match, the runtime metric data of the physical operators in the AQE-adjusted plan is converted to a unified metric representation and synchronized with the physical operators in the original physical execution plan. AQE optimization rules are then used to determine operator correlation, preventing the matching of operators with low correlation and ensuring the reliability of the matching rules. After operator matching and runtime indicator data synchronization are complete, the physical operators of the original physical execution plan with runtime indicator data are stored in the database. During cost calculation, the execution cost of the original physical execution plan can be calculated based on the runtime indicator data of the physical operators in the original physical execution plan, thereby screening a target physical execution plan with a lower cost from multiple original physical execution plans. This solution can automatically process Apache Spark application runtime indicators, identify AQE dynamic operator adjustment results, and provide a new solution for evaluating Apache Spark SQL execution costs. How to obtain the runtime indicator data of the original physical operators is crucial. Therefore, in the query processing method provided in Example 1 of the present application, obtaining the first runtime indicator data of each first physical operator in each first physical execution plan includes: traversing each first physical execution plan and each second physical execution plan according to a target traversal algorithm, and performing operator relationship matching between the first physical operator and the second physical operator according to the target rule during the traversal process to obtain a matching result; and determining the first runtime indicator data of each first physical operator based on the matching result.Optionally, the target traversal algorithm can be an in-order traversal algorithm of a depth-first traversal algorithm. For example, when obtaining runtime metric data for the original physical operator, the original physical execution plan and the AQE-adjusted physical execution plan can be traversed using the in-order traversal algorithm. During the traversal process, the original physical operator and the adjusted physical operator can be matched based on the operator relationship according to the target rule to obtain a matching result. The target rule can be a rule that determines that an operator match is successful if any of the following conditions are met: a. The two operators have the same name; b. The operator parameters are part of the other operator's parameters; c. The operator name is part of the other operator's name; d. The two operators perform a Join on the same pair of tables and have the same key; e. Both operators are named Scan and scan the same data source; f. Both operators are command execution operators and have the same command. Optionally, the runtime metric data for the original physical operator can be determined based on the matching result. For example, if the matching result indicates a successful match between the original and adjusted physical operators, the runtime metrics of the adjusted physical operator can be converted to a unified metric representation and synchronized with the original physical operator. For example, for the runtime metric data "runtime = 10 seconds," the adjusted physical operator uses fetch wait time to represent the runtime, while the original physical operator uses time to build a hash map to represent the runtime. If the original and adjusted physical operators successfully match, the runtime metric data of the adjusted physical operator "fetch wait time = 10 seconds" can be converted to "runtime = 10 seconds" and synchronized with the original physical operator. This determines the runtime metric data of the original physical operator "time to build hash map = 10 seconds." It should be noted that physical operator relationship matching can identify the operator relationship between the AQE-adjusted physical execution plan and the original physical execution plan, thereby effectively evaluating the optimization effect and runtime cost of the original execution plan.In order to be able to identify the operator relationship between the physical execution plan adjusted by AQE and the original physical execution plan, in the query processing method provided in the first embodiment of the present application, each first physical execution plan and each second physical execution plan are traversed separately according to the target traversal algorithm, including: for each second physical execution plan, traversing the second physical execution plan according to the target traversal algorithm to determine the second target physical operator from multiple second physical operators; for each first physical execution plan, traversing the first physical execution plan based on the second target physical operator according to the target traversal algorithm to determine the first target physical operator from multiple first physical operators; using the next physical operator of the first target physical operator in the first physical execution plan as the next physical operator to be matched with the second physical execution plan; traversing the first physical execution plan based on the next physical operator to be matched with the second physical execution plan according to the target traversal algorithm to determine the sub-physical operator of the first target physical operator from the first physical operators other than the first target physical operator. The key to resolving the issue of AQE causing runtime metrics to mismatch with the original physical execution plan lies in identifying the relationship between the actual running physical operators and the physical operators in the original physical execution plan. Therefore, in this solution, an in-order traversal algorithm is used to traverse both the original physical execution plan and the AQE-adjusted physical execution plan. For example, the in-order traversal algorithm is first used to traverse the AQE-adjusted physical execution plan to determine the root operator (i.e., the second target physical operator) in the AQE-adjusted physical execution plan from among multiple adjusted physical operators. For example, in the Broadcast Hash Join operator shown in Figure 4, traversing to a physical operator without a parent node in the AQE-adjusted physical execution plan yields the second target physical operator. After obtaining the root operator in the AQE-adjusted physical execution plan, the original physical execution plan can be traversed using an in-order traversal algorithm based on this root operator to determine the root operator (i.e., the first target physical operator) in the original physical execution plan from among multiple original physical operators, such as the Sort merge join operator shown in FIG4 . The next physical operator of the root operator in the original physical execution plan (i.e., the Sort operator shown in FIG4 ) can then be used as the next physical operator to be matched in the AQE-adjusted physical execution plan. For example, the next physical operator of the Sort merge join operator shown in FIG4 is the Sort operator, and the next operator of the corresponding Broadcast hash join operator, i.e., an empty node or a Broadcast operator, can be used as the next physical operator to be matched.For example, the original physical execution plan is traversed using an in-order traversal algorithm based on an empty node or a Broadcast operator to determine the child physical operators of the root operator from the original physical operators other than the root operator. For example, the Sort, Merge, and Join operator shown in FIG4 is the root operator, and the Sort, Shuffle, Scan, and Filter operators on the two branches below it are all child physical operators of the Sort, Merge, and Join operator. It should be noted that in this solution, the AQE-adjusted physical execution plan is first traversed in-order until the root operator of the original physical execution plan is matched. The next operator in the original physical execution plan is then traversed in-order. Starting from the root operator matched by the AQE-adjusted physical execution plan, its child operators are again traversed in-order until a physical operator in the original physical execution plan is matched. This loop is repeated until all physical operators of both physical execution plans have been traversed. This allows the operator relationship between the AQE-adjusted physical execution plan and the original physical execution plan to be identified, thereby better evaluating the optimization effect and operating cost of the original execution plan. In order to determine the operator correspondence, in the query processing method provided in the first embodiment of the present application, during the traversal process, the operator relationship matching of the first physical operator and the second physical operator is performed according to the target rule to obtain a matching result, including: obtaining the operator information of the first physical operator and the operator information of the second physical operator; judging the operator information of the first physical operator and the operator information of the second physical operator according to the target rule to obtain a judgment result; if the judgment result indicates that the operator information of the first physical operator and the operator information of the second physical operator meet the target rule, then determining that the matching result is that the first physical operator and the second physical operator are successfully matched. During the traversal process, the original physical operator and the adjusted physical operator can be matched based on the target rule to obtain a matching result. First, the operator information of the original physical operator and the operator information of the adjusted physical operator are obtained. The operator information can include information such as the operator name, operator parameters, and operator type. Then, the operator information of the original physical operator and the operator information of the adjusted physical operator can be judged based on the target rule to obtain a judgment result. For example, if any of the following conditions is met, the operator matching is determined to be successful: a. The two operators have the same name; b. The operator parameters are part of the other operator parameters; c. The operator name is part of the other operator name; d. The two operators perform Join on the same pair of tables and have the same key; e. The two operators are both named Scan and scan the same data source; f. Both operators are command execution operators and have the same command.If the judgment result indicates that the operator information of the original physical operator and the operator information of the adjusted physical operator satisfy the target rule (for example, satisfying any of the above conditions), then the matching result can be determined as a successful match between the original physical operator and the adjusted physical operator, that is, a corresponding relationship between the two physical operators is obtained. For example, the adjusted physical operator Broadcast hash join corresponds to the original physical operator Sort merge join. In order to perform cost calculation based on the runtime indicator data of the physical execution plan adjusted by AQE, in the query processing method provided in the first embodiment of the present application, before receiving the target query statement, multiple runtime indicators are obtained, wherein the multiple runtime indicators include a first runtime indicator and a second runtime indicator; the multiple runtime indicators are processed according to the semantic representation information of the runtime indicators to obtain a target mapping relationship. Because many different indicators are generated during the execution of different physical operators, such as execution time and data size, etc. Taking data size as an example, operators such as TakeOrderedAndProject use the shuffle bytes written indicator to measure the data size processed by the operator during runtime, while operators such as BroadcastExchange and ShuffleExchange use data The size metric measures the size of data processed by an operator during runtime. Furthermore, the physical operators in the AQE-adjusted physical execution plan introduce new runtime metrics. For example, for the runtime metric "runtime," the adjusted physical operator uses fetch wait time to represent runtime, while the original physical operator uses time to build a hash map. This makes it impossible to provide the runtime metric to the corresponding physical operator in the original physical execution plan. Therefore, this solution abstractly represents Apache Spark runtime metrics, unifies runtime metrics with the same meaning, and generates a mapping relationship between runtime metrics and metric information to obtain the target mapping relationship. For example, before receiving the target query statement, multiple runtime metrics are obtained, including the runtime metrics of the original physical execution plan (i.e., the first runtime metric) and the runtime metrics of the AQE-adjusted physical execution plan (i.e., the second runtime metric). These multiple runtime metrics are then summarized and unified based on their semantic representation information (e.g., data volume, runtime, etc.), resulting in the target mapping relationship shown in Table 1. Table 1. To obtain runtime metric data for the original physical operator, the query processing method provided in the first embodiment of the present application determines first runtime metric data for each first physical operator based on the matching result. The method includes: for each first physical operator, if the matching result is that the first physical operator successfully matches the second physical operator, determining an operator correspondence relationship between the first physical operator and the second physical operator; obtaining second runtime metric data for the second physical operator and converting the second runtime metric data based on a target mapping relationship to obtain target metric information, where the target mapping relationship represents the correspondence between semantic representation information and runtime metrics; and assigning the target metric information to the first physical operator based on the operator correspondence relationship to obtain the first runtime metric data for each first physical operator. Optionally, during the process of determining the runtime metric data for the original physical operator based on the matching result, if the matching result is that the original physical operator successfully matches the adjusted physical operator, then an operator correspondence relationship between the original physical operator and the adjusted physical operator can be determined. For example, a Broadcast Hash Join operator corresponds to a Sort Merge Join operator. After the operators of the two physical execution plans are successfully matched, the runtime indicator data of the adjusted physical operator can be converted into an abstract expression and assigned to the original physical operator. Therefore, the runtime indicator data of the adjusted physical operator (i.e., the second runtime indicator data) is obtained and converted based on the target mapping relationship to obtain target indicator information. The target indicator information can include semantic representation information (i.e., textual description meaning) and numerical information. For example, if the target indicator information is "runtime = 10 seconds," the target indicator information is then assigned to the corresponding original physical operator based on the operator mapping relationship to obtain the runtime indicator data of the original physical operator. For example, for the runtime indicator data "runtime = 10 seconds", the adjusted physical operator uses fetch wait time to represent the runtime, while the original physical operator uses time to build hash map to represent the runtime. When the original physical operator and the adjusted physical operator are successfully matched, the operator correspondence between the original physical operator and the adjusted physical operator is determined. The runtime indicator data "fetch wait time = 10 seconds" of the adjusted physical operator can be converted to "runtime = 10 seconds" and synchronized to the original physical operator. The runtime indicator data "time to build hash map = 10 seconds" of the original physical operator can be determined.In order to obtain the runtime indicator data of the original physical operator, in the query processing method provided in the first embodiment of the present application, the target indicator information is assigned to the first physical operator according to the operator correspondence relationship to obtain the first runtime indicator data of each first physical operator, including: for each first physical operator, the semantic representation information in the target indicator information is assigned to the key field of the first runtime indicator of the first physical operator according to the operator correspondence relationship, and the numerical information in the target indicator information is assigned to the value field of the first runtime indicator of the first physical operator; the key field of the first runtime indicator and the value field of the first runtime indicator are combined to form the first runtime indicator data of the first physical operator. Optionally, when assigning target metric information to the original physical operator based on the operator correspondence to obtain the runtime metric data of the original physical operator, the semantic representation information in the target metric information can be assigned to the key field of the runtime metric of the original physical operator based on the operator correspondence, and the numerical information in the target metric information can be assigned to the value field of the runtime metric of the original physical operator. The key field and the value field are then combined to form the runtime metric data of the original physical operator. For example, if the target metric information is "data volume = 1000", the key field of the runtime metric of the original physical operator is assigned the data volume, and the value field of the runtime metric of the original physical operator is assigned the value of 1000. It should be noted that by extracting the runtime metric data of the AQE-adjusted physical execution plan and converting it into an abstract representation for the original physical execution plan, a data foundation is provided for cost calculation, thereby effectively evaluating the optimization effect and operating cost of the original execution plan and resolving the issue of mismatch between the runtime metrics and the original physical execution plan caused by AQE adjustment of the physical operator. To enable cost calculation, in the query processing method provided in the first embodiment of the present application, the execution cost corresponding to each first physical execution plan is calculated based on the first runtime indicator data, including: for each first physical execution plan, summing the runtime indicator data of multiple sub-physical operators of the first target physical operator in the first physical execution plan to obtain the initial indicator data sum; summing the initial indicator data sum and the runtime indicator data of the first target physical operator to obtain the target indicator data sum; and using the target indicator data sum as the execution cost corresponding to the first physical execution plan.The execution cost corresponding to the original physical execution plan can be calculated based on the runtime metrics of the original physical operators. For example, after matching operator relationships and synchronizing runtime metrics, the runtime metrics of all physical operators in the original physical execution plan can be obtained. First, the runtime metrics of the multiple child physical operators of the root operator in the original physical execution plan are summed to obtain the initial metrics data sum. Then, this initial metrics data sum is summed with the runtime metrics data of the root operator to obtain the target metrics data sum, which is used as the execution cost corresponding to the original physical execution plan. For example, for a root operator, its runtime cost can be combined with the runtime costs of its child operators to obtain the total runtime cost of the physical execution plan. Taking runtime as an example, this solution can aggregate the runtime metrics of the physical operators from the bottom up. The total runtime obtained by the root operator after calculation is the runtime cost of the physical execution plan. To determine a superior physical execution plan, the query processing method provided in the first embodiment of the present application determines a target physical execution plan from multiple first physical execution plans based on execution cost. The method includes: sorting the target indicator data corresponding to the multiple first physical execution plans to obtain a sorted result; and determining the target physical execution plan from the multiple first physical execution plans based on the sorted result. Taking runtime as an example, the runtime cost of the original physical execution plan can be calculated by aggregating runtime data from the runtime indicator data of the physical operators. For example, after summing the initial indicator data and the runtime indicator data of the root operator to obtain the target indicator data, and using the target indicator data as the execution cost corresponding to the original physical execution plan, the runtime costs corresponding to the multiple original physical execution plans can be sorted. The original physical execution plan corresponding to the lowest runtime cost in the sorted result is used as the target physical execution plan, thereby determining a superior physical execution plan from the multiple original physical execution plans.It should be noted that this solution provides an Apache Spark physical execution plan cost calculation method based on runtime metrics. By abstractly expressing the runtime metrics of Apache Spark physical operators, this solution unifies the metrics of different physical operators, improving the comparability of runtime metrics across different physical operators. Furthermore, this solution can identify the operator correspondence between the AQE-adjusted physical execution plan and the original physical execution plan, providing an intuitive understanding of operator optimization results. This allows for the extraction of runtime metric data from the AQE-adjusted physical execution plan, conversion of this data into an abstract representation, and provisioning it to the original physical execution plan for cost calculation, effectively evaluating the optimization effect and runtime cost of the original execution plan. This solution addresses the mismatch between runtime metrics and the original physical execution plan caused by AQE-adjusted physical operators, providing a reliable cost calculation method for implementing cost-based optimization in Apache Spark 3. In an embodiment of the present application, a target query statement is received and an original physical execution plan for query processing is generated based on the target query statement to obtain multiple first physical execution plans. Each first physical execution plan includes multiple first physical operators, each used to implement query processing. First runtime indicator data is obtained for each first physical operator in each first physical execution plan. The first runtime indicator data is determined by matching an operator relationship between the first physical operator and a second physical operator, where the second physical operator is a physical operator of a second physical execution plan obtained by optimizing the first physical execution plan according to an adaptive query execution method. An execution cost corresponding to each first physical execution plan is calculated based on the first runtime indicator data, and a target physical execution plan is determined from the multiple first physical execution plans based on the execution cost. The target physical execution plan is executed to obtain a query result corresponding to the target query statement. This solves the technical problem in related arts where optimizing original physical execution plans using an adaptive query execution method cannot calculate the cost based on the runtime indicators of the optimized physical execution plans, resulting in an inability to determine the target physical execution plan.By matching physical operator relationships, the operator relationship between the AQE-adjusted physical execution plan (i.e., the optimized second physical execution plan) and the original physical execution plan (i.e., the first physical execution plan) can be identified, providing an intuitive understanding of the operator optimization results and enabling a better evaluation of the optimization effect and runtime cost of the original execution plan. By extracting the runtime indicator data of the physical operators of the AQE-adjusted physical execution plan and providing it to the original physical execution plan, the problem of mismatching the runtime indicators of the AQE-adjusted and optimized physical execution plan with the original physical execution plan is resolved. This provides a reliable cost calculation method for the implementation of cost optimization in Apache Spark 3, effectively identifying the operator relationship between the AQE-adjusted physical execution plan and the original physical execution plan. This enables cost calculation based on the runtime indicators of the optimized physical execution plan, thereby determining the technical effect of a better physical execution plan. It should be noted that for the sake of simplicity, the aforementioned method embodiments are all expressed as a series of action combinations. However, those skilled in the art should be aware that this application is not limited by the order of the actions described, as certain steps can be performed in other orders or simultaneously according to this application. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are preferred embodiments, and the actions and modules involved are not necessarily required by this application. Through the above description of the embodiments, those skilled in the art will clearly understand that the methods according to the above embodiments can be implemented using software and a required general-purpose hardware platform. Hardware can also be used, but in many cases the former is a more preferred implementation. Based on this understanding, the technical solution of this application, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk) and includes instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of this application.Embodiment 2 According to an embodiment of the present application, a query processing method is further provided. As shown in FIG5 , the method includes: step S501, obtaining a target query statement uploaded by a client; step S502, generating, in a cloud server, an original physical execution plan for query processing based on the target query statement, to obtain multiple first physical execution plans, wherein each first physical execution plan includes multiple first physical operators, each of which is used to implement query processing; obtaining first runtime indicator data for each first physical operator in each first physical execution plan, wherein the first runtime indicator data is determined by matching an operator relationship between the first physical operator and a second physical operator, and the second physical operator is a physical operator of a second physical execution plan obtained by optimizing the first physical execution plan according to an adaptive query execution mode; calculating an execution cost corresponding to each first physical execution plan based on the first runtime indicator data, and determining a target physical execution plan from the multiple first physical execution plans based on the execution cost; executing the target physical execution plan to obtain a query result corresponding to the target query statement; and step S503, feeding back the query result corresponding to the target query statement to the client. Through the above solution, physical operator relationship matching can be used to identify the operator relationship between the AQE-adjusted physical execution plan (i.e., the optimized second physical execution plan) and the original physical execution plan (i.e., the first physical execution plan), providing an intuitive understanding of the operator optimization results and enabling a better evaluation of the optimization effect and operating cost of the original execution plan. By extracting runtime metric data for the physical operators of the AQE-adjusted physical execution plan and providing it to the original physical execution plan, the problem of mismatching runtime metrics between the AQE-adjusted and optimized physical execution plan and the original physical execution plan is resolved, providing a reliable cost calculation method for cost-based optimization implementation in Apache Spark 3. The specific method for query processing in the cloud server is the same as that in Example 1 and will not be further described here. It should be noted that for simplicity of description, the aforementioned method embodiments are described as a series of action combinations. However, those skilled in the art should be aware that this application is not limited to the order of the actions described, as certain steps can be performed in a different order or simultaneously according to this application. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are preferred embodiments, and the actions and modules involved are not necessarily required for this application. Through the above description of the embodiments, those skilled in the art will clearly understand that the methods according to the above embodiments can be implemented using software plus a required general-purpose hardware platform. Of course, hardware can also be used, but in many cases the former is a more preferred implementation method.Based on this understanding, the technical solution of this application, or the portion that contributes to the prior art, can essentially be embodied in the form of a software product. This computer software product is stored in a storage medium (e.g., ROM / RAM, a magnetic disk, or an optical disk) and includes instructions for enabling a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of this application. Example 3: According to an embodiment of this application, a query processing device for implementing the above-described query processing method is also provided. As shown in FIG6 , the device includes: a first receiving unit 601, a first obtaining unit 602, a first determining unit 603, and a first processing unit 604. A first receiving unit 601 is configured to receive a target query statement and generate an original physical execution plan for query processing based on the target query statement, thereby obtaining multiple first physical execution plans, wherein each first physical execution plan includes multiple first physical operators, each of which is used to implement query processing. A first acquiring unit 602 is configured to acquire first runtime indicator data of each first physical operator in each first physical execution plan, wherein the first runtime indicator data is determined by matching an operator relationship between the first physical operator and a second physical operator, where the second physical operator is a physical operator of a second physical execution plan obtained by optimizing the first physical execution plan according to the adaptive query execution mode. A first determining unit 603 is configured to calculate an execution cost corresponding to each first physical execution plan based on the first runtime indicator data, and determine a target physical execution plan from the multiple first physical execution plans based on the execution cost. A first processing unit 604 is configured to execute the target physical execution plan to obtain a query result corresponding to the target query statement.In the query processing device provided in the third embodiment of the present application, a first receiving unit 601 receives a target query statement and generates an original physical execution plan for query processing based on the target query statement, thereby obtaining multiple first physical execution plans, wherein each first physical execution plan includes multiple first physical operators, each of which is used to implement query processing; a first acquisition unit 602 acquires first runtime indicator data of each first physical operator in each first physical execution plan, wherein the first runtime indicator data is determined by matching an operator relationship between the first physical operator and a second physical operator, and the second physical operator is a physical operator of a second physical execution plan obtained by optimizing the first physical execution plan according to the adaptive query execution method; a first determination unit 603 calculates an execution cost corresponding to each first physical execution plan based on the first runtime indicator data, and determines a target physical execution plan from the multiple first physical execution plans based on the execution cost; and a first processing unit 604 executes the target physical execution plan to obtain a query result corresponding to the target query statement. In this solution, physical operator relationship matching can be used to identify the operator relationship between the AQE-adjusted physical execution plan (i.e., the optimized second physical execution plan) and the original physical execution plan (i.e., the first physical execution plan). This allows for an intuitive understanding of the operator optimization results, enabling a better evaluation of the optimization effect and runtime cost of the original execution plan. By extracting runtime metric data for the physical operators of the AQE-adjusted physical execution plan and providing it to the original physical execution plan, this solves the problem of mismatching runtime metrics between the AQE-adjusted and optimized physical execution plan and the original physical execution plan. This provides a reliable cost calculation method for implementing cost optimization in Apache Spark 3, effectively identifying the operator relationship between the AQE-adjusted and original physical execution plans. This allows for cost calculation based on the runtime metrics of the optimized physical execution plan, thereby determining the technical effectiveness of the optimal physical execution plan. This further addresses the technical issue in related technologies where adaptive query execution is used to optimize the original physical execution plan, resulting in an inability to calculate costs based on the runtime metrics of the optimized physical execution plan, leading to an inability to determine the target physical execution plan.Optionally, in the query processing device provided in the third embodiment of the present application, the first acquisition unit 602 includes: a first processing subunit, configured to traverse each first physical execution plan and each second physical execution plan respectively according to the target traversal algorithm, and perform operator relationship matching on the first physical operator and the second physical operator according to the target rule during the traversal process to obtain a matching result; and a first determination subunit, configured to determine first runtime indicator data of each first physical operator based on the matching result. Optionally, in the query processing device provided in Example 3 of the present application, the first processing sub-unit includes: a first determination module, configured to traverse the second physical execution plan according to a target traversal algorithm for each second physical execution plan, so as to determine the second target physical operator from multiple second physical operators; a second determination module, configured to traverse the first physical execution plan based on the second target physical operator according to the target traversal algorithm for each first physical execution plan, so as to determine the first target physical operator from multiple first physical operators; a third determination module, configured to use the next physical operator of the first target physical operator in the first physical execution plan as the next physical operator to be matched by the second physical execution plan; and a fourth determination module, configured to traverse the first physical execution plan based on the next physical operator to be matched by the second physical execution plan according to the target traversal algorithm, so as to determine a sub-physical operator of the first target physical operator from the first physical operators other than the first target physical operator. Optionally, in the query processing device provided in Example 3 of the present application, the first processing sub-unit further includes: a first acquisition module, configured to acquire operator information of the first physical operator and operator information of the second physical operator; a first judgment module, configured to judge the operator information of the first physical operator and the operator information of the second physical operator according to the target rule to obtain a judgment result; and a fifth determination module, configured to determine that the matching result is that the first physical operator and the second physical operator successfully match if the judgment result indicates that the operator information of the first physical operator and the operator information of the second physical operator meet the target rule.Optionally, in the query processing device provided in Example 3 of the present application, the first determination subunit includes: a sixth determination module, configured to, for each first physical operator, if the matching result is that the first physical operator and the second physical operator are successfully matched, determine the operator correspondence relationship between the first physical operator and the second physical operator; a first processing module, configured to obtain second runtime indicator data of the second physical operator, and convert the second runtime indicator data according to the target mapping relationship to obtain target indicator information, wherein the target mapping relationship is used to characterize the correspondence relationship between the semantic representation information and the runtime indicator; a second processing module, configured to assign the target indicator information to the first physical operator according to the operator correspondence relationship to obtain the first runtime indicator data of each first physical operator. Optionally, in the query processing device provided in the third embodiment of the present application, the second processing module includes: a first processing submodule configured to, for each first physical operator, assign semantic representation information in the target indicator information to a key field of a first runtime indicator of the first physical operator based on an operator correspondence, and assign numerical information in the target indicator information to a value field of the first runtime indicator of the first physical operator; a second processing submodule configured to combine the key field of the first runtime indicator and the value field of the first runtime indicator into first runtime indicator data for the first physical operator. Optionally, in the query processing device provided in the third embodiment of the present application, the first determination unit 603 includes: a first calculation submodule configured to, for each first physical execution plan, sum the runtime indicator data of multiple sub-physical operators of the first target physical operator in the first physical execution plan to obtain an initial indicator data sum; a second calculation submodule configured to sum the initial indicator data sum with the runtime indicator data of the first target physical operator to obtain a target indicator data sum; and a second determination submodule configured to use the target indicator data sum as the execution cost corresponding to the first physical execution plan. Optionally, in the query processing device provided in the third embodiment of the present application, the first determination unit 603 further includes: a sorting subunit configured to sort the target indicator data corresponding to the multiple first physical execution plans to obtain a sorting result; and a third determination subunit configured to determine a target physical execution plan from the multiple first physical execution plans based on the sorting result. Optionally, in the query processing device provided in the third embodiment of the present application, the query processing device further includes: a second acquisition unit configured to acquire multiple runtime indicators before receiving the target query statement, where the multiple runtime indicators include a first runtime indicator and a second runtime indicator; and a second processing unit configured to process the multiple runtime indicators based on semantic representation information of the runtime indicators to obtain a target mapping relationship.It should be noted that the first receiving unit 601, first obtaining unit 602, first determining unit 603, and first processing unit 604 described above correspond to steps S201 to S204 in Example 1. The examples and application scenarios implemented by these units and corresponding steps are the same, but are not limited to the content disclosed in Example 1. It should be noted that the above modules, as part of the apparatus, can be run in the computer terminal 10 provided in Example 1. It should be noted that the preferred implementation schemes involved in the above embodiments of this application are the same as those provided in Example 1, as well as the application scenarios and implementation processes, but are not limited to the solutions provided in Example 1. Example 4: The embodiments of this application may provide a computer terminal, which may be any computer terminal device in a computer terminal group. Optionally, in this embodiment, the computer terminal may be replaced by a terminal device such as a mobile terminal. Optionally, in this embodiment, the computer terminal may be located in at least one of multiple network devices in a computer network. In this embodiment, the computer terminal may execute program code for the following steps in the query processing method: receiving a target query statement, and generating an original physical execution plan for query processing based on the target query statement to obtain multiple first physical execution plans, wherein each first physical execution plan includes multiple first physical operators, and each first physical operator is used to implement query processing; obtaining first runtime indicator data for each first physical operator in each first physical execution plan, wherein the first runtime indicator data is determined by matching an operator relationship between the first physical operator and a second physical operator, and the second physical operator is a physical operator of a second physical execution plan obtained by optimizing the first physical execution plan based on the adaptive query execution method; calculating an execution cost corresponding to each first physical execution plan based on the first runtime indicator data, and determining a target physical execution plan from the multiple first physical execution plans based on the execution cost; and executing the target physical execution plan to obtain a query result corresponding to the target query statement. The above-mentioned computer terminal can also execute the program code of the following steps in the query processing method: obtaining the first runtime indicator data of each first physical operator in each first physical execution plan, including: traversing each first physical execution plan and each second physical execution plan according to the target traversal algorithm, and matching the operator relationship of the first physical operator and the second physical operator according to the target rule during the traversal process to obtain a matching result; determining the first runtime indicator data of each first physical operator based on the matching result.The above-mentioned computer terminal can also execute the program code of the following steps in the query processing method: traversing each first physical execution plan and each second physical execution plan respectively according to the target traversal algorithm, including: for each second physical execution plan, traversing the second physical execution plan according to the target traversal algorithm to determine the second target physical operator from multiple second physical operators; for each first physical execution plan, traversing the first physical execution plan based on the second target physical operator according to the target traversal algorithm to determine the first target physical operator from multiple first physical operators; using the next physical operator of the first target physical operator in the first physical execution plan as the next physical operator to be matched by the second physical execution plan; traversing the first physical execution plan based on the next physical operator to be matched by the second physical execution plan according to the target traversal algorithm to determine the sub-physical operator of the first target physical operator from the first physical operators other than the first target physical operator. The above-mentioned computer terminal can also execute the program code of the following steps in the query processing method: matching the operator relationship of the first physical operator and the second physical operator according to the target rule during the traversal process to obtain a matching result, including: obtaining the operator information of the first physical operator and the operator information of the second physical operator; judging the operator information of the first physical operator and the operator information of the second physical operator according to the target rule to obtain a judgment result; if the judgment result indicates that the operator information of the first physical operator and the operator information of the second physical operator meet the target rule, then determining that the matching result is that the first physical operator and the second physical operator are successfully matched. The above-mentioned computer terminal can also execute the program code of the following steps in the query processing method: determining the first runtime indicator data of each first physical operator based on the matching result, including: for each first physical operator, if the matching result is that the first physical operator and the second physical operator are successfully matched, then determining the operator correspondence relationship between the first physical operator and the second physical operator; obtaining the second runtime indicator data of the second physical operator, and converting the second runtime indicator data based on the target mapping relationship to obtain target indicator information, wherein the target mapping relationship is used to characterize the correspondence between the semantic representation information and the runtime indicator; assigning the target indicator information to the first physical operator based on the operator correspondence relationship to obtain the first runtime indicator data of each first physical operator.The computer terminal may also execute program code for the following steps in the query processing method: assigning target indicator information to first physical operators based on operator correspondences to obtain first runtime indicator data for each first physical operator, including: for each first physical operator, assigning semantic representation information in the target indicator information to a key field of the first runtime indicator of the first physical operator based on the operator correspondences, and assigning numerical information in the target indicator information to a value field of the first runtime indicator of the first physical operator; and combining the key field of the first runtime indicator and the value field of the first runtime indicator to form the first runtime indicator data for the first physical operator. The computer terminal may also execute program code for the following steps in the query processing method: calculating the execution cost corresponding to each first physical execution plan based on the first runtime indicator data, including: for each first physical execution plan, summing the runtime indicator data of multiple sub-physical operators of the first target physical operator in the first physical execution plan to obtain initial indicator data sum; summing the initial indicator data sum with the runtime indicator data of the first target physical operator to obtain target indicator data sum; and using the target indicator data sum as the execution cost corresponding to the first physical execution plan. The computer terminal may also execute program code for the following steps in the query processing method: determining a target physical execution plan from multiple first physical execution plans based on execution costs, including: sorting target indicator data corresponding to the multiple first physical execution plans to obtain a sorting result; and determining the target physical execution plan from the multiple first physical execution plans based on the sorting result. The computer terminal may also execute program code for the following steps in the query processing method: obtaining multiple runtime indicators before receiving a target query statement, wherein the multiple runtime indicators include a first runtime indicator and a second runtime indicator; and processing the multiple runtime indicators based on semantic representation information of the runtime indicators to obtain a target mapping relationship. Optionally, FIG7 is a block diagram of a computer terminal according to an embodiment of the present application. As shown in FIG7 , the computer terminal 10 may include one or more (only one is shown in FIG7 ) processors 102 and a memory 104. The computer terminal 10 may also include a storage controller for controlling and managing the memory 104. The computer terminal 10 may also include a peripheral interface for connecting to a radio frequency module, an audio module, a display screen, and the like. The memory may be used to store software programs and modules, such as program instructions / modules corresponding to the query processing method and apparatus in the embodiments of the present application. The processor executes the software programs and modules stored in the memory to execute various functional applications and data processing, thereby implementing the query processing method described above.The memory may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory may further include memory located remotely from the processor, and such remote memory may be connected to the terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof. The processor can call the information and application stored in the memory through the transmission device to perform the following steps: receive a target query statement, and generate an original physical execution plan for query processing based on the target query statement to obtain multiple first physical execution plans, wherein each first physical execution plan includes multiple first physical operators, and each first physical operator is used to implement query processing; obtain first runtime indicator data of each first physical operator in each first physical execution plan, wherein the first runtime indicator data is determined by matching the operator relationship between the first physical operator and the second physical operator, and the second physical operator is a physical operator of the second physical execution plan obtained after optimizing the first physical execution plan according to the adaptive query execution method; calculate the execution cost corresponding to each first physical execution plan based on the first runtime indicator data, and determine a target physical execution plan from the multiple first physical execution plans based on the execution cost; execute the target physical execution plan to obtain a query result corresponding to the target query statement.Optionally, the processor may further execute program code for the following steps: obtaining first runtime indicator data of each first physical operator in each first physical execution plan, including: traversing each first physical execution plan and each second physical execution plan according to a target traversal algorithm, and matching the operator relationship between the first physical operator and the second physical operator according to a target rule during the traversal process to obtain a matching result; and determining the first runtime indicator data of each first physical operator based on the matching result. Optionally, the processor may further execute program code for the following steps: traversing each first physical execution plan and each second physical execution plan according to a target traversal algorithm, including: for each second physical execution plan, traversing the second physical execution plan according to the target traversal algorithm to determine a second target physical operator from a plurality of second physical operators; for each first physical execution plan, traversing the first physical execution plan based on the second target physical operator according to the target traversal algorithm to determine the first target physical operator from a plurality of first physical operators; The processor further includes: determining the next physical operator of the first target physical operator in the first physical execution plan as the next physical operator to be matched in the second physical execution plan; traversing the first physical execution plan based on the next physical operator to be matched in the second physical execution plan according to a target traversal algorithm to determine a sub-physical operator of the first target physical operator from among the first physical operators other than the first target physical operator. Optionally, the processor further includes executing program code for the following steps: performing operator relationship matching on the first physical operator and the second physical operator according to a target rule during the traversal process to obtain a matching result, including: obtaining operator information of the first physical operator and operator information of the second physical operator; judging the operator information of the first physical operator and the operator information of the second physical operator according to the target rule to obtain a judgment result; and determining that the matching result is that the first physical operator and the second physical operator are successfully matched if the judgment result indicates that the operator information of the first physical operator and the operator information of the second physical operator satisfy the target rule.Optionally, the processor may also execute program code of the following steps: determining first runtime indicator data of each first physical operator based on the matching result, including: for each first physical operator, if the matching result is that the first physical operator successfully matches the second physical operator, determining the operator correspondence relationship between the first physical operator and the second physical operator; obtaining second runtime indicator data of the second physical operator, and converting the second runtime indicator data based on the target mapping relationship to obtain target indicator information, wherein the target mapping relationship is used to characterize the correspondence between semantic representation information and runtime indicators; assigning the target indicator information to the first physical operator based on the operator correspondence relationship to obtain the first runtime indicator data of each first physical operator. Optionally, the processor may further execute program code for the following steps: assigning target indicator information to first physical operators based on the operator correspondence to obtain first runtime indicator data for each first physical operator, including: for each first physical operator, assigning semantic representation information in the target indicator information to a key field of the first runtime indicator of the first physical operator based on the operator correspondence, and assigning numerical information in the target indicator information to a value field of the first runtime indicator of the first physical operator; and combining the key field of the first runtime indicator and the value field of the first runtime indicator to form the first runtime indicator data for the first physical operator. Optionally, the processor may further execute program code for the following steps: calculating the execution cost corresponding to each first physical execution plan based on the first runtime indicator data, including: for each first physical execution plan, summing runtime indicator data of multiple sub-physical operators of the first target physical operator in the first physical execution plan to obtain initial indicator data sum; summing the initial indicator data sum with the runtime indicator data of the first target physical operator to obtain target indicator data sum; and using the target indicator data sum as the execution cost corresponding to the first physical execution plan. Optionally, the processor may further execute program code for the following steps: determining a target physical execution plan from multiple first physical execution plans based on the execution cost, including: sorting target indicator data corresponding to the multiple first physical execution plans to obtain a sorting result; and determining the target physical execution plan from the multiple first physical execution plans based on the sorting result. Optionally, the processor may further execute program code for the following steps: obtaining multiple runtime indicators before receiving the target query statement, wherein the multiple runtime indicators include a first runtime indicator and a second runtime indicator; and processing the multiple runtime indicators based on semantic representation information of the runtime indicators to obtain a target mapping relationship.Those skilled in the art will appreciate that the structure shown in FIG7 is merely illustrative, and the computer terminal may also be a smartphone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile internet device (MID), a PAD, or other terminal device. FIG7 does not limit the structure of the aforementioned electronic devices. For example, the computer terminal 10 may include more or fewer components (such as a network interface, a display device, etc.) than those shown in FIG7 , or have a configuration different from that shown in FIG7 . Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments can be completed by a program instructing the hardware associated with the terminal device. The program may be stored in a computer-readable storage medium, which may include a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk. Example 5 The embodiments of the present application also provide a computer-readable storage medium. Optionally, in this embodiment, the storage medium may be used to store the program code executed by the query processing method provided in Example 1 above. Optionally, in this embodiment, the storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group. The serial numbers of the embodiments of this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments. In the above embodiments of this application, the descriptions of each embodiment are given with emphasis. For portions not described in detail in a particular embodiment, reference should be made to the relevant descriptions of other embodiments. It should be understood that the disclosed technical content can be implemented in other ways in the several embodiments provided in this application. The device embodiments described above are merely illustrative. For example, the division of units is merely a logical functional division. In actual implementation, other divisions may be employed, such as combining or integrating multiple units or components into another system, or omitting or disabling certain features. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through interfaces, or indirect coupling or communication connection between units or modules, which may be electrical or otherwise. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.Furthermore, the functional units in the various embodiments of the present application may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. These integrated units may be implemented in either hardware or software functional units. If these integrated units are implemented as software functional units and sold or used as independent products, they may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the portion that contributes to the prior art, or all or part of the technical solution, may be embodied in the form of a software product. This computer software product, stored in a storage medium, includes instructions for enabling a computer device (such as a personal computer, server, or network device) to execute all or part of the steps of the methods described in the various embodiments of the present application. Such storage media include various media capable of storing program code, such as USB flash drives, read-only memories (ROMs), random access memories (RAMs), removable hard drives, magnetic disks, or optical disks. The above description is only a preferred embodiment of the present application. It should be noted that a person skilled in the art can make several improvements and modifications without departing from the principles of the present application, and such improvements and modifications should also be considered within the scope of protection of the present application. Industrial Applicability: The query processing method provided in the embodiments of the present application can identify the operator relationship between the physical execution plan adjusted by AQE (i.e., the second physical execution plan obtained after optimization) and the original physical execution plan (i.e., the first physical execution plan) through physical operator relationship matching, intuitively understanding the operator optimization results, and thus better evaluating the optimization effect and operating cost of the original execution plan. By extracting the runtime indicator data of the physical operators of the physical execution plan adjusted by AQE and providing it to the original physical execution plan, the problem of mismatching the runtime indicators of the physical execution plan adjusted and optimized by AQE and the original physical execution plan is solved. A reliable cost calculation method is provided for the implementation of cost optimization in Apache Spark 3, achieving the purpose of effectively identifying the operator relationship between the physical execution plan adjusted by AQE and the original physical execution plan, thereby realizing cost calculation based on the runtime indicators of the optimized physical execution plan, and thus determining the technical effect of the better physical execution plan.

Claims

Claims 1. A query processing method, comprising: Receive a target query statement, and generate an original physical execution plan for query processing based on the target query statement to obtain multiple first physical execution plans. Each first physical execution plan includes multiple first physical operators, and each first physical operator is used to implement the query processing; obtain the first runtime metric data of each first physical operator in each first physical execution plan, where the first runtime metric data is determined after the first physical operator matches the operator relationship with a second physical operator, and the second physical operator is a physical operator of a second physical execution plan obtained by optimizing the first physical execution plan according to the adaptive query execution method; calculate the execution cost corresponding to each first physical execution plan based on the first runtime metric data, and determine a target physical execution plan from the multiple first physical execution plans according to the execution cost; execute the target physical execution plan to obtain the query result corresponding to the target query statement.

2. The method according to claim 1, wherein Obtaining the first runtime metric data of each first physical operator in each first physical execution plan includes: traversing each first physical execution plan and each second physical execution plan respectively according to the target traversal algorithm, and matching the operator relationship between the first physical operator and the second physical operator according to the target rule during the traversal process to obtain a matching result; determining the first runtime metric data of each first physical operator according to the matching result.

3. The method according to claim 2, wherein, Traversing each first physical execution plan and each second physical execution plan respectively according to the target traversal algorithm includes: for each second physical execution plan, traversing the second physical execution plan according to the target traversal algorithm to determine a second target physical operator from multiple second physical operators; for each first physical execution plan, traversing the first physical execution plan based on the second target physical operator according to the target traversal algorithm to determine a first target physical operator from multiple first physical operators; taking the next physical operator of the first target physical operator in the first physical execution plan as the next physical operator to be matched in the second physical execution plan; traversing the first physical execution plan based on the next physical operator to be matched in the second physical execution plan according to the target traversal algorithm to determine the sub-physical operator of the first target physical operator from the first physical operators other than the first target physical operator.

4. The method according to claim 2, wherein During the traversal process, matching the operator relationship between the first physical operator and the second physical operator according to the target rule to obtain a matching result includes: 27 Obtain the operator information of the first physical operator and the operator information of the second physical operator; judge the operator information of the first physical operator and the operator information of the second physical operator according to the target rule to obtain a judgment result; if the judgment result indicates that the operator information of the first physical operator and the operator information of the second physical operator meet the target rule, then determine that the matching result is that the first physical operator and the second physical operator match successfully.

5. The method according to claim 2, wherein Determine the first runtime index data of each first physical operator according to the matching result, including: for each first physical operator, if the matching result is that the first physical operator and the second physical operator match successfully, then determine the operator correspondence between the first physical operator and the second physical operator; obtain the second runtime index data of the second physical operator, and convert the second runtime index data according to the target mapping relationship to obtain target index information, where the target mapping relationship is used to represent the correspondence between semantic representation information and runtime indexes; assign the target index information to the first physical operator according to the operator correspondence to obtain the first runtime index data of each first physical operator.

6. The method according to claim 5, wherein, Assign the target index information to the first physical operator according to the operator correspondence to obtain the first runtime index data of each first physical operator, including: for each first physical operator, assign the semantic representation information in the target index information to the key field of the first runtime index of the first physical operator, and assign the numerical information in the target index information to the value field of the first runtime index of the first physical operator; form the first runtime index data of the first physical operator by combining the key field of the first runtime index and the value field of the first runtime index.

7. The method according to claim 3, wherein, Calculate the execution cost corresponding to each first physical execution plan according to the first runtime index data, including: for each first physical execution plan, perform a summation calculation on the runtime index data of multiple sub-physical operators of the first target physical operator in the first physical execution plan to obtain the sum of initial index data; perform a summation calculation on the sum of the initial index data and the runtime index data of the first target physical operator to obtain the sum of target index data; use the sum of the target index data as the execution cost corresponding to the first physical execution plan.

8. The method according to claim 7, wherein Determine the target physical execution plan from the multiple first physical execution plans according to the execution cost, including: sort the sums of the target index data corresponding to the multiple first physical execution plans to obtain a sorting result; determine the target physical execution plan from the multiple first physical execution plans according to the sorting result.

9. The method according to claim 5, wherein, Before receiving the target query statement, the method further includes: obtaining a plurality of runtime metrics, where the plurality of runtime metrics include a first runtime metric and a second runtime metric; processing the plurality of runtime metrics according to the semantic representation information of the runtime metrics to obtain the target mapping relationship.

10. A query processing method, comprising: Obtain the target query statement uploaded by the client; In the cloud server, generate an original physical execution plan for query processing according to the target query statement, and obtain a plurality of first physical execution plans. Each first physical execution plan includes a plurality of first physical operators, and each first physical operator is used to implement the query processing; obtain the first runtime metric data of each first physical operator in each first physical execution plan, where the first runtime metric data is determined after the first physical operator performs operator relationship matching with a second physical operator, and the second physical operator is a physical operator of a second physical execution plan obtained by optimizing the first physical execution plan according to the adaptive query execution method; calculate the execution cost corresponding to each first physical execution plan according to the first runtime metric data, and determine the target physical execution plan from the plurality of first physical execution plans according to the execution cost; execute the target physical execution plan to obtain the query result corresponding to the target query statement; feedback the query result corresponding to the target query statement to the client.

11. A query processing device, comprising: A first receiving unit, configured to receive a target query statement and generate an original physical execution plan for query processing according to the target query statement, and obtain a plurality of first physical execution plans. Each first physical execution plan includes a plurality of first physical operators, and each first physical operator is used to implement the query processing; a first obtaining unit, configured to obtain the first runtime metric data of each first physical operator in each first physical execution plan, where the first runtime metric data is determined after the first physical operator performs operator relationship matching with a second physical operator, and the second physical operator is a physical operator of a second physical execution plan obtained by optimizing the first physical execution plan according to the adaptive query execution method; a first determining unit, configured to calculate the execution cost corresponding to each first physical execution plan according to the first runtime metric data, and determine The target physical execution plan; a first processing unit, configured to execute the target physical execution plan to obtain the query result corresponding to the target query statement.

12. A computer-readable storage medium, the computer-readable storage medium including a stored program, wherein, During the running of the program, control the device where the storage medium is located to execute the query processing method according to any one of claims 1 to 10.

13. An electronic device, comprising: A memory, storing an executable program; A processor for running the program, wherein, when the program runs, it executes the query processing method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Placement of adaptive aggregation operators and properties in a query plan

    CN113711197A

  • Database management system, data processing method and equipment

    CN115705322A

  • Runtime statistical feedback for query plan cost estimation

    CN117290403A

  • Runtime metric estimations for functions

    US20220207084A1

Cited By

  • Graph database query method and system based on stream-oriented computation

    CN121188061A