Task processing method and device, electronic equipment, storage medium and product

By parsing SQL statements in the database, determining the calculation subtask and assigning it to the calculation thread pool for execution, the task queue blocking problem caused by single-thread processing is solved, and the task execution efficiency is improved.

CN119807223APending Publication Date: 2025-04-11JINZHUAN INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411858641.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

In the prior art, a single thread processing multi-connection model causes SQL statement data calculation and processing to occupy threads for a long time, resulting in the inability to process other tasks in the task queue, increasing response time, and low task execution efficiency.

Method used

By analyzing the received target query statement, a calculation subtask that meets the predesigned calculation quantity condition is determined, and it is sent to the second thread in the pre-created calculation thread pool, and the calculation results are received to determine the processing results of the target task.

Benefits of technology

By executing target tasks through multi-threading, sub-tasks can be responded to timely, avoiding long-term occupation of the first thread caused by data calculations, and improving the execution efficiency of target tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119807223A_ABST
    Figure CN119807223A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a task processing method and device, electronic equipment, a storage medium and a product. The method comprises the following steps: analyzing a received target query statement; on the basis of the analysis result, in at least one sub-task contained in a target task corresponding to the target query statement, determining a calculation sub-task meeting a preset calculation amount condition; sending the calculation subtask to a second thread in a pre-created calculation thread pool, receiving a calculation result corresponding to the calculation subtask fed back by the second thread, and determining a processing result of the target task based on the calculation result; wherein the target query statement is a structured query language statement. According to the technical scheme provided by the embodiment of the invention, the target task can be executed through multiple threads, and the subtasks can be responded in time, so that the situation that the first thread is occupied for a long time due to data calculation is avoided, and the execution efficiency of the target task is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of computer technology, and in particular, to a task processing method, device, electronic device, storage medium and product. Background Art

[0002] With the advancement of science and technology and the development of the times, the amount of data that databases need to process is also growing. Various database operations are usually performed through statements composed of Structured Query Language (SQL).

[0003] In the prior art, a single-threaded multi-connection model is usually used to process received SQL statements, which may cause the data calculation processing corresponding to the SQL statement to occupy the thread for a long time, resulting in other tasks in the task queue being unable to be processed, significantly increasing the response time and low task execution efficiency. Summary of the invention

[0004] The embodiments of the present invention provide a task processing method, device, electronic device, storage medium and product to achieve the purpose of improving task execution efficiency.

[0005] According to one aspect of the present invention, a task processing method is provided, which is applied to a first thread and includes:

[0006] Parsing the received target query statement;

[0007] Based on the parsing result, determining a computing subtask that meets a preset computing amount condition from at least one subtask included in the target task corresponding to the target query statement;

[0008] Sending the computing subtask to a second thread in a pre-created computing thread pool, receiving a computing result corresponding to the computing subtask fed back by the second thread, and determining a processing result of the target task based on the computing result;

[0009] The target query statement is a structured query language statement.

[0010] According to another aspect of the present invention, there is provided a task processing device, which is arranged in a first thread, and comprises:

[0011] A statement parsing module, used to parse the received target query statement;

[0012] A task determination module, configured to determine, based on the parsing result, a computing subtask that satisfies a preset computing amount condition from at least one subtask included in the target task corresponding to the target query statement;

[0013] A result determination module is used to send the computing subtask to a second thread in a pre-created computing thread pool, receive a computing result corresponding to the computing subtask fed back by the second thread, and determine a processing result of the target task based on the computing result;

[0014] The target query statement is a structured query language statement.

[0015] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0016] at least one processor; and

[0017] a memory communicatively connected to the at least one processor; wherein,

[0018] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the task processing method described in any embodiment of the present invention.

[0019] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the task processing method described in any embodiment of the present invention when executed.

[0020] According to another aspect of the present invention, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the task processing method according to any embodiment of the present invention is implemented.

[0021] The technical solution of the embodiment of the present invention is applied to the first thread, and first parses the received target query statement; wherein the target query statement is a structured query language statement; based on the parsing result, a calculation subtask that meets the preset calculation amount condition is determined in at least one subtask contained in the target task corresponding to the target query statement; by sending the calculation subtask to the second thread in the pre-created calculation thread pool, and receiving the calculation result corresponding to the calculation subtask fed back by the second thread, the processing result of the target task is determined based on the calculation result. The technical solution of this embodiment determines the calculation subtask in each subtask, and assigns the calculation subtask to the second thread in the calculation thread pool for execution, and executes the target task through multi-threading, so as to facilitate timely response to the subtask, thereby avoiding long-term occupation of the first thread due to data calculation, which is conducive to improving the execution efficiency of the target task.

[0022] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0024] Figure 1 is a flowchart of a task processing method provided according to an embodiment of the present invention;

[0025] Figure 2 is a schematic diagram of an execution plan tree provided according to an embodiment of the present invention;

[0026] Figure 3 is a schematic diagram of a calculation process provided according to an embodiment of the present invention;

[0027] Figure 4 is a structural schematic diagram of a task processing device provided according to an embodiment of the present invention;

[0028] Figure 5 It is a structural schematic diagram of an electronic device for implementing the task processing method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0029] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "etc." and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.

[0031] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information and network security.

[0032] Figure 1 This is a flowchart of a task processing method provided according to an embodiment of the present invention. This embodiment is applicable to processing a target task corresponding to a target query statement. The method can be executed by a task processing device, which can be implemented in the form of hardware and / or software.

[0033] like Figure 1 As shown, the method of this embodiment may specifically include:

[0034] S110: Parse the received target query statement.

[0035] The target query statement is a structured query language statement.

[0036] In a specific implementation, after receiving the target query statement, the target query statement is parsed. Optionally, the parsing process may include lexical analysis, grammatical analysis and semantic analysis to determine the validity of the target query statement. Further, the various components in the target query statement can also be parsed and determined. Exemplarily, the components include at least one of a SELECT clause, a FROM clause and a WHERE clause.

[0037] S120. Based on the parsing result, determine a computing subtask that meets a preset computing amount condition from at least one subtask included in the target task corresponding to the target query statement.

[0038] The target task is the task corresponding to the target query statement, and the subtask is the task obtained after the target task is split. By executing each subtask, the processing of the target task can be completed.

[0039] For example, the target task may be "determine the employees in the sales department whose sales are greater than the preset sales, and sort them by sales". Each target task can be divided into multiple subtasks. For example, the target task "determine the employees in the sales department whose sales are greater than the preset sales, and sort them by sales" can be divided into subtasks such as "determine the employees in the sales department whose sales are greater than the preset sales" and "sort".

[0040] Optionally, based on the parsing results, a computing subtask that meets a preset computing amount condition is determined in at least one subtask included in the target task corresponding to the target query statement, including: generating an execution plan tree corresponding to the target query statement based on the parsing results; executing at least one leaf node in the execution plan tree, sending a data acquisition request to the database storage system, and receiving the data to be processed sent by the database storage system based on the data acquisition request; determining a processing node in the execution plan tree for processing the data to be processed, and determining the task computing amount of the subtask corresponding to the processing node based on the data to be processed; and determining the subtask whose task computing amount is greater than a preset computing amount threshold as a computing subtask.

[0041] Specifically, an execution plan tree may be created based on the structure of the target query statement reflected in the parsing result and the metadata in the database. For example, the metadata may include table structure and index information. In a specific implementation, the traversal may start from the leaf node of the execution plan tree. The leaf node may be a node reflecting a data source. By traversing the leaf node, a data acquisition request is sent to the database storage system. After receiving the data acquisition request, the database storage system determines the data to be processed corresponding to the data acquisition request and sends it to the first thread.

[0042] In this embodiment, after receiving the data to be processed, the leaf node, i.e., the processing node, that needs to process the sub-task through the data to be processed can be determined. For each processing node, based on the amount of data to be processed corresponding to the processing node, the task calculation amount corresponding to the sub-task of the processing node is determined. The preset calculation amount condition can be that the task calculation amount is greater than the preset calculation amount threshold. The sub-task whose task calculation amount meets the preset calculation amount condition is determined as a calculation sub-task.

[0043] This embodiment provides a method for determining computing subtasks, which is conducive to quickly determining subtasks that meet preset computing amount conditions.

[0044] In addition, based on the analysis results, a method for determining a calculation subtask that meets a preset calculation amount condition in at least one subtask included in the target task corresponding to the target query statement may also be: based on the analysis results, determining the task type of each subtask included in the target task corresponding to the target query statement; and determining a subtask whose task type is a preset calculation type as a calculation subtask.

[0045] The preset calculation type is a pre-set task type belonging to a calculation subtask.

[0046] In a specific implementation, an execution plan tree can be created based on the parsing results, and the task type of the subtask corresponding to the processing node in the execution plan tree can be determined. Exemplarily, the task type may include sorting tasks, authentication and multi-table association tasks, etc. For example, multi-table association tasks and sorting tasks are time-consuming and computationally intensive. Therefore, the sorting type and multi-table association type can be used as preset computation types. For each subtask, determine whether the task type of the subtask matches the preset computation type. If so, determine the subtask as a computational subtask; otherwise, determine the subtask as a non-computational subtask.

[0047] This embodiment provides another method for determining a computing subtask, which can more conveniently determine a computing subtask by task type.

[0048] S130: Send the computing subtask to a second thread in a pre-created computing thread pool, receive a computing result corresponding to the computing subtask fed back by the second thread, and determine a processing result of the target task based on the computing result.

[0049] The computing thread pool includes at least one second thread.

[0050] In this embodiment, each computing subtask may be sent to any second thread in the computing thread pool; or different computing subtasks may be sent to different second threads. It should be noted that the second thread corresponding to the computing subtask may be determined according to the occupied state of each thread in the computing thread pool. Exemplarily, a thread in an idle state may be used as the second thread for processing the computing subtask.

[0051] Optionally, sending the computing subtask to a second thread in a pre-created computing thread pool includes: traversing each processing node in the execution plan tree in sequence according to the traversal order of the execution plan tree; based on the computing amount of the computing subtask corresponding to the currently traversed processing node, determining a second thread corresponding to the currently traversed processing node from at least one candidate thread in the computing thread pool, sending the computing subtask to the second thread, and traversing the next processing node in the traversal order.

[0052] The thread to be selected may be a thread in an idle state.

[0053] In a specific implementation process, each processing node in the execution plan tree can be traversed in turn according to the traversal order of the execution plan tree. For the currently traversed processing node, the thread resource information of each candidate thread can be determined based on the computational amount of the computational subtask corresponding to the processing node. For example, the thread resource information includes memory resources and processor resources that can be provided by the candidate thread. The candidate thread whose thread resource information can meet the computational amount is determined as the second thread.

[0054] Furthermore, the computation subtask corresponding to the currently traversed processing node may be sent to the corresponding second thread so that the computation subtask is processed by the second thread. After the computation subtask is sent, the next processing node may be traversed, and the second thread corresponding to the next processing node may be determined, and the computation subtask of the next processing node may be sent to the corresponding second thread until all processing nodes are traversed.

[0055] In this embodiment, each processing node is traversed in a traversal order, and each computing subtask is executed in order; and the thread in the idle state is used as the second thread, which is conducive to improving the response efficiency of the computing subtask.

[0056] In a specific implementation, the calculation results fed back by each second thread may be received, and the processing result of the target task may be determined based on the calculation results. Optionally, determining the processing result of the target task based on the calculation results includes: based on the calculation results and the processing type corresponding to the parent node in the execution plan tree, performing a processing operation corresponding to the processing type on the calculation results to obtain the processing result of the target task.

[0057] The processing type may be an aggregation type, a connection type, or the like.

[0058] In this embodiment, after the traversal of each leaf node of the execution plan tree is completed, the processing result can be determined based on the calculation result and the processing type of the parent node. Exemplarily, when the processing type of the parent node is an aggregation type, the processing operation is an aggregation operation. The various calculation results obtained can be aggregated together, and the aggregated result is used as the processing result of the target task. This embodiment can quickly and accurately determine the processing result of the target task based on multiple calculation results through the processing type.

[0059] In addition, in order to save resources and avoid wasting resources, after parsing the target query statement, it also includes: determining the total amount of resources required to execute the target task based on the parsing result; and adding or deleting threads from the pre-created computing thread pool based on the total amount of resources.

[0060] Optionally, the total amount of resources required for the target task can be evaluated based on the analysis results. In addition, the available amount of resources of the candidate threads in the computing thread pool can be determined. If the available amount of resources matches the total amount of resources, there is no need to change the threads in the computing thread pool. If the available amount of resources is less than the total amount of resources, it means that the candidate threads in the current computing thread pool cannot complete the target task, and a new thread can be created in the computing thread pool to increase the number of threads and provide guarantee for the target task. If the available amount of resources is greater than the total amount of resources, it can be determined whether the difference between the available amount of resources and the total amount of resources is greater than the preset difference. If so, the threads in the computing thread pool can be deleted to avoid waste of resources.

[0061] Based on the analysis results, this embodiment can dynamically add or delete threads in the computing thread pool, thereby ensuring that the target task can be completed while minimizing resource waste.

[0062] The technical solution of the embodiment of the present invention is applied to the first thread, and first parses the received target query statement; wherein the target query statement is a structured query language statement; based on the parsing result, a calculation subtask that meets the preset calculation amount condition is determined in at least one subtask contained in the target task corresponding to the target query statement; by sending the calculation subtask to the second thread in the pre-created calculation thread pool, and receiving the calculation result corresponding to the calculation subtask fed back by the second thread, the processing result of the target task is determined based on the calculation result. The technical solution of this embodiment determines the calculation subtask in each subtask, and assigns the calculation subtask to the second thread in the calculation thread pool for execution, and executes the target task through multi-threading, so as to facilitate timely response to the subtask, thereby avoiding long-term occupation of the first thread due to data calculation, which is conducive to improving the execution efficiency of the target task.

[0063] The above describes in detail the embodiments corresponding to the task processing method. In order to make the technical solution of the present method further clear to those skilled in the art, a specific example is given below. For example, the target query statement is: select*from(select*from t1 join t2 on t1.col1=t2.col2)union all select*from(select*from t3 join t4 on t3.col3=t4.col4); the target query statement completes two internal queries, and then combines the calculation results obtained by the two internal queries through the "union all" combination operator as the processing result of the target task. The first internal query selects all columns from the t1 table and the t2 table. The connection condition is that the value of the col1 column in the t1 table is equal to the value of the col2 column in the t2 table. The calculation result is the combination of all rows in the t1 table and the t2 table that meet the connection condition. The second inner query selects all columns from the t3 and t4 tables. The join condition is that the value of the col3 column in the t3 table is equal to the value of the col4 column in the t4 table. The calculation result is the combination of all rows in the t3 and t4 tables that meet the join condition. Finally, the calculation results obtained from the two inner queries are combined through the "union all" combination operator as the processing result of the target task.

[0064] In a specific implementation, the target query statement may be parsed first, and an execution plan tree may be generated. Figure 2 is a schematic diagram of an execution plan tree provided according to an embodiment of the present invention, such as Figure 2 As shown. Through the leaf nodes, data is obtained from the t1 table, t2 table, t3 table and t4 table respectively. Join node 1 (join1) and join node 2 (join2) are processing nodes, and the union node (union all) is the parent node. When the t1 table, t2 table, t3 table and t4 table all have large amounts of data, the join node (join) takes a long time. In this case, the subtask corresponding to the join node can be sent to the second thread, and the calculation result fed back by the second thread can be obtained. When executing the union node, the calculation results of each are merged.

[0065] Figure 3 is a schematic diagram of a calculation process provided according to an embodiment of the present invention; Figure 3 As shown, the first thread first executes the control part corresponding to the target query statement, that is, the first thread assigns the calculation subtasks corresponding to the two connection nodes to the second thread respectively. Specifically, the calculation subtask 1 corresponding to the connection node 1 is assigned to the second thread 1, and the calculation subtask 2 corresponding to the connection node 2 is assigned to the second thread 2. After sending the calculation subtask 1 and the calculation subtask 2, the first thread can process other sessions. After the first thread receives the calculation result 1 fed back by the second thread 1 and the calculation result 2 fed back by the second thread 2, it continues to execute the control part, that is, to combine the calculation result 1 and the calculation result 2.

[0066] This embodiment ensures the overall serialization of the control part in the target task corresponding to the target query statement through the first thread, and realizes local parallel processing between computing subtasks and between computing subtasks and the control part; the time-consuming computing subtasks are separated to the second thread, and the first thread continues to execute the messages of the remaining sessions, which reduces the response time, improves the execution efficiency, and is conducive to solving the blocking problem.

[0067] Figure 4 1 is a schematic diagram of the structure of a task processing device provided according to an embodiment of the present invention, and the device is used to execute the task processing method provided in any of the above embodiments. The device and the task processing method of the above embodiments belong to the same inventive concept, and the details not described in detail in the embodiment of the task processing device can refer to the embodiment of the above task processing method. Figure 4 As shown, the device is arranged in the first thread, and the device comprises:

[0068] A statement parsing module 10, used to parse the received target query statement;

[0069] The task determination module 11 is used to determine, based on the parsing result, a computing subtask that meets a preset computing amount condition from at least one subtask included in the target task corresponding to the target query statement;

[0070] A result determination module 12 is used to send the computing subtask to the second thread in the pre-created computing thread pool, receive the computing result corresponding to the computing subtask fed back by the second thread, and determine the processing result of the target task based on the computing result;

[0071] The target query statement is a structured query language statement.

[0072] Based on any optional technical solution in the embodiment of the present invention, optionally, the task determination module 11 includes:

[0073] A plan tree generating unit, used to generate an execution plan tree corresponding to the target query statement based on the parsing result;

[0074] A data receiving unit, configured to execute at least one leaf node in the execution plan tree, send a data acquisition request to the database storage system, and receive data to be processed sent by the database storage system based on the data acquisition request;

[0075] A calculation amount determination unit, used to determine a processing node in the execution plan tree for processing the data to be processed, and determine the task calculation amount of the subtask corresponding to the processing node based on the data to be processed;

[0076] The first computing subtask determining unit is used to determine a subtask whose task computing amount is greater than a preset computing amount threshold as a computing subtask.

[0077] Based on any optional technical solution in the embodiment of the present invention, optionally, the task determination module 11 includes:

[0078] A task type determination unit, used to determine the task type of each subtask included in the target task corresponding to the target query statement based on the parsing result;

[0079] The second computing subtask determining unit is used to determine a subtask whose task type is a preset computing type as a computing subtask.

[0080] Based on any optional technical solution in the embodiment of the present invention, optionally, the result determination module 12 includes:

[0081] The second thread determination unit is used to traverse each processing node in the execution plan tree in sequence according to the traversal order of the execution plan tree; based on the computing amount of the computing subtask corresponding to the currently traversed processing node, determine the second thread corresponding to the currently traversed processing node in at least one candidate thread in the computing thread pool, send the computing subtask to the second thread, and traverse the next processing node in the traversal order.

[0082] Based on any optional technical solution in the embodiment of the present invention, optionally, the result determination module 12 includes:

[0083] The processing operation unit is used to perform a processing operation corresponding to the processing type on the calculation result based on the calculation result and the processing type corresponding to the parent node in the execution plan tree, so as to obtain the processing result of the target task.

[0084] Based on any optional technical solution in the embodiments of the present invention, optionally, the method further includes:

[0085] The total resource quantity determination module is used to determine the total resource quantity required to execute the target task based on the analysis results; based on the total resource quantity, add threads or delete threads from the pre-created computing thread pool.

[0086] The technical solution of the embodiment of the present invention is applied to the first thread, and first parses the received target query statement; wherein the target query statement is a structured query language statement; based on the parsing result, a calculation subtask that meets the preset calculation amount condition is determined in at least one subtask contained in the target task corresponding to the target query statement; by sending the calculation subtask to the second thread in the pre-created calculation thread pool, and receiving the calculation result corresponding to the calculation subtask fed back by the second thread, the processing result of the target task is determined based on the calculation result. The technical solution of this embodiment determines the calculation subtask in each subtask, and assigns the calculation subtask to the second thread in the calculation thread pool for execution, and executes the target task through multi-threading, so as to facilitate timely response to the subtask, thereby avoiding long-term occupation of the first thread due to data calculation, which is conducive to improving the execution efficiency of the target task.

[0087] It is worth noting that in the embodiment of the above-mentioned task processing device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0088] Figure 5 Schematic diagram of the structure of an electronic device that implements the task processing method of an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0089] like Figure 5As shown, the electronic device 20 includes at least one processor 21, and a memory connected to the at least one processor 21, such as a read-only memory (ROM) 22, a random access memory (RAM) 23, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 21 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 22 or the computer program loaded from the storage unit 28 to the random access memory (RAM) 23. In RAM23, various programs and data required for the operation of the electronic device 20 can also be stored. The processor 21, ROM22 and RAM23 are connected to each other through a bus 24. An input / output (I / O) interface 25 is also connected to the bus 24.

[0090] A number of components in the electronic device 20 are connected to the I / O interface 25, including: an input unit 26, such as a keyboard, a mouse, etc.; an output unit 27, such as various types of displays, speakers, etc.; a storage unit 28, such as a disk, an optical disk, etc.; and a communication unit 29, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 29 allows the electronic device 20 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0091] The processor 21 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 21 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 21 performs the various methods and processes described above, such as a task processing method.

[0092] In some embodiments, the task processing method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 28. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 20 via the ROM 22 and / or the communication unit 29. When the computer program is loaded into the RAM 23 and executed by the processor 21, one or more steps of the task processing method described above may be performed. Alternatively, in other embodiments, the processor 21 may be configured to perform the task processing method in any other appropriate manner (e.g., by means of firmware).

[0093] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0094] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0095] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0096] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0097] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0098] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0099] This embodiment also provides a computer program product, including a computer program, which, when executed by a processor, implements the task processing method provided in any embodiment of the present application.

[0100] In the process of implementation, the computer program product can be written in one or more programming languages ​​or a combination thereof to perform the computer program code of the present invention, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).

[0101] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0102] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A task processing method, characterized in that: Applied to the first thread, including: Parsing the received target query statement; Based on the parsing result, determining a computing subtask that meets a preset computing amount condition from at least one subtask included in the target task corresponding to the target query statement; Sending the computing subtask to a second thread in a pre-created computing thread pool, receiving a computing result corresponding to the computing subtask fed back by the second thread, and determining a processing result of the target task based on the computing result; The target query statement is a structured query language statement.

2. The method according to claim 1, characterized in that The step of determining, based on the parsing result, a computing subtask that satisfies a preset computing amount condition from at least one subtask included in the target task corresponding to the target query statement comprises: Based on the parsing result, generating an execution plan tree corresponding to the target query statement; Execute at least one leaf node in the execution plan tree, send a data acquisition request to a database storage system, and receive the to-be-processed data sent by the database storage system based on the data acquisition request; Determine a processing node in the execution plan tree for processing the data to be processed, and determine a task calculation amount of a subtask corresponding to the processing node based on the data to be processed; The subtask whose task computation amount is greater than a preset computation amount threshold is determined as a computation subtask.

3. The method according to claim 1, characterized in that The step of determining, based on the parsing result, a computing subtask that satisfies a preset computing amount condition from at least one subtask included in the target task corresponding to the target query statement comprises: Based on the parsing result, determining the task type of each subtask included in the target task corresponding to the target query statement; The subtask whose task type is a preset calculation type is determined as a calculation subtask.

4. The method according to claim 2, characterized in that: The step of sending the computing subtask to a second thread in a pre-created computing thread pool includes: Traversing each of the processing nodes in the execution plan tree in sequence according to the traversal order of the execution plan tree; Based on the computational amount of the computational subtask corresponding to the currently traversed processing node, a second thread corresponding to the currently traversed processing node is determined from at least one candidate thread in the computational thread pool, the computational subtask is sent to the second thread, and the next processing node is traversed in the traversal order.

5. The method according to claim 2, characterized in that: Determining the processing result of the target task based on the calculation result includes: Based on the calculation result and the processing type corresponding to the parent node in the execution plan tree, a processing operation corresponding to the processing type is performed on the calculation result to obtain a processing result of the target task.

6. The method according to claim 1, characterized in that Also includes: Based on the analysis result, determining the total amount of resources required to perform the target task; Based on the total amount of resources, a thread addition process or a thread deletion process is performed on a pre-created computing thread pool.

7. A task processing device, characterized in that: Set in the first thread, including: A statement parsing module, used to parse the received target query statement; A task determination module, configured to determine, based on the parsing result, a computing subtask that satisfies a preset computing amount condition from at least one subtask included in the target task corresponding to the target query statement; A result determination module is used to send the computing subtask to a second thread in a pre-created computing thread pool, receive a computing result corresponding to the computing subtask fed back by the second thread, and determine a processing result of the target task based on the computing result; The target query statement is a structured query language statement.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the task processing method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the task processing method according to any one of claims 1 to 6 when executed.

10. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the task processing method according to any one of claims 1 to 6.