Query instruction processing method and related equipment
By using dichotomy to determine boundary information in the cloud service system and using multiple processors for parallel aggregation, the problem of low efficiency of multiple rows of data aggregation process in the cloud service system is solved, and more efficient query processing is achieved.
Patent Information
- Application Number
- CN202410056542.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-10-13
- Filing Date
- 2024-01-15
- Publication Date
- 2025-04-15
AI Technical Summary
In a cloud service system, the aggregation process of multiple rows of data is serial, and multiple processor resources cannot be fully utilized, resulting in low efficiency in the query process.
The dichotomy method is used to quickly determine different boundary information, and perform aggregation operations on the row data corresponding to these boundary information through at least two processors in parallel to obtain the query results.
Through parallel processing, multiple processor resources are fully utilized, and the efficiency of the query process is improved.
Smart Images

Figure CN119829565A_ABST
Abstract
Description
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on October 13, 2023, with application number 202311330067.7 and application name “A data aggregation method, device and computing device cluster”, all contents of which are incorporated by reference in this application. Technical Field
[0002] The embodiments of the present application relate to the field of cloud technology, and more particularly to a method for processing a query instruction and related equipment. Background Art
[0003] With the rapid development of cloud technology, more and more users choose to deploy their databases in the cloud to enjoy the cloud storage services provided by the cloud service system. This can not only reduce the cost of storing data locally to a certain extent, but also provide sufficient protection for the security of users' data.
[0004] In the related art, a cloud service system usually includes multiple computing nodes. When a user needs to query certain data, a query instruction can be sent to a computing node. The query instruction indicates that multiple rows of data of a certain data need to be aggregated to obtain a query result corresponding to the query instruction. Since the amount of the aforementioned data is large, the computing node will first read part of the row data of the multiple rows of data, aggregate part of the row data of the aforementioned multiple rows of data, and obtain the first aggregated result; then continue to read part of the row data from the multiple rows of data, aggregate the aforementioned part of the row data, and obtain the second aggregated result; the computing node can repeat the aforementioned steps until all the data in the multiple rows of data are aggregated, and multiple aggregated results are obtained. The computing node merges the aforementioned multiple aggregated results to obtain the query result corresponding to the query instruction.
[0005] However, since the aggregation process of the above multiple row data is serial, when there are multiple processors on the computing node, the multiple processor resources cannot be fully utilized, and the efficiency of the entire query process is low. Summary of the invention
[0006] The embodiment of the present application provides a method for processing a query instruction and related equipment, which adopts a binary search method to quickly obtain different boundary information, and then at least two processors can perform aggregation operations on the row data corresponding to the different boundary information in parallel to obtain a query result corresponding to the query instruction, which is conducive to making full use of multiple processor resources to improve the efficiency of the entire query process.
[0007] A first aspect of an embodiment of the present application provides a method for processing a query instruction, which is applied to a first computing node in a cloud service system. The first computing node may include at least two processors. The method includes: after obtaining the query instruction, the first computing node can obtain the first data to be queried according to the obtained query instruction, the query instruction includes at least one first field, the first data includes at least two rows of data arranged in a first order, and the first order is obtained based on the value of the at least one first field in each row of data included in the first data, that is, at least one row of data containing the same value of the at least one first field is continuous in the first data.
[0008] The first computing node may use a binary search method to determine at least two boundary information, and then perform aggregation operations on the row data corresponding to the at least two boundary information in parallel through at least two processors to obtain a query result corresponding to the query instruction. Exemplarily, the at least two boundary information include boundary information 1 and boundary information 2, and the at least two processors include processor 1 and processor 2. Processor 1 may perform an aggregation operation on the row data corresponding to boundary information 1, and processor 2 may perform an aggregation operation on the row data corresponding to boundary information 2 in parallel.
[0009] Among them, at least two boundary information correspond to at least two different values of the at least one first field in the first data. Exemplarily, in one case, the number of fields included in the at least one first field is one. In another case, the number of fields included in the at least one first field is at least two, and when the field value of any one of the at least two fields included in the at least one first field changes, it represents that a new value of the first field is generated. For example, at least two first fields include tag1, tag2 and tag3; wherein, a value of the first field can be T1+01+N, T1 is a value of the tag1 field, 01 is a value of the tag2 field, and N is a value of the tag3 field; another value of the first field can be T1+01+L, T1 is a value of the tag1 field, 01 is a value of the tag2 field, and L is a value of the tag3 field, then "T1+01+N" and "T1+01+L" are two different values of the at least two first fields. It should be understood that the examples here are only for the convenience of understanding this solution.
[0010] The first boundary information is any one of at least two boundary information, the first boundary information corresponds to the first value of at least two different values, the first boundary information indicates at least one first row of data in the first data, and the value of the first field in each first row of data is the first value. Exemplarily, in one case, "the first row of data corresponding to the first boundary information" can be understood as at least one first row of data that is continuous within the first boundary information. In another case, if the query instruction also includes a first filtering condition, the first filtering condition indicates filtering "at least one first row of data that is continuous within the first boundary information" to obtain at least one first row of data after filtering, then "the first row of data corresponding to the first boundary information" can be understood as at least one first row of data after the aforementioned filtering.
[0011] In this implementation, after obtaining the query instruction, the first data to be queried can be determined. Since the at least two rows of data included in the first data are arranged in a first order, and the first order is obtained based on the value of the first field in each row of data included in the first data, the binary search method can be used to quickly obtain the boundary information corresponding to the different values, and then at least two processors can perform aggregation operations on the row data corresponding to the different boundary information in parallel to obtain the query result corresponding to the query instruction; through the aforementioned method, it is beneficial to make full use of multiple processor resources to improve the efficiency of the entire query process.
[0012] In a possible implementation, the first computing node uses a binary search method to determine at least two boundary information, including the first computing node using a binary search method to determine the first boundary information, and the first boundary information includes a first lower boundary information and a first upper boundary information. Exemplarily, the first computing node can use a binary search method to determine the second lower boundary information corresponding to the second value, and determine the first upper boundary information according to the second lower boundary information; and use a binary search method to determine the first lower boundary information corresponding to the first value. Among them, the second value and the first value are two adjacent values of the first field, and the second value is the previous value of the first value, or it can also be understood that "at least one row of data corresponding to the second value" is adjacent to "at least one row of data corresponding to the first value", and "at least one row of data corresponding to the second value" is located above "at least one row of data corresponding to the first value".
[0013] In one possible implementation, the first computing node stores first information, and the first information includes an index corresponding to each of at least two different values of the at least one first field, that is, the first information includes multiple indexes corresponding to multiple values of the at least one first field, and each index in the first information uniquely points to a value of the at least one field. Among them, the first information includes a first index corresponding to the first value, and the first boundary information is obtained by using a binary search method based on the first index; illustratively, since at least one row of data containing the same value of the first field is continuous in the first data, then at least one row of data containing the first index is also continuous in the first data, and then the binary search method can be used to determine the boundary information of at least one row of data containing the first index in the first data, that is, the first boundary information corresponding to the first value is obtained.
[0014] In this implementation, when the number of fields included in at least one first field is multiple, a value of the at least one first field may be expressed as a longer string, that is, the first value may be expressed as a longer string. Since the boundary information corresponding to each value of the first field is determined by binary search, if the first value is directly compared with the value of the first field in the row data included in the first data, each comparison is a comparison between two longer strings, resulting in a longer time consumption in each comparison process. In the process of determining the boundary information corresponding to each value of the first field by binary search, multiple comparisons are required. Therefore, “directly using the first value” is not a good choice. "Comparing with the value of the first field in the row data included in the first data" will cause the process of determining each boundary information to be time-consuming; but the index corresponding to each value of the at least one first field constructed in advance can be obtained, and then the first boundary information can be determined based on the first index corresponding to the first value by using a binary search method, that is, when comparing, the first index is compared with the index corresponding to the value of the first field in the row data, that is, each comparison is a comparison between two indexes, which greatly reduces the time consumed by each comparison process, and thus can greatly reduce the time consumed by the process of determining the first boundary information, which is conducive to improving the efficiency of the process of determining the boundary information.
[0015] In one possible implementation, the first computing node uses a binary search method to determine the first lower boundary information corresponding to the first value, including: the first computing node can determine the first index corresponding to the first value based on the aforementioned preset first information; and then the binary search method can be used to determine the first lower boundary information of the last row data in at least one row data containing the first index in the first data, that is, the first lower boundary information corresponding to the first value is obtained.
[0016] In a possible implementation, the query instruction includes identification information of the second data, and the first computing node obtains the first data to be queried according to the obtained query instruction, which may include: the first computing node determines the second data according to the identification information of the second data in the query instruction, and then obtains the first data to be queried from the second data; wherein the second data includes at least one first data, and the cardinality corresponding to the at least one first field in the second data is less than or equal to the first quantity, and the first quantity represents the number of values of the first field that can be stored in the memory of the first computing node. "The cardinality corresponding to the at least one first field in the second data" can also be referred to as "the cardinality corresponding to the at least one first field as a whole in the second data", which specifically refers to the number of different values of the "at least one first field" as a whole included in the second data.
[0017] In this implementation, at least two boundary information are determined based on the value of the first field, that is, the first data is divided into multiple first groups. Since the cardinality corresponding to the at least one first field is less than or equal to the number of values of the first field that can be stored in the memory of the first computing node, it is ensured that when the first data is divided into multiple first groups, the memory of the first computing node is sufficient.
[0018] In a possible implementation, the query instruction also includes a second field, the cardinality of the second field in the second data is greater than the second number, the second number represents the number of values of the second field that can be stored in the memory of the first computing node, and the first processor is a processor for processing the first row of data among the at least two processors. Then the first computing node performs an aggregation operation on the row data corresponding to the at least two boundary information in parallel through at least two processors to obtain a query result corresponding to the query instruction, which may include: the first computing node aggregates the first row of data included in each second group of at least two groups (hereinafter referred to as "second groups" for convenience of distinction) through the first processor to obtain at least two first aggregation results corresponding to the first boundary information.
[0019] Among them, at least one first row of data corresponding to the first boundary information includes at least two second groups, the value of the second field in the first row of data in the same second group in at least two second groups is the same, the at least two first aggregation results corresponding to the first boundary information correspond one-to-one to the at least two second groups, and the query result is obtained based on the first aggregation result corresponding to each boundary information in the at least two boundary information.
[0020] In this implementation, when the query instruction indicates to group and aggregate based on at least one target field, when the at least one target field includes both a low cardinality field (i.e., the first field) and a high cardinality field (i.e., the second field), if the first data is grouped and aggregated directly based on the at least one target field, since the at least one target field includes a high cardinality field, and the cardinality of the high cardinality field is greater than the number of values of the high cardinality field that can be stored in the memory of the first computing node, the memory of the first computing node cannot store the clustering results of all groups obtained based on the at least one target field; and the present application adopts a two-stage approach, in which at least two boundary information are determined based on the value of the first field in one stage, that is, the first data is divided into multiple first groups in one stage, and in the second stage, the multiple row data pointed to by each boundary information are grouped and aggregated again based on the value of the second field, and the entire grouping and aggregation process is divided into two-stage grouping processes, which reduces the difficulty of the data processing process compared to grouping the first data directly based on the at least one target field, and is conducive to improving the aggregation capability of the first computing node on large-scale data.
[0021] In one possible implementation, when the query instruction carries a filtering condition corresponding to the first aggregate result (hereinafter referred to as the "second filtering condition" for the convenience of distinction), the first computing node performs an aggregation operation on the row data corresponding to the at least two boundary information in parallel through at least two processors to obtain the query result corresponding to the query instruction, and also includes: after the first computing node obtains the at least two first aggregation results corresponding to the first boundary information, it can also obtain multiple first aggregation results retained on the first processor based on the at least two first aggregation results corresponding to the first boundary information, and the multiple first aggregation results retained on the first processor include the aforementioned at least two first aggregation results corresponding to the first boundary information; then the first computing node performs a filtering operation corresponding to the second filtering condition on the multiple first aggregation results retained on the first processor to obtain the filtered first aggregation result, and the filtered first aggregation result is used to obtain the query result corresponding to the query instruction. Exemplarily, the process of "the first processor performing a filtering operation corresponding to the second filtering condition" can also be understood as merging the multiple first aggregation results retained on the first processor.
[0022] In this implementation, since the multiple first aggregation results corresponding to all the boundary information need to occupy a large memory space, if the filtering operation corresponding to the second filtering condition is performed after the first aggregation results corresponding to all the boundary information are obtained, a large memory space will be required. In this scheme, the filtering operation corresponding to the second filtering condition is performed after the local first aggregation results are obtained, thereby greatly reducing the memory overhead required to perform the filtering operation corresponding to the second filtering condition and reducing the space complexity of this scheme.
[0023] In one possible implementation, the first computing node is any one of the following: a physical server, a virtual machine, a container, a micro virtual machine, or a bare metal server. In this implementation, multiple product forms of the first computing node are provided, which improves the implementation flexibility of this solution.
[0024] A second aspect of an embodiment of the present application provides a computing node, which is arranged in a cloud service system, and the computing node includes: a determination module, which is used to determine the first data to be queried according to an acquired query instruction, wherein the query instruction includes a first field, and the first data includes at least two rows of data arranged in a first order, and the first order is obtained based on the value of the first field in each row of data included in the first data; the determination module is also used to determine at least two boundary information using a binary search method, wherein the at least two boundary information correspond one-to-one to at least two different values of the first field in the first data, the first boundary information is any one of the at least two boundary information, the first boundary information corresponds to the first value of the at least two different values, the first boundary information indicates at least one first row of data in the first data, and the value of the first field in each first row of data is the first value; an aggregation module, which is used to perform aggregation operations on the row data corresponding to the at least two boundary information in parallel through at least two processors to obtain a query result corresponding to the query instruction.
[0025] In the second aspect of the embodiment of the present application, the computing node can also be used to execute the steps performed by the first computing node in the first aspect and various possible implementation methods of the first aspect. The specific implementation methods of the steps in the second aspect, the meanings of the terms and the beneficial effects brought about can all be referred to the first aspect and will not be repeated here.
[0026] A third aspect of an embodiment of the present application provides a computing device cluster, the computing device cluster includes at least one computing device, each computing device includes a processor and a memory: the memory is used to store instructions; the processor is used to enable the computing device cluster to execute the method described in the first aspect or any possible implementation method of the first aspect according to the instructions.
[0027] A fourth aspect of an embodiment of the present application provides a computer storage medium, which stores one or more instructions. When the instructions are executed by one or more computers, the one or more computers implement the method described in the first aspect or any possible implementation method of the first aspect.
[0028] A fifth aspect of the embodiments of the present application provides a computer program product, which stores instructions. When the instructions are executed by a computer, the computer implements the method described in the first aspect or any possible implementation method of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 A schematic diagram of the architecture of a cloud service system provided in an embodiment of the present application;
[0030] Figure 2 A flowchart of a method for processing a query instruction provided in an embodiment of the present application;
[0031] Figure 3 A schematic diagram of first data and second data provided in an embodiment of the present application;
[0032] Figure 4 A schematic diagram of an index corresponding to each value of the first field provided in an embodiment of the present application;
[0033] Figure 5 A schematic diagram of first data provided in an embodiment of the present application;
[0034] Figure 6 A schematic diagram of an inverted index corresponding to first data provided in an embodiment of the present application;
[0035] Figure 7 Another schematic diagram of a method for processing a query instruction provided in an embodiment of the present application;
[0036] Figure 8 Another schematic diagram of a method for processing a query instruction provided in an embodiment of the present application;
[0037] Fig. 9 A schematic diagram of a computing node provided in an embodiment of the present application;
[0038] Fig.10 A schematic diagram of a computing device provided in an embodiment of the present application;
[0039] Fig.11 A schematic diagram of the structure of a computing device cluster provided in an embodiment of the present application;
[0040] Fig.12 A schematic diagram of computer devices in a computer cluster provided in an embodiment of the present application being connected via a network. DETAILED DESCRIPTION
[0041] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0042] In the embodiments of the present application, "indication" may include direct indication and indirect indication, and may also include explicit indication and implicit indication. The information indicated by a certain information (such as the indication information described below) is called information to be indicated. In the specific implementation process, there are many ways to indicate the information to be indicated, such as but not limited to, directly indicating the information to be indicated, such as the information to be indicated itself or the index of the information to be indicated. The information to be indicated may also be indirectly indicated by indicating other information, wherein there is an association between the other information and the information to be indicated; it may also be possible to indicate only a part of the information to be indicated, while the other part of the information to be indicated is known or agreed in advance, for example, the indication of specific information can be realized by means of the arrangement order of each information agreed in advance (such as predefined by the protocol), thereby reducing the indication overhead to a certain extent. The present application does not limit the specific method of indication. It is understandable that, for the sender of the indication information, the indication information can be used to indicate the information to be indicated, and for the receiver of the indication information, the indication information can be used to determine the information to be indicated.
[0043] The method provided in the present application can be applied to various application scenarios that provide services through a cloud service system. Optionally, it can be applied to a scenario where a cloud service system aggregates multiple rows of data; illustratively, a user sends a query instruction to the cloud service system through a client, and the cloud service system aggregates (aggregation) multiple rows of data in a certain data indicated by the query instruction according to the query instruction obtained, so as to obtain a query result corresponding to the query instruction; and then the cloud service system sends the query result to the client. Exemplarily, "aggregation" can be specifically manifested as counting the number of multiple rows of data, finding the average value, finding the maximum value, finding the minimum value, finding the median value, empty operation or other operations, etc., which can be determined in combination with the actual application scenario, and is not limited in the embodiments of the present application.
[0044] In the related art, a cloud service system usually includes multiple computing nodes. When a user needs to query certain data, a query instruction can be sent to a computing node. The query instruction indicates that multiple rows of data of a certain data need to be aggregated to obtain a query result corresponding to the query instruction. Since the amount of the aforementioned data is large, the computing node will first read part of the row data of the multiple rows of data, aggregate part of the row data of the multiple rows of data, and obtain the first aggregation result; then continue to read part of the row data from the multiple rows of data, aggregate the aforementioned part of the row data, and obtain the second aggregation result; the computing node can repeat the above steps until all the data in the multiple rows of data are aggregated, and multiple aggregation results are obtained. The computing node merges the aforementioned multiple aggregation results to obtain the query result corresponding to the query instruction. However, since the aggregation process of the above multiple rows of data is serial, when there are multiple processors on the computing node, the multiple processor resources cannot be fully utilized, and the efficiency of the entire query process is low.
[0045] In order to solve the above problems, the present application provides a method for processing a query instruction. Before describing the above method in detail, Figure 1 Introduce the cloud service system in this application. Figure 1 A schematic diagram of the architecture of the cloud service system provided in the embodiment of the present application. Figure 1 As shown, the cloud service system includes an infrastructure for providing cloud services, which includes multiple computing nodes and multiple storage nodes, wherein any computing node is connected to multiple storage nodes in communication, that is, any computing node can access multiple storage nodes. The computing nodes and storage nodes are introduced below:
[0046] Computing nodes can also be called distributed database middleware (DDM) nodes. Multiple DDM nodes can be presented as a whole to the user's client as DDM. When the user's client accesses DDM, it can randomly access any DDM node among the multiple DDM nodes contained in DDM and send a query instruction to the DDM node, so that the DDM completes the corresponding data processing for the query instruction and obtains the query result corresponding to the query instruction.
[0047] A storage node may also be referred to as a database node. Multiple database nodes may be used to store user data. The data to be queried based on the query instruction is stored in the database node.
[0048] Furthermore, for any one of the multiple computing nodes or any one of the multiple storage nodes, it is essentially a cloud instance in the cloud service system, and the cloud instance can be presented in a variety of ways. For example, the cloud instance can be a physical server designated by the cloud management platform; for another example, the cloud instance can also be a virtual machine (VM) created by the cloud management platform on the physical server through virtualization technology; for another example, the cloud instance can also be a container (docker) created by the cloud management platform on the physical server through virtualization technology; for another example, the cloud instance can also be a micro virtual machine (microVM) created by the cloud management platform on the physical server through virtualization technology; for another example, the cloud instance can also be a container (docker) created by the cloud management platform on the physical server through virtualization technology; for another example, the cloud instance can also be a bare metal server designated by the cloud management platform, etc.
[0049] Furthermore, multiple computing nodes or multiple storage nodes can generally be set up in one site or multiple sites. The sites can be presented in various forms. For example, one or more sites can be multiple regions in the infrastructure. For another example, one or more sites can be multiple availability zones in the infrastructure. For another example, one or more sites can be at least one edge site and at least one central cloud site in the infrastructure, and so on.
[0050] Based on the above description, this application provides a method for processing a query instruction, which can be applied to the first computing node in the cloud service system. Figure 2 , Figure 2 A flowchart of a method for processing a query instruction provided in an embodiment of the present application. Figure 2 , the query instruction processing method provided in the embodiment of the present application may include:
[0051] 201. The first computing node obtains first data to be queried according to an obtained query instruction, wherein the query instruction includes a first field, and the first data includes at least two rows of data arranged in a first order, and the first order is obtained based on the value of the first field in each row of data included in the first data.
[0052] In an embodiment of the present application, after a user sends a query instruction to a cloud service system through a client, a first computing node in the cloud service system may obtain the query instruction, and then determine the first data to be queried based on the obtained query instruction.
[0053] Exemplarily, the first computing node is any one of the multiple computing nodes included in the above cloud service system; Exemplarily, the first computing node may include at least two processors. The first computing node may be any of the following: a physical server, a virtual machine, a container, a micro virtual machine, a bare metal server, other product forms, etc., which are not limited in the embodiments of the present application. Various product forms of the first computing node are provided here to improve the implementation flexibility of this solution.
[0054] Exemplarily, the query instruction may further include identification information of the second data, where the identification information of the second data is used to instruct the first computing node to obtain a query result corresponding to the query instruction from the second data.
[0055] For example, the query instruction can be specifically "SELECT tag,count(*)FROM t GROUP BY tag,time", where t represents the identification information of the second data, and "FROM t" in the query instruction represents obtaining the query result corresponding to the query instruction from the second data pointed to by t. The meaning of "GROUP BY tag,time" in the aforementioned query instruction is to group and aggregate the second data pointed to by t based on the tag (tag) and time (time) fields. The "count(*)" in the aforementioned query instruction indicates that the aggregation method is to count the number of row data included in each group. The "SELECT tag" in the aforementioned query instruction means that when outputting the query result corresponding to the query instruction, the value of the tag field and the aggregation result corresponding to each value of the tag field will be output. For another example, the query instruction can be specifically "SELECT tag, time, average (*) FROM F GROUP BY tag, time WHERE time>1", wherein "F" in the query instruction represents the identification information of the second data, and the query instruction represents obtaining the query result corresponding to the query instruction from the second data pointed to by F. The Chinese meaning of the aforementioned query instruction is to group the second data pointed to by F based on the tag (tag) and time (time) fields, and aggregate the row data included in the group where time>1, and the aggregation method is to calculate the average value. When outputting the query result corresponding to the query instruction, the values of the two fields tag and time, as well as the aggregation results corresponding to each value of the two fields tag and time, etc. will be output. It should be noted that the examples given here are only for the convenience of understanding the meaning of "query instruction" and "identification information of the second data carried in the query instruction", and are not used to limit this solution.
[0056] Exemplarily, step 201 may include: the first computing node determines the second data according to identification information of the second data included in the query instruction, and then obtains the first data to be queried from the second data, where the second data may include at least one first data.
[0057] Furthermore, in one case, "second data" and "first data" may have the same meaning, that is, the second data only includes one first data. Then, in step 201, after obtaining the query instruction, the first computing node may determine that the query result corresponding to the query instruction needs to be obtained from the second data pointed to by the identification information of the second data. Since the second data includes one first data, the process of obtaining the second data is equivalent to obtaining the first data to be queried from the first data included in the second data.
[0058] In another case, the second data can be divided into multiple first data, and the multiple first data are placed in different locations, or it can also be called "the multiple first data included in the second data are located in different partitions". In this case, in step 201, after obtaining the query instruction, the first computing node can determine that the query result corresponding to the query instruction needs to be obtained from the second data pointed to by the identification information of the second data; after determining that the multiple first data included in the second data are located in multiple different locations, the first computing node can obtain each first data, so as to perform aggregation operations on each first data respectively in subsequent steps, and then merge the aggregation results corresponding to each first data to obtain the query result corresponding to the entire second data, that is, the query result corresponding to the query instruction is obtained.
[0059] Exemplarily, both the "second data" and the "first data" can be expressed as data tables, and both the second data and the first data can include multiple rows of data. It should be noted that the concepts of "data table" and "row data" in this application are only logical concepts, and the physical storage method of the first data and the second data can be flexibly determined in combination with the actual application scenario, and is not limited in the embodiments of this application.
[0060] For a more intuitive understanding of this solution, please refer to Figure 3 , Figure 3 A schematic diagram of first data and second data provided in an embodiment of the present application, Figure 3 The second data and the first data are displayed in the form of a data table, such as Figure 3 As shown, the second data includes three first data, each of which includes a tag, a time, and a value field. It should be understood that Figure 3 The examples are only for facilitating the understanding of this solution and are not intended to limit this solution.
[0061] It should be noted that, in the case where the second data includes multiple first data, the multiple first data included in the second data, in addition to being expressed as first data located at multiple different positions, can also be divided into multiple first data based on other basis, for example, dividing the second data into multiple first data based on the generation time of the data, etc. The specific details can be determined in combination with the actual application scenario, and are not limited in the embodiments of the present application.
[0062] Among them, each of the at least one first data included in the second data includes at least two row data arranged in a first order, that is, each of the at least one first data included in the second data is arranged in a first order, and the first order is obtained based on the value of at least one third field in each row data included in the first data.
[0063] Exemplarily, in one case, the at least one third field may include a third field, and the first order is obtained based on the value of the aforementioned third field in each row of data included in the first data, that is, at least one row of data corresponding to the same value of the aforementioned third field is continuous in the first data. For example, if the field of the third field is represented by a number, the first order may be the order of the values of the third field from large to small (that is, the order of the numbers from large to small), or may be the order of the values of the third field from small to large (that is, the order of the numbers from small to large); in this example, at least one row of data corresponding to the same number is continuous in the first data. For another example, if the value of the third field is expressed as letters, the first order can be the order of the values of the third field from low to high (that is, the order of letters from low to high), or it can also be the order of the values of the third field from high to low (that is, the order of letters from low to high), and the "order of letters from low to high" can be expressed as the order of a, b, c, d, e, ..., w, x, y, z; in this example, at least one row of data corresponding to the same letter is continuous in the first data, etc. The specific expression form of the "first order" can be determined in combination with factors such as the specific expression form of the "value of the third field", and is not limited in the embodiments of the present application.
[0064] In another case, the at least one third field may also include at least two third fields, and the first order is obtained based on the values of the at least two third fields in each row of data included in the first data; then the at least two third fields may be divided into a primary sorting field and at least one secondary sorting field. Exemplarily, the at least two third fields may include field 1 and field 2, field 1 being the primary sorting field, and field 2 being the secondary sorting field. Then, at least one row of data in the first data may be sorted based on the value of field 1, that is, at least one row of data corresponding to the same value of field 1 is continuous in the first data. On the basis of the aforementioned sorting result, at least one row of data corresponding to each value of field 1 is sorted based on the value of field 2, that is, on the basis of ensuring that at least one row of data corresponding to the same value of field 1 is continuous in the first data, at least one row of data corresponding to each value of field 1 is sorted based on the value of field 2. In order to more intuitively understand the present solution, the first data is specifically represented as Table 1 as an example, and an example is given in combination with Table 1.
[0065] Tag Age Time Value T1 20 12-11 01 10 T1 20 12-11 04 12 T1 20 12-11 03 14 T1 25 12-11 01 15 T1 25 12-11 02 16 T1 32 12-11 05 20 T2 22 12-12 01 12 T2 23 12-12 01 12 T2 23 12-12 07 16 T3 20 12-13 01 10
[0066] Table 1
[0067] In Table 1, at least two third fields include "label" and "age", "label" is the primary sorting field, and "age" is the secondary sorting field. As shown in Table 1, multiple rows of data are first sorted based on the values in the "label" column, that is, the multiple rows of data in Table 1 are arranged in order from T1 to T3, and the 5 rows of data corresponding to T1 are continuous in Table 1, the 3 rows of data corresponding to T2 are continuous in Table 1, and the 1 row of data corresponding to T3 is continuous in Table 1. On the basis of the above sorting, at least one row of data corresponding to the same label is sorted based on the "age" column. In Table 1, the age is sorted in ascending order. As shown in Table 1, the 5 rows of data corresponding to T3 include 3 age values of 20, 25 and 32, which increase in sequence; the 2 rows of data corresponding to T2 include 2 age values of 22 and 23, which increase in sequence; the 1 row of data corresponding to T1 includes 1 age value of 20, which increases in sequence. "T1+20", "T1+25", "T1+32", "T2+22", "T2+23" and "T3+20" are the 6 values of "label" and "age" as a whole included in Table 1. At least one row of data corresponding to each of the 6 values of "label" and "age" as a whole is continuous in Table 1. It should be noted that the multiple rows of data shown in Table 1 are only examples for easy understanding of the present solution. The first data may include more or less data in actual situations, which is not limited in the embodiments of the present application.
[0068] Exemplarily, at least one row of data corresponding to each value of the primary sorting field is continuous in the first data; in the case where at least one secondary sorting field includes one secondary sorting field, the first data may include multiple different values of the primary sorting field and the secondary sorting field as a whole, and at least one row of data corresponding to the same value of the primary sorting field and the secondary sorting field as a whole is continuous in the first data. Optionally, in the case where at least one secondary sorting field can be further divided into a first sorting field, a second sorting field or more secondary sorting fields, at least one row of data corresponding to the same value of the primary sorting field and the first sorting field as a whole is continuous in the first data, and at least one row of data corresponding to the same value of the primary sorting field, the first sorting field and the second sorting field as a whole is continuous in the first data.
[0069] In the embodiment of the present application, since at least two boundary information corresponding to at least two different values of the first field need to be determined in the subsequent step 202, the first computing node needs to determine at least one first field after obtaining the query instruction.
[0070] In one case, the number of fields included in the at least one first field is one. In another case, the number of fields included in the at least one first field is at least two, and when the field value of any one of the at least two fields included in the at least one first field changes, it represents that a new value of the first field is generated.
[0071] For example, at least two first fields include tag1, tag2 and tag3; wherein, a value of the first field can be T1+01+N, T1 is a value of the tag1 field, 01 is a value of the tag2 field, and N is a value of the tag3 field; another value of the first field can be T1+01+L, T1 is a value of the tag1 field, 01 is a value of the tag2 field, and L is a value of the tag3 field, then "T1+01+N" and "T1+01+L" are two different values of the at least two first fields. It should be understood that the examples given here are only for the convenience of understanding this scheme and are not used to limit this scheme.
[0072] The first computing node may determine the at least one first field in a variety of ways. In one implementation, the first computing node stores preset first information, the first information including an index corresponding to each value of the at least one fourth field in the first data, that is, the first information includes multiple indexes corresponding one-to-one to multiple values of the at least one fourth field in the first data, and each index uniquely points to a value of the at least one fourth field.
[0073] Exemplarily, the at least one fourth field is a field in the first data, and at least one row of data containing the same value of the at least one fourth field is continuous in the first data. Then the first computing node can determine at least one first field according to the at least one fourth field and the query instruction.
[0074] Optionally, the fourth field in the second data can be a low-base field, and the cardinality of the low-base field is less than or equal to the number of values of the low-base field that can be stored in the memory of the first computing node; that is, the cardinality of at least one fourth field in the second data as a whole is less than or equal to the number of values of the fourth field that can be stored in the memory of the first computing node. "The cardinality of at least one fourth field in the second data as a whole" can also be referred to as "the cardinality corresponding to at least one fourth field as a whole in the second data", which specifically refers to the number of different values of the "at least one fourth field" as a whole included in the second data.
[0075] It should be noted that which fields the above-mentioned "at least one fourth field" specifically represents can be determined by technical personnel, and the conditions that the selected at least one fourth field needs to meet include: the cardinality of the fourth field in the second data is less than or equal to the number of values of the fourth field that can be stored in the memory of the first computing node, and at least one row of data containing the same value of the aforementioned at least one fourth field is continuous in the first data.
[0076] For a more intuitive understanding of this solution, please refer to Figure 4 , Figure 4 A schematic diagram of an index corresponding to each value of the first field provided in an embodiment of the present application. Figure 4 Including left sub-diagram and right sub-diagram, Figure 4 In both the left and right sub-schematic diagrams of FIG. , at least one fourth field includes a field called “label”. Figure 4 As shown in the left diagram of , the first data includes five fields: tag, time, value, number of rows, and index. Figure 4 The left sub-schematic diagram of shows the index corresponding to each of the three values of the first field included in the first data, Figure 4 The right sub-schematic diagram of FIG. 1 shows the index corresponding to each of the three different values of the fourth field extracted from the first data. Figure 4 As shown, the index corresponding to the value a of the "label" field is 1', the index corresponding to the value b of the "label" field is 2', and the index corresponding to the value b of the "label" field is 3'. It should be noted that Figure 4 The examples in the description are only provided to facilitate understanding of the present invention and are not intended to limit the present invention.
[0077] Exemplarily, the first computing node may determine, based on the acquired query instruction, that it is necessary to group and aggregate based on at least one field included in the query instruction (hereinafter referred to as "target field" for the convenience of description); "the query instruction includes at least one target field" may also be understood as "the query instruction includes the name of at least one target field". The first computing node may determine whether at least one target field includes all fourth fields; in the case where at least one target field includes all fourth fields, the first computing node may determine that at least one first field includes all fourth fields, then "the first information includes an index corresponding to each value of at least one fourth field in the first data" may also be understood as "the first information includes an index corresponding to each value of at least one first field in the first data".
[0078] Optionally, since "at least one fourth field" and "at least one first field" in this case include the same field, if the cardinality corresponding to the at least one fourth field in the second data is less than or equal to the number of values of the at least one fourth field that can be stored in the memory of the first computing node, then it means that the cardinality corresponding to the at least one first field in the second data is also less than or equal to the first number, and the first number represents the number of values of the at least one first field that can be stored in the memory of the first computing node.
[0079] In the case that at least one target field does not contain all fourth fields, the first computing node may use other methods to determine the first field, or the first computing node may use a method other than the processing method of the query instruction provided in the present application to generate a query result corresponding to the query instruction, or the first computing node may also determine that the query fails, etc. The specific processing method can be flexibly set in combination with the actual application scenario, and is not limited in the embodiments of the present application.
[0080] In another implementation, the first computing node may also determine at least one first field without the aid of the above-mentioned first information. Exemplarily, after determining the first data to be queried according to the query instruction, the first computing node may determine at least one third field corresponding to the first order. The first computing node determines at least one target field according to the query instruction, and may determine at least one first field according to at least one third field corresponding to the first order and the aforementioned at least one target field. Among them, the determined aforementioned at least one first field needs to be included in the aforementioned at least one third field, and at least one first field is also included in at least one target field.
[0081] In one case, the number of fields included in at least one third field is one, that is, at least one third field includes one third field. In this case, after the first computing node determines that the first data needs to be grouped and aggregated based on at least one target field according to the acquired query instruction, it can determine whether the above-mentioned third field exists in at least one target field. If the above-mentioned third field exists in at least one target field, the third field can be determined as the first field; if the above-mentioned third field does not exist in at least one target field, the execution can be terminated, and then other methods can be used to obtain the query result corresponding to the query instruction, or it can be determined that the query failed, that is, it is determined that the method provided in this application cannot be used to obtain the query result corresponding to the query instruction.
[0082] Optionally, the cardinality corresponding to the at least one first field in the second data needs to be less than or equal to the first number, and the first number represents the number of values of the first field that can be stored in the memory of the first computing node. Among them, "the cardinality corresponding to the at least one first field in the second data" can also be called "the cardinality of the at least one first field in the multiple rows of data included in the second data", and the cardinality of the first field in the second data is C, which can also be understood as the second data including C different values of the first field, that is, there are C different values of the first field in the second data, and C is an integer greater than or equal to 1.
[0083] In this case, after the first computing node determines at least one target field according to the acquired query instruction, if the first computing node determines that there is a third field in the aforementioned at least one target field, and the cardinality of the third field in the second data is less than or equal to the number of values of the third field that can be stored in the memory of the first computing node, the third field can be determined as the first field. If the first computing node determines that there is no aforementioned third field in at least one target field, or the cardinality of the third field in the second data is greater than the number of values of the third field that can be stored in the memory of the first computing node, it can be determined that the method provided in the present application cannot be used to obtain the query result corresponding to the query instruction, and then other methods can be used to obtain the query result corresponding to the query instruction, or it can also be determined that the query failed.
[0084] In another case, the number of fields included in at least one third field is at least two, that is, at least one third field includes at least two third fields. In this case, since the boundary information corresponding to each of the multiple different values of the first field needs to be generated by binary search in the subsequent steps, at least one row of data corresponding to the same value of the first field needs to be continuous in the first data. After the first computing node determines the first data according to the acquired query instruction, since the multiple rows of data in the first data are arranged in the first order, that is, they are arranged based on the values of the aforementioned at least two third fields in each row of data included in the first data, after determining the first data arranged in the first order, the first computing node can determine which field or fields in the first data correspond to the same value of at least one row of data is continuous in the first data, and the first computing node can select the first field from at least one target field, wherein the first field is included in at least one target field, and at least one row of data corresponding to the same value of the first field is continuous in the first data. If the first computing node determines that there is no first field that meets the above requirements in at least one target field, the execution can be terminated, that is, it is determined that the query result corresponding to the query instruction cannot be obtained by the method provided in the present application, and then other methods can be used to obtain the query result corresponding to the query instruction, or it can also be determined that the query failed.
[0085] Optionally, the cardinality of the first field in the second data needs to be less than or equal to a first number, and the first number represents the number of values of the first field that can be stored in the memory of the first computing node. In this case, in the process of selecting the first field from at least one target field, the first computing node not only needs to determine that at least one row of data corresponding to the same value of the first field is continuous in the first data, but also needs to determine that the cardinality of the first field in the second data needs to be less than or equal to the number of values of the first field that can be stored in the memory of the first computing node. If the first computing node determines that there is no first field that meets the above requirements in at least one target field, the execution can be terminated, that is, it is determined that the method provided in the present application cannot be used to obtain the query result corresponding to the query instruction, and then other methods can be used to obtain the query result corresponding to the query instruction, or it can be determined that the query failed.
[0086] 202. The first computing node uses a binary search method to determine at least two boundary information, wherein the at least two boundary information correspond one-to-one to at least two different values of the first field in the first data, the first boundary information is any one of the at least two boundary information, the first boundary information corresponds to the first value of the at least two different values, the first boundary information indicates at least one first row of data in the first data, and the value of the first field in each first row of data is the first value.
[0087] In the embodiment of the present application, after determining at least one first field, the first computing node may use a binary search method to determine at least two pieces of boundary information corresponding one-to-one to at least two different values of the first field.
[0088] Among them, each of the at least two boundary information may include upper boundary information and lower boundary information. Exemplarily, the "upper boundary information" may be expressed as the row number of the upper boundary, the "lower boundary information" may be expressed as the row number of the lower boundary, and the "row number" may also be referred to as the identification information of the row data (row identity, RowID). Different row data among the multiple row data included in the first data have different row numbers, and a row number may uniquely point to a row data in the first data.
[0089] For example, the first boundary information can be used to indicate that at least one first row of data corresponding to the first value is from row to row in the first row of data. The first boundary information may include row number 1 for indicating the upper boundary of at least one first row of data corresponding to the first value, and row number 2 for indicating the lower boundary of at least one first row of data corresponding to the first value. Then, the at least one first row of data corresponding to the first value includes at least one first row of data from row number 1 to row number 2 in the first data.
[0090] For a more intuitive understanding of this solution, please refer to Figure 5 , Figure 5 A schematic diagram of the first data provided in an embodiment of the present application. Figure 5 The first data shown in the figure includes four fields: tag, time, value, and row data identification information (RowID). Figure 5 In the example, multiple rows of data in the first data are sorted based on the field values of the two fields "label" and "time", and at least one of the first fields is the field "label". The first data includes three different values of the field "label" (i.e. Figure 5 a, b and c shown in ). Among them, the boundary information corresponding to the value a includes the 1st and 3rd rows, and the boundary information corresponding to the value a represents that at least one row data corresponding to a includes 3 row data from the 1st to the 3rd row; the boundary information corresponding to the value b includes the 4th and 6th rows, and the boundary information corresponding to the value b represents that at least one row data corresponding to b includes 3 row data from the 4th to the 6th row; the boundary information corresponding to the value c includes the 7th and 9th rows, and the boundary information corresponding to the value c represents that at least one row data corresponding to c includes 3 row data from the 7th to the 9th row. It should be understood that Figure 5 The examples are only for facilitating the understanding of this solution and are not intended to limit this solution.
[0091] A specific implementation method for determining any one of at least two boundary information (i.e., "first boundary information") for a first computing node. The first boundary information includes first lower boundary information and first upper boundary information. In one case, the first computing node can use binary search to determine the second lower boundary information corresponding to the second value, and determine the first upper boundary information based on the second lower boundary information; and use binary search to determine the first lower boundary information corresponding to the first value. Among them, the second value and the first value are two adjacent values of the first field, and the second value is located above the first value in the first data, that is, the second value is the previous value of the first value, or it can also be understood that "at least one row of data corresponding to the second value" is adjacent to "at least one row of data corresponding to the first value", and "at least one row of data corresponding to the second value" is located above "at least one row of data corresponding to the first value".
[0092] For example, in combination with the above Figure 5 For example, if the first value is b, the second value is a; if the first value is c, the second value is b. It should be understood that the example here is only for the convenience of understanding the relationship between the "second value" and the "first value" and is not used to limit this solution.
[0093] A specific implementation method for determining the first lower boundary information corresponding to the first value by using a binary search method for the first computing node. In one implementation method, the first computing node may store preset first information, and the first information may include an index corresponding to each value of all values of the at least one first field in the first data, and different values of the at least one first field correspond to different indexes. Exemplarily, an "index" field may be added to the first data, and the "index" field is used to store the index corresponding to the value of the at least one first field. Among them, the first information includes a first index corresponding to the first value of the at least one first field, and the first lower boundary information included in the first boundary information can be obtained by using a binary search method based on the first index.
[0094] Exemplarily, the first computing node can determine the first index corresponding to the first value based on the aforementioned preset first information; since at least one row of data containing the same value of the first field is continuous in the first data, at least one row of data containing the first index is also continuous in the first data, and then the first lower boundary information corresponding to the first index can be determined from the first data by binary search, that is, the first lower boundary information of the last row of data in at least one row of data containing the first index in the first data is determined by binary search, that is, the first lower boundary information corresponding to the first value is obtained. Exemplarily, "the first lower boundary information corresponding to the first index" represents the number of rows of the last row of data in at least one row of data containing the first index in the first data.
[0095] Exemplarily, when the implementation is used to determine the boundary information corresponding to each value of the first field, the overall time complexity can be Clog(N), where C represents the cardinality of the first field in the first data, N represents that the first data includes N rows of data, and N is an integer greater than or equal to 1. If a traversal method is used to group multiple rows of data in the first data, the overall time complexity is N, and the time complexity changes from N to Clog(N), which greatly shortens the time consumed by the grouping process.
[0096] In the embodiment of the present application, when the number of fields included in at least one first field is multiple, a value of the at least one first field may be expressed as a longer string, that is, the first value may be expressed as a longer string. Since the binary search method is used to determine the boundary information corresponding to each value of the first field, if the first value is directly used to compare with the value of the first field in the row data included in the first data, each comparison is a comparison between two longer strings, resulting in a longer time consumption in the process of each comparison. In the process of using the binary search method to determine the boundary information corresponding to each value of the first field, multiple comparisons are required. Therefore, “directly using the first value” is not enough. The process of determining each boundary information is time-consuming because of the method of comparing the value with the value of the first field in the row data included in the first data. However, the index corresponding to each value of the at least one first field constructed in advance can be obtained. Then, based on the first index corresponding to the first value, the first boundary information can be determined by using the binary search method. That is, the first index is compared with the index corresponding to the value of the first field in the row data during comparison. That is, each comparison is a comparison between two indexes, which greatly reduces the time consumed by each comparison process. In addition, the time consumed by the process of determining the first boundary information can be greatly reduced, which is conducive to improving the efficiency of the process of determining the boundary information.
[0097] In another implementation, the first computing node may directly use a binary search method to determine the first lower boundary information of the last row of data in at least one row of data containing the first value, that is, obtain the first lower boundary information corresponding to the first value. For example, "the first lower boundary information corresponding to the first value" represents the row number of the last row of data in at least one row of data containing the first value in the first data.
[0098] For the specific implementation method of the first computing node determining the first upper boundary information according to the second lower boundary information, for example, the first upper boundary information can be the first row number of the first row data in at least one row data containing the first value in the first data, and the second lower boundary information can be the second row number of the last row data in at least one row data containing the second value in the first data; since the second value and the first value are two adjacent values of the first field, and the second value is located above the first value in the second data, the next row of the last row data containing the second value in the first data can be the first row data containing the first value, and the first row number can be the second row number plus one. In order to understand this solution more intuitively, combined with the above Figure 5 For example, if the second value is a and the first value is b, after using the binary search method to determine that the second lower boundary information corresponding to the value of a is the third row, then the first upper boundary information corresponding to the value of b is the fourth row. It should be understood that the example here is only for the convenience of understanding this solution and is not used to limit this solution.
[0099] Optionally, the first computing node can determine at least two boundary information corresponding to at least two different values of the first field in sequence according to a second order, and the second order is consistent with the arrangement order of the at least two different values of the first field in the first data, that is, the second order is from top to bottom; then, after the first computing node determines the first lower boundary information of the first value of the first field, it determines the second upper boundary information of the third value of the first field; wherein the first value and the third value are two adjacent values of the first field, and the third value is located below the first value in the first data, that is, the third value is the next value of the first value.
[0100] In another case, the first computing node uses binary search to determine the first upper boundary information corresponding to the first value, and uses binary search to determine the first lower boundary information corresponding to the first value. Among them, the specific implementation method of "the first computing node uses binary search to determine the first lower boundary information corresponding to the first value" can be found in the above description, which will not be repeated here. The specific implementation method of "the first computing node uses binary search to determine the first upper boundary information corresponding to the first value" is similar to the specific implementation method of "the first computing node uses binary search to determine the first lower boundary information corresponding to the first value", the difference is that the "first lower boundary information" is replaced by the "first upper boundary information", and the "last row data" is replaced by the "first row data", which will not be repeated here.
[0101] In another case, the first computing node can use binary search to determine the second upper boundary information corresponding to the third value, and determine the first lower boundary information corresponding to the first value based on the second upper boundary information corresponding to the third value; the first computing node uses binary search to determine the first upper boundary information corresponding to the first value.
[0102] Exemplarily, the second upper boundary information can be the third row number of the first row data in at least one row data containing the third value in the first data, and the first lower boundary information can be the fourth row number of the last row data in at least one row data containing the first value in the first data. Since the third value is the next value of the first value, the next row of "the last row data containing the first value in the first data" is "the first row data containing the third value in the first data", and the fourth row number can be the third row number minus one.
[0103] Optionally, the first computing node can determine at least two boundary information corresponding to at least two different values of the first field in sequence according to a third order, and the third order is opposite to the arrangement order of the at least two different values of the first field in the first data, that is, the third order is from bottom to top; then, after the first computing node determines the second upper boundary information of the third value of the first field, it determines the first lower boundary information of the first value of the first field.
[0104] The first computing node may repeatedly execute the above steps to determine at least two pieces of boundary information corresponding one-to-one to at least two different values of the at least one first field.
[0105] Optionally, after the first computing node determines the first data to be queried according to the acquired query instruction, it can perform the step of "determining at least two boundary information" by performing at least two first aggregation operations, that is, the first computing node can complete the process of "determining one boundary information in at least two boundary information" each time the first aggregation operation is performed.
[0106] Exemplarily, the first aggregation operation may include grouping and aggregation. The grouping in the first aggregation operation is used to determine boundary information, and the aggregation in the first aggregation operation may specifically adopt a null operation.
[0107] Optionally, the boundary information corresponding to each value of the at least one first field obtained in step 201 can also be used to construct an inverted index corresponding to the first data, and the inverted index corresponding to the first data is used to indicate the position of the row data containing any value of the at least one first field in the first data. After determining the first value of the at least one first field, it can be determined from the inverted index which row data in the first data contains the first value.
[0108] Wherein, the inverted index may include each value in the first value set of the at least one first field, and the number of rows corresponding to each value of the at least one first field. Exemplarily, the number of rows corresponding to the first value in the inverted index may include all the number of rows in the first data that include the first value. Alternatively, since multiple rows of data containing the same value of the at least one first field in the first data are continuous, the number of rows corresponding to the first value in the inverted index may also adopt the first boundary information, that is, include the number of the first row and the number of the last row of all the rows in the first data that include the first value, thereby reducing the storage space consumed by storing the inverted index, that is, reducing the space cost of storing the inverted index.
[0109] Optionally, “the arrangement order of the multiple values of the at least one first field included in the inverted index” is consistent with the arrangement order of the multiple values of the at least one first field in the first data.
[0110] For a more intuitive understanding of this solution, please refer to Figure 6 , Figure 6 A schematic diagram of an inverted index corresponding to first data provided in an embodiment of the present application. Figure 6 Including left sub-diagram and right sub-diagram, Figure 6 The left sub-schematic diagram of FIG. 1 shows an example of the first data. Figure 6 The left diagram of Figure 4 The introduction of the left sub-diagram of will not be repeated here; Figure 6 The right sub-diagram of represents the inverted index corresponding to the first data, such as Figure 6 As shown, the number of rows corresponding to the value a in the inverted index is 1 and 3, indicating that the row data containing a in the first data are the 1st to 3rd rows in the first data; the number of rows corresponding to the value b in the inverted index is 4 and 6, indicating that the row data containing a in the first data are the 4th to 6th rows in the first data; the number of rows corresponding to the value c in the inverted index is 7 and 9, indicating that the row data containing c in the first data are the 7th to 9th rows in the first data. It should be understood that Figure 6 The examples are only for facilitating the understanding of this solution and are not intended to limit this solution.
[0111] 203. The first computing node performs an aggregation operation on the row data corresponding to the at least two boundary information in parallel through at least two processors to obtain a query result corresponding to the query instruction.
[0112] In an embodiment of the present application, after the first computing node determines at least two boundary information corresponding one-to-one to at least two different values of the first field, the first computing node can distribute the aforementioned at least two boundary information to at least two processors included in the first computing node, thereby performing an aggregation operation (hereinafter referred to as "second aggregation operation" for the convenience of distinction) on the row data corresponding to the at least two boundary information in parallel by at least two processors to obtain a query result corresponding to the query instruction; the second aggregation operation also includes two steps of "grouping" and "aggregation".
[0113] It should be understood that step 202 can be understood as dividing the first data into multiple groups (referred to as "first groups" here for the convenience of description) according to the value of the first field, and each first group includes row data pointed to by a first boundary information, that is, the entire first data is divided into multiple groups through multiple boundary information.
[0114] Exemplarily, in one case, “at least one first row of data corresponding to any one of the at least two boundary information (ie, the first boundary information)” may be understood as at least one first row of data located continuously within the first boundary information.
[0115] In another case, if the query instruction also includes a first filtering condition, the first filtering condition indicates filtering "at least one first row of data located continuously within the first boundary information" to obtain at least one first row of data after filtering, then "at least one first row of data corresponding to the first boundary information" can be understood as the at least one first row of data after the aforementioned filtering.
[0116] In order to understand this solution more conveniently, Figure 5 Take the first data shown in as an example, for example, the query instruction is specifically expressed as "SELECT tag, time, average (*) FROM F GROUP BY tag, time WHERE time>1", and "WHERE time>1" in the query instruction is a first filtering condition. The first field is the field "tag", and the boundary information corresponding to the value a includes the first row and the third row, that is, the continuous row data located in the boundary information corresponding to the value a includes 3 rows of data from the first row to the third row. Since the query instruction carries the filtering condition "WHERE time>1", it is necessary to filter the continuous row data located in the boundary information corresponding to the value a, and the filtered row data needs to meet the requirement of "time>1". The filtered row data includes the second row and the third row, and the at least one row data corresponding to the boundary information corresponding to the value a includes 2 rows of data from the second row and the third row. It should be understood that the example here is only for the convenience of understanding this solution, and is not used to limit this solution.
[0117] It should be noted that, in one implementation, steps 202 and 203 may be performed alternately, or, while executing step 202, step 203 may also be performed. Exemplarily, after the first computing node determines at least two boundary information 1 corresponding to at least two values of the first field through processor 1, at least two processors may perform the second aggregation operation on the row data corresponding to the at least two boundary information 1 in parallel; when the at least two processors perform the second aggregation operation on the row data corresponding to the at least two boundary information 1 in parallel, processor 1 determines at least two boundary information 2, and at least two processors perform the second aggregation operation on the row data corresponding to the at least two boundary information 1 in parallel, and so on, alternately; until the boundary information corresponding to each value of the first field is determined, and the second aggregation operation is performed based on the boundary information corresponding to each value of the first field. In another implementation, the boundary information corresponding to each value of the first field may be determined in step 202, and then the second aggregation operation may be performed based on the boundary information corresponding to each value of the first field through step 203.
[0118] The process of performing a second aggregation operation on the row data corresponding to any boundary information (i.e., the first boundary information) for a processor in the first computing node. Exemplarily, the query instruction also includes a second field, that is, the at least one target field also includes a second field, and the query instruction indicates that the first data is grouped and aggregated based on the first field and the second field, if the first processor is a processor for processing the first row data pointed to by the first boundary information among the at least two processors included in the first computing node.
[0119] Step 203 may include: the first computing node groups at least one first row of data corresponding to the first boundary information according to the value of the second field through the first processor, wherein the at least one first row of data corresponding to the first boundary information includes at least two groups (hereinafter referred to as "second groups" for convenience of distinction), and the value of the second field in the first row of data in the same second group in at least two second groups is the same. The first processor in the first computing node aggregates the first row of data included in each of the at least two second groups to obtain at least two first aggregation results corresponding to the first boundary information, and the at least two first aggregation results corresponding to the first boundary information correspond to the at least two second groups one-to-one, that is, the first processor performs the second aggregation operation on the row of data corresponding to the first boundary information, and can obtain at least two first aggregation results, then performs the second aggregation operation on the row of data corresponding to each boundary information, and can obtain at least two first aggregation results. The query result corresponding to the query instruction is obtained based on the first aggregation result corresponding to each of the at least two boundary information, that is, the query result is obtained based on all boundary information.
[0120] Optionally, if the first order is obtained based on the value of the first field and the value of the second field in each row of data included in the first data, that is, based on the first order, it can be determined that at least one row of data with the same value as a whole consisting of at least one first field and at least one second field is continuous in the first data, then the first computing node groups the at least one first row of data corresponding to the first boundary information according to the value of the second field, which may include: the first computing node uses a binary search method to group the at least one first row of data corresponding to the first boundary information according to the value of the second field.
[0121] Exemplarily, when the row data corresponding to each boundary information is grouped by the present implementation, the overall time complexity may be Glog(N), where G represents the cardinality of the second field in the first data, G is an integer greater than or equal to 1, and N represents that the first data includes a total of N rows of data, N is an integer greater than or equal to 1. If the row data corresponding to each boundary information is grouped by traversing the first data, the overall time complexity is N, and the time complexity changes from N to Glog(N), thereby shortening the time consumed by the grouping process.
[0122] For a more intuitive understanding of this solution, please refer to Figure 7 , Figure 7 Another schematic diagram of a method for processing a query instruction provided in an embodiment of the present application, Figure 7Taking the case where the first field is a tag field and the second field is a time field as an example, in the first stage, the first data is grouped based on the value of the first field (that is, the value of the tag field) by performing a first aggregation operation. The aggregation in the first stage can specifically use a null operation; each execution of the first aggregation operation can determine the boundary information corresponding to a value of the first field, that is, determine at least one row of data corresponding to a value of the first field.
[0123] In the second stage, by performing a second aggregation operation, at least one row of data corresponding to a value of the first field is grouped and aggregated based on the field value of the second field (that is, the value of the time field), to obtain at least one first aggregation result corresponding to a boundary information. The at least one first aggregation result corresponding to each boundary information is used to obtain the query result corresponding to the query instruction. It should be understood that Figure 7 The examples are only for facilitating the understanding of this solution and are not intended to limit this solution.
[0124] In an embodiment of the present application, after obtaining a query instruction, the first data to be queried can be determined. Since the at least two rows of data included in the first data are arranged in a first order, and the first order is obtained based on the value of the first field in each row of data included in the first data, the binary search method can be used to quickly obtain boundary information corresponding to different values, and then at least two processors can perform aggregation operations on the row data corresponding to different boundary information in parallel to obtain a query result corresponding to the query instruction; through the aforementioned method, it is beneficial to make full use of multiple processor resources to improve the efficiency of the entire query process.
[0125] Optionally, when the query instruction carries a filtering condition corresponding to the first aggregation result (hereinafter referred to as the "second filtering condition" for the convenience of distinction), in one implementation, after the first processor in the first computing node completes the second aggregation operation based on each boundary information (including the first boundary information) to obtain at least two first aggregation results, it can also perform a filtering operation corresponding to the second filtering condition on all first aggregation results retained on the first processor based on the at least two first aggregation results just generated to obtain the filtered first aggregation result, and the filtered first aggregation result is used to obtain the query result corresponding to the query instruction.
[0126] To understand the "second filtering condition" more intuitively, for example, the query instruction is specifically expressed as "SELECT tag, time, average (*) as c FROM t GROUP BY tag, time ORDER BY c LIMIT 100". The "ORDER BY c LIMIT 100" in the query instruction is a second filtering condition. The query instruction means that the first data pointed to by t is divided into multiple second groups based on the tag and time fields, and each of the multiple second groups is aggregated to obtain multiple aggregation results, which are arranged in descending order, and only the top 100 largest aggregation results are retained. That is, the second filtering condition indicates that only the top 100 largest aggregation results are retained. It should be understood that the example here is only for the convenience of understanding this solution and is not used to limit this solution.
[0127] Exemplarily, the process of "the first processor executing the filtering operation corresponding to the second filtering condition" can also be understood as merging the multiple first aggregation results retained on the first processor, that is, the streaming merging method adopted in this implementation is.
[0128] Optionally, if the second filtering condition indicates that multiple first aggregation results are sorted and then truncated, then after the first processor obtains at least two first aggregation results based on the first boundary information, it is necessary to sort all the first aggregation results retained on the first processor, delete at least one aggregation result from all the aforementioned first aggregation results, and obtain the filtered first aggregation result. Optionally, the aforementioned sorting operation can adopt merge sorting or other sorting methods, etc., which is not limited in the embodiments of the present application.
[0129] It should be noted that each processor in the first computing node can execute the operations performed by the above-mentioned first processor, that is, each processor in the first computing node can execute the filtering operation corresponding to the second filtering condition after obtaining part of the first aggregate results (also known as "merging local first aggregate results"), and the final filtered first aggregate results retained in each processor are used to obtain the query results corresponding to the query instruction.
[0130] For example, the query instruction is specifically expressed as "SELECT tag, time, average (*) as c FROM t GROUPBY tag, time ORDER BY c LIMIT 100". The processors in the first computing node for performing the second aggregation operation on the row data corresponding to each boundary information include processor 1, processor 2 and processor 3. Processor 1, processor 2 and processor 3 can all adopt a streaming merge method. Processor 1 can eventually retain 100 filtered first aggregation results, processor 2 can eventually retain 100 filtered first aggregation results, and processor 3 can eventually retain 100 filtered first aggregation results. Then, the filtering operation corresponding to the second filtering condition is performed on the aforementioned 300 filtered first aggregation results, so that the query result corresponding to the query instruction can be obtained.
[0131] In an embodiment of the present application, since the multiple first aggregation results corresponding to all boundary information need to occupy a large memory space, if the filtering operation corresponding to the second filtering condition is performed after the first aggregation results corresponding to all boundary information are obtained, a large memory space will be required. In the present scheme, the filtering operation corresponding to the second filtering condition is performed after the local first aggregation results are obtained, thereby greatly reducing the memory overhead required to perform the filtering operation corresponding to the second filtering condition and reducing the space complexity of the present scheme.
[0132] In another implementation, the first computing node may also perform a filtering operation corresponding to the second filtering condition after performing the second aggregation operation based on the boundary information corresponding to each value of the first field, that is, after obtaining multiple aggregation results corresponding to all the boundary information, to obtain the query result corresponding to the query instruction; that is, after obtaining all the first aggregation results, perform a filtering operation corresponding to the second filtering condition.
[0133] For a more intuitive understanding of this solution, please refer to Figure 8 , Figure 8 Another schematic diagram of a method for processing a query instruction provided in an embodiment of the present application, Figure 8 It includes two sub-schematic diagrams, left and right. Figure 8 An example of the first data is shown in the left sub-schematic diagram of Figure 8 As shown in the left sub-diagram of , the first data includes a tag, time, and value field. Multiple rows of data in the first data are sorted based on the tag and time fields. Here, the first field is the tag field and the second field is the time field. Figure 8As shown in the right sub-diagram of , in the first stage, two boundary information corresponding to two different values of the first field (ie, the tag field) are determined, namely Figure 8 The 0th to 3rd rows (that is, boundary information 1) correspond to a value t1 of the tag field, and the 4th to 7th rows (that is, boundary information 2) correspond to another value t2 of the tag field; then the multiple rows of data corresponding to a value t1 of the tag field include 4 rows of data from the 0th to 3rd rows, and the multiple rows of data corresponding to a value t2 of the tag field include 4 rows of data from the 4th to 7th rows.
[0134] In the second stage, based on the field value of the time field, the four rows of data from row 0 to row 3 are grouped and aggregated to obtain the first aggregation result 1, that is, Figure 8 t1, 05-10 and 4 shown in FIG; based on the field value of the time field, the 4 rows of data from the 4th to the 7th rows are grouped and aggregated to obtain the first aggregation result 2, that is, Figure 8 t2, 05-11 and 4 shown in.
[0135] In the merging stage, the first aggregation result 1 and the second aggregation result 2 are merged together to obtain the query result corresponding to the query instruction. It should be noted that Figure 8 The examples are only for facilitating the understanding of this solution and are not intended to limit this solution.
[0136] Optionally, the cardinality of the second field in the second data is greater than the second quantity, and the second quantity represents the number of values of the second field that can be stored in the memory of the first computing node; the "second field" can also be understood as a "high-cardinality field", and the cardinality of the high-cardinality field is greater than the number of values of the high-cardinality field that can be stored in the memory of the first computing node.
[0137] In an embodiment of the present application, when a query instruction indicates grouping and aggregation based on at least one target field, when at least one target field includes both a low-cardinality field (i.e., a first field) and a high-cardinality field (i.e., a second field), if the first data is grouped and aggregated directly based on the at least one target field, since the at least one target field includes a high-cardinality field, and the cardinality of the high-cardinality field is greater than the number of values of the high-cardinality field that can be stored in the memory of the first computing node, the memory of the first computing node cannot store the clustering results of all groupings obtained based on the at least one target field; and a two-stage approach is adopted in the present application, in which at least two boundary information are determined based on the value of the first field in one stage, that is, the first data is divided into multiple first groups in one stage, and since the first field is a low-cardinality field, it is ensured that the memory of the first computing node is sufficient when grouping is performed in one stage.
[0138] In the second stage, the multiple rows of data pointed to by each boundary information are grouped again and aggregated based on the value of the second field, and the entire grouping and aggregation process is divided into a two-stage grouping process. Compared with directly grouping the first data based on the at least one target field, the difficulty of the data processing process is reduced, which is conducive to improving the aggregation capability of the first computing node on large-scale data.
[0139] The above is a detailed description of the method for processing the query instruction provided in the embodiment of the present application. The following will introduce the first computing node provided in the embodiment of the present application. Fig. 9 A structural diagram of a first computing node provided in an embodiment of the present application, such as Fig. 9 As shown, the first computing node 900 is set in a cloud service system, and the cloud service system includes multiple computing nodes and multiple storage nodes. The first computing node is one of the aforementioned multiple computing nodes. The first computing node 900 includes: an acquisition module 901, which is used to acquire the first data to be queried according to the acquired query instruction, wherein the query instruction includes a first field, and the first data includes at least two rows of data arranged in a first order, and the first order is obtained based on the value of the first field in each row of data included in the first data; a determination module 902, which is also used to determine at least two boundary information using a binary search method, wherein the at least two boundary information correspond to at least two different values of the first field in the first data, the first boundary information is any one of the at least two boundary information, the first boundary information corresponds to the first value of the at least two different values, the first boundary information indicates at least one first row of data in the first data, and the value of the first field in each first row of data is the first value; an aggregation module 903, which is used to perform an aggregation operation on the row data corresponding to the at least two boundary information in parallel through at least two processors to obtain a query result corresponding to the query instruction.
[0140] Optionally, the first computing node 900 contains first information, the first information including an index corresponding to each of at least two different values of the first field, wherein the first information includes a first index corresponding to the first value, and the first boundary information is obtained by using a binary search method based on the first index.
[0141] Optionally, the query instruction includes identification information of the second data, and the acquisition module 901 is specifically used to: determine the second data according to the identification information of the second data in the query instruction; obtain the first data to be queried from the second data, the second data includes at least one first data, and the cardinality corresponding to the first field in the second data is less than or equal to the first quantity, and the first quantity represents the number of values of the first field that can be stored in the memory of the first computing node.
[0142] Optionally, the query instruction also includes a second field, the cardinality of the second field in the second data is greater than the second quantity, the second quantity represents the number of values of the second field that can be stored in the memory of the first computing node, and the first processor is a processor for processing the first row of data among the at least two processors; the aggregation module 903 is specifically used to aggregate the first row of data included in each of the at least two groups through the first processor to obtain at least two first aggregation results corresponding to the first boundary information, wherein at least one first row of data corresponding to the first boundary information includes at least two groups, and the value of the second field in the first row of data in the same group of at least two groups is the same, and the at least two first aggregation results corresponding to the first boundary information correspond one-to-one to the at least two groups, and the query result is obtained based on the first aggregation result corresponding to each boundary information in the at least two boundary information.
[0143] Optionally, in the case where the query instruction carries a filtering condition corresponding to the first aggregation result, the aggregation module 903 is further used to perform a filtering operation corresponding to the filtering condition based on at least two first aggregation results corresponding to the first boundary information to obtain a filtered first aggregation result, and the filtered first aggregation result is used to obtain the query result.
[0144] Optionally, the first computing node is any one of the following: a physical server, a virtual machine, a container, a micro virtual machine, or a bare metal server.
[0145] It should be noted that the information interaction, implementation process, etc. between the modules / units of the above-mentioned device are based on the same concept as the method embodiment of the present application, and the technical effects they bring are the same as those of the method embodiment of the present application. For specific contents, please refer to the description in the method embodiment shown above in the embodiment of the present application, and will not be repeated here.
[0146] See also Fig.10 , Fig.10 A schematic diagram of a computing device provided in an embodiment of the present application. Fig.10 As shown, the computing device 1000 (which can be used to present the aforementioned computing node) includes: a processor 1001, a memory 1002, a communication interface 1003 and a bus 1004. The processor 1001, the memory 1002 and the communication interface 1003 are coupled via a bus (not marked in the figure). The memory 1002 stores instructions. When the execution instructions in the memory 1002 are executed, the computing device 1000 executes the method executed by the first computing node in the above method embodiment.
[0147] The computing device 1000 may be one or more integrated circuits configured to implement the above method, such as one or more application specific integrated circuits (ASIC), or one or more digital signal processors (DSP), or one or more field programmable gate arrays (FPGA), or a combination of at least two of these integrated circuit forms. For another example, when a unit in the device can be implemented in the form of a processing element scheduler, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call a program. For another example, these units may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0148] The processor 1001 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. A general-purpose processor may be a microprocessor or any conventional processor.
[0149] The memory 1002 may be a volatile memory or a nonvolatile memory, or may include both volatile and nonvolatile memories. Among them, the nonvolatile memory may be a read-only memory (ROM), a programmable ROM (PROM), an erasable programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).
[0150] The memory 1002 stores executable program codes, and the processor 1001 executes the executable program codes to respectively implement the functions of the aforementioned receiving module, processing module, and sending module, thereby implementing the aforementioned query instruction processing method. That is, the memory 1002 stores instructions for executing the aforementioned query instruction processing method.
[0151] The communication interface 1003 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 1000 and other devices or a communication network.
[0152] In addition to the data bus, the bus 1004 may also include a power bus, a control bus, a status signal bus, etc. The bus may be a peripheral component interconnect express (PCIe) bus, or an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a compute express link (CXL), a cache coherent interconnect for accelerators (CCIX), etc. The bus may be divided into an address bus, a data bus, a control bus, etc.
[0153] See also Fig.11 , Fig.11 A schematic diagram of the structure of a computing device cluster provided in an embodiment of the present application. Fig.11 As shown, the computing device cluster 1100 includes at least one computing device 1000 .
[0154] like Fig.11 As shown, the computing device cluster 1100 includes at least one computing device 1000. The memory 1002 in one or more computing devices 1000 in the computing device cluster 1100 may store the same instructions for executing the above query instruction processing method.
[0155] In some possible implementations, the memory 1002 of one or more computing devices 1000 in the computing device cluster 1100 may also store partial instructions of the processing method for executing the above query instruction. In other words, the combination of one or more computing devices 1000 may jointly execute the processing method for executing the above query instruction.
[0156] It should be noted that the memory 1002 in different computing devices 1000 in the computing device cluster 1100 may store different instructions, which are respectively used to execute part of the functions of the above-mentioned cloud management platform. That is, the instructions stored in the memory 1002 in different computing devices 1000 may implement the functions of one or more modules of the receiving module, the processing module, the sending module, and the like.
[0157] In some possible implementations, one or more computing devices 1000 in the computing device cluster 1100 may be connected via a network, which may be a wide area network or a local area network.
[0158] See also Fig.12 , Fig.12 A schematic diagram of computer devices in a computer cluster provided in an embodiment of the present application being connected via a network. Fig.12 As shown, two computing devices 1000A and 1000B are connected via a network. Specifically, they are connected to the network via a communication interface in each computing device.
[0159] In a possible implementation, the memory in the computing device 1000A stores instructions for executing functions of the receiving module, the sending module, etc. Meanwhile, the memory in the computing device 1000B stores instructions for executing functions of the processing module, etc.
[0160] It should be understood that Fig.12 The functions of the computing device 1000A shown in FIG. 1000A may also be completed by multiple computing devices. Similarly, the functions of the computing device 1000B may also be completed by multiple computing devices.
[0161] The embodiment of the present application also relates to a computer storage medium, in which a program for signal processing is stored. When the program is run on a computer, the computer executes the following steps: Figure 2 The steps performed by the first computing node in the illustrated embodiment.
[0162] The present application also relates to a computer program product, which stores instructions, which, when executed by a computer, enable the computer to execute the following Figure 2 The steps performed by the first computing node in the illustrated embodiment.
[0163] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0164] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0165] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0166] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0167] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.
Claims
1. A method for processing a query instruction, characterized in that: The method is applied to a first computing node in a cloud service system, the first computing node including at least two processors, and the method includes: According to the acquired query instruction, first data to be queried is acquired, wherein the query instruction includes a first field, the first data includes at least two rows of data arranged in a first order, and the first order is obtained based on a value of the first field in each row of data included in the first data; At least two boundary information are determined by using a binary search method, wherein the at least two boundary information correspond one-to-one to at least two different values of the first field in the first data, the first boundary information is any one of the at least two boundary information, the first boundary information corresponds to a first value of the at least two different values, the first boundary information indicates at least one first row of data in the first data, and the value of the first field in each first row of data is the first value; Aggregation operations are performed in parallel on the row data corresponding to the at least two boundary information by the at least two processors to obtain a query result corresponding to the query instruction.
2. The method according to claim 1, characterized in that The first computing node stores first information, and the first information includes an index corresponding to each of at least two different values of the first field, wherein the first information includes a first index corresponding to the first value, and the first boundary information is obtained by using a binary method based on the first index.
3. The method according to claim 1 or 2, characterized in that: The query instruction includes identification information of the second data, and acquiring the first data to be queried according to the acquired query instruction includes: determining the second data according to the identification information of the second data in the query instruction; The first data to be queried is obtained from the second data, where the second data includes at least one of the first data, and the cardinality corresponding to the first field in the second data is less than or equal to a first quantity, and the first quantity represents the number of values of the first field that can be stored in the memory of the first computing node.
4. The method according to claim 3, characterized in that The query instruction further includes a second field, the cardinality of the second field in the second data is greater than a second number, the second number represents the number of values of the second field that can be stored in the memory of the first computing node, and the first processor is a processor for processing the first row of data among the at least two processors; The performing the aggregation operation on the row data corresponding to the at least two boundary information in parallel by the at least two processors to obtain the query result corresponding to the query instruction includes: The first processor aggregates the first row of data included in each of at least two groups to obtain at least two first aggregation results corresponding to the first boundary information, wherein the at least one first row of data corresponding to the first boundary information includes the at least two groups, the value of the second field in the first row of data in the same group of the at least two groups is the same, the at least two first aggregation results corresponding to the first boundary information correspond one-to-one to the at least two groups, and the query result is obtained based on the first aggregation result corresponding to each of the at least two boundary information.
5. The method according to claim 4, characterized in that In a case where the query instruction carries a filtering condition corresponding to the first aggregated result, the performing an aggregation operation on the row data corresponding to the at least two boundary information in parallel by the at least two processors to obtain a query result corresponding to the query instruction further includes: Based on the at least two first aggregation results corresponding to the first boundary information, a filtering operation corresponding to the filtering condition is performed to obtain a filtered first aggregation result, and the filtered first aggregation result is used to obtain the query result.
6. The method according to claim 1 or 2, characterized in that: The first computing node is any one of the following: a physical server, a virtual machine, a container, a micro virtual machine, or a bare metal server.
7. A computing node, characterized in that: The computing node is set in the cloud service system, and the computing node includes: an acquisition module, configured to acquire first data to be queried according to an acquired query instruction, wherein the query instruction includes a first field, the first data includes at least two rows of data arranged in a first order, and the first order is obtained based on a value of the first field in each row of data included in the first data; The determination module is further configured to determine at least two boundary information by using a binary search method, wherein the at least two boundary information correspond one-to-one to at least two different values of the first field in the first data, the first boundary information is any one of the at least two boundary information, the first boundary information corresponds to a first value of the at least two different values, the first boundary information indicates at least one first row of data in the first data, and the value of the first field in each first row of data is the first value; An aggregation module is used to perform an aggregation operation on the row data corresponding to the at least two boundary information in parallel through the at least two processors to obtain a query result corresponding to the query instruction.
8. The computing node according to claim 7, characterized in that: The computing node stores first information, which includes an index corresponding to each of at least two different values of the first field, wherein the first information includes a first index corresponding to the first value, and the first boundary information is obtained by using a binary method based on the first index.
9. The computing node according to claim 7 or 8, characterized in that: The query instruction includes identification information of the second data, and the acquisition module is specifically used to: determining the second data according to the identification information of the second data in the query instruction; The first data to be queried is obtained from the second data, where the second data includes at least one of the first data, and the cardinality corresponding to the first field in the second data is less than or equal to a first quantity, and the first quantity represents the number of values of the first field that can be stored in the memory of the first computing node.
10. The computing node according to claim 9, characterized in that: The query instruction further includes a second field, the cardinality of the second field in the second data is greater than a second number, the second number represents the number of values of the second field that can be stored in the memory of the computing node, and the first processor is a processor for processing the first row of data among the at least two processors; The aggregation module is specifically used to aggregate the first row of data included in each of at least two groups through the first processor to obtain at least two first aggregation results corresponding to the first boundary information, wherein the at least one first row of data corresponding to the first boundary information includes the at least two groups, the value of the second field in the first row of data in the same group of the at least two groups is the same, the at least two first aggregation results corresponding to the first boundary information correspond one-to-one to the at least two groups, and the query result is obtained based on the first aggregation result corresponding to each boundary information of the at least two boundary information.
11. The computing node according to claim 9, characterized in that: In the case where the query instruction carries a filtering condition corresponding to the first aggregation result, the aggregation module is specifically used to perform a filtering operation corresponding to the filtering condition based on the at least two first aggregation results corresponding to the first boundary information to obtain a filtered first aggregation result, and the filtered first aggregation result is used to obtain the query result.
12. The computing node according to claim 7 or 8, characterized in that: The computing node is any one of the following: a physical server, a virtual machine, a container, a micro virtual machine, or a bare metal server.
13. A computing device cluster, characterized in that: The computing device cluster includes at least one computing device, each computing device including a processor and a memory: The memory is used to store instructions; The processor is configured to cause the computing device cluster to execute the method according to any one of claims 1 to 6 according to the instructions.
14. A computer storage medium, characterized in that: The computer storage medium stores one or more instructions, which, when executed by one or more computers, enable the one or more computers to implement the method of any one of claims 1 to 6.
15. A computer program product, characterized in that The computer program product stores instructions, which, when executed by a computer, enable the computer to implement the method according to any one of claims 1 to 6.