Data query method and device, computer device, and storage medium
By using spatial indexes and index bitmaps for logical operations in a multidimensional data space, the problem of low efficiency in traditional multidimensional data queries is solved, enabling fast and accurate data subspace queries.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- KINGDEE SOFTWARE(CHINA) CO LTD
- Filing Date
- 2024-04-24
- Publication Date
- 2026-06-05
Smart Images

Figure CN118277417B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a data query method, apparatus, computer equipment, storage medium, and computer program product. Background Technology
[0002] With the development of computer technology, data querying techniques for multidimensional data spaces have emerged. A multidimensional data space typically refers to a data structure or spatial model capable of adapting to and representing the irregular, non-uniform, or complex spatial structure of multidimensional data. A multidimensional data space can have arbitrary dimensions, each potentially representing different attributes or characteristics. In practical applications, the number of data subspaces comprising a multidimensional data space is often very large, reaching tens of thousands or even millions.
[0003] Traditional techniques rely on brute-force matching to query data in a multidimensional data space, which involves matching each data subspace in the multidimensional data space one by one, resulting in low query efficiency. Summary of the Invention
[0004] Therefore, it is necessary to provide a data query method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve the efficiency of data query in order to address the above-mentioned technical problems.
[0005] This application provides a data query method. The method includes:
[0006] Obtain a data query request for a multidimensional data space; the data query request carries a target dimension combination, which includes the target members corresponding to each dimension of the data space to be queried in the multidimensional data space;
[0007] Obtain the spatial index corresponding to the multidimensional data space; the multidimensional data space includes multiple data subspaces, and the spatial index includes the index bitmaps corresponding to the dimension members included in each dimension. Each position in the index bitmap indicates a data subspace, and the element value at the same position in each index bitmap is used to indicate the subspace dimension combination corresponding to the data subspace.
[0008] Perform logical operations on the index bitmaps corresponding to each target member in the spatial index to obtain the result bitmaps corresponding to the combination of target dimensions.
[0009] Based on the result bitmap, determine the query results corresponding to the data query request.
[0010] This application also provides a data query device. The device includes:
[0011] The request retrieval module is used to retrieve data query requests for a multidimensional data space. The data query request carries a target dimension combination, which includes the target members corresponding to each dimension of the data space to be queried in the multidimensional data space.
[0012] The index acquisition module is used to acquire the spatial index corresponding to the multidimensional data space. The multidimensional data space includes multiple data subspaces. The spatial index includes index bitmaps corresponding to the dimension members included in each dimension. Each position in the index bitmap indicates a data subspace. The element value at the same position in each index bitmap is used to indicate the subspace dimension combination corresponding to the data subspace.
[0013] The result bitmap determination module is used to perform logical operations on the index bitmaps corresponding to each target member in the spatial index to obtain the result bitmaps corresponding to the target dimension combinations.
[0014] The query result determination module is used to determine the query result corresponding to the data query request based on the result bitmap.
[0015] A computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the above-described data query method.
[0016] A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the above-described data query method.
[0017] A computer program product includes a computer program that, when executed by a processor, implements the steps of the aforementioned data query method.
[0018] The aforementioned data query methods, devices, computer equipment, storage media, and computer program products, when querying the data subspaces hit by a target dimension combination in a multidimensional data space, obtain the index bitmaps corresponding to each target member in the target dimension combination from the spatial index corresponding to the multidimensional data space. The index bitmaps corresponding to the target members indicate the relationship between the target members and each data subspace, that is, whether the subspace dimension combination corresponding to each data subspace contains the target member. Logical operations are then performed on the index bitmaps corresponding to each target member to obtain the result bitmap corresponding to the target dimension combination. The result bitmap accurately indicates the relationship between the target dimension combination and each data subspace in the multidimensional data space, that is, which data subspaces the target dimension combination hits. By performing logical operations on the index bitmaps corresponding to each target member in the spatial index, the data query process can be simplified, and the data subspaces hit by the target dimension combination can be determined quickly and accurately, effectively improving the efficiency of data querying. Attached Figure Description
[0019] Figure 1 This is a diagram illustrating the application environment of a data query method in one embodiment.
[0020] Figure 2 This is a flowchart illustrating a data query method in one embodiment;
[0021] Figure 3 This is a schematic diagram of a multidimensional data space in one embodiment;
[0022] Figure 4 This is a schematic diagram of a multidimensional data space in another embodiment;
[0023] Figure 5 This is a schematic diagram of a multidimensional data space in another embodiment;
[0024] Figure 6 This is a schematic diagram of an index bitmap in one embodiment;
[0025] Figure 7 This is a schematic diagram illustrating logical operations performed on an index bitmap in one embodiment;
[0026] Figure 8 This is a schematic diagram of the factor data subspace in one embodiment;
[0027] Figure 9 This is a flowchart illustrating the process of determining a spatial index in one embodiment;
[0028] Figure 10 This is a schematic diagram of performing logical operations on an index bitmap in another embodiment;
[0029] Figure 11 This is a schematic diagram illustrating the grouping of data subspaces in one embodiment;
[0030] Figure 12 This is a schematic diagram of a two-level sparse index in one embodiment;
[0031] Figure 13 This is a structural block diagram of a data query device in one embodiment;
[0032] Figure 14 This is an internal structural diagram of a computer device in one embodiment;
[0033] Figure 15 This is a diagram of the internal structure of a computer device in another embodiment. Detailed Implementation
[0034] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0035] The data query method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or located on the cloud or other network servers. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can be smart TVs, smart in-vehicle devices, etc. Portable wearable devices can be smartwatches, smart bracelets, head-mounted devices, etc. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers. Terminal 102 and server 104 can be directly or indirectly connected via wired or wireless communication, which is not limited herein.
[0036] Both the terminal and the server can be used independently to execute the data query method provided in the embodiments of this application.
[0037] For example, a terminal receives a data query request targeting a multi-dimensional data space. This request carries a target dimension combination, which includes multiple target members. The terminal obtains the spatial index corresponding to the multi-dimensional data space. The multi-dimensional data space includes multiple data subspaces. The spatial index includes index bitmaps corresponding to the dimension members of each dimension. Each position in the index bitmap indicates a data subspace, and the element value at the same position in each index bitmap indicates the subspace dimension combination corresponding to that data subspace. The terminal performs logical operations on the index bitmaps corresponding to each target member in the spatial index to obtain the result bitmap corresponding to the target dimension combination. Based on the result bitmap, the terminal determines the query result corresponding to the data query request.
[0038] Terminals and servers can also work together to execute the data query methods provided in the embodiments of this application.
[0039] In one embodiment, such as Figure 2 As shown, a data query method is provided. Taking the application of this method to a computer device as an example, the computer device can be a terminal or a server. The method can be executed independently by the terminal or server, or it can be implemented through interaction between the terminal and the server. The data query method includes the following steps:
[0040] Step S202: Obtain a data query request for the multidimensional data space; the data query request carries a target dimension combination, which includes the target members corresponding to each dimension of the data space to be queried in the multidimensional data space.
[0041] In this context, a multidimensional data space refers to a data structure or spatial model capable of adapting to and representing irregular, non-uniform, or complex spatial structures within a multidimensional dataset. A multidimensional data space can have multiple dimensions, each representing a different attribute, and each dimension can have multiple dimensional members, i.e., multiple attribute values. A multidimensional data space is an irregular data space composed of multiple data subspaces, where intersections are possible. A data subspace is a regular data space defined by the set of dimensional members corresponding to each of its multiple dimensions. The subspace dimension combination corresponding to a data subspace refers to the set containing the dimensional members corresponding to each dimension of the data subspace.
[0042] For example, such as Figure 3 As shown, the regular cubes α, β, and γ are three distinct data subspaces. The data space composed of these subspaces is the multidimensional data space. The figure shows a three-dimensional space (including dimensions A, B, and C). Dimension A includes dimension members a1-a10, dimension B includes dimension members b1-b8, and dimension C includes dimension members c1-c6. The subspace dimension combinations corresponding to each data subspace in the figure are {A[a2,a3,a7], B[b2,b4,b8], C[c3,c...}}. The multidimensional data space composed of the data subspaces {A[a2,a3,a7],B[b3,b5],C[c3]} and {A[a3,a7],B[b2,b4],C[c1,c6]} can be represented as {A[a2,a3,a7],B[b2,b4,b8],C[c3,c5]}∪{A[a2,a3,a7],B[b3,b5],C[c3]}∪{A[a3,a7],B[b2,b4],C[c1,c6]}.
[0043] To further illustrate, in practical applications, the multidimensional data space for household budgeting can consist of three dimensions: date, expenditure account, and family member. The date dimension can include four members: first quarter, second quarter, third quarter, and fourth quarter. The expenditure type dimension can include four members: daily necessities, transportation, food and beverage, and medical care. The family member dimension can include three members: A, B, and C. The multidimensional data space is divided into multiple cells by the corresponding members of each dimension. Each cell is composed of combinations of dimension members; for example, {first quarter, transportation, A} corresponds to one cell, and the value stored in the cell is the expenditure amount corresponding to that combination of dimension members.
[0044] A target dimension combination refers to a combination of dimensions representing the data to be queried across all dimensions in a multidimensional data space. The dimension members included in the target dimension combination are the target members. Based on these target members, the data space to be queried can be determined. The data space to be queried refers to the data space corresponding to the data query request. The data space indicated by the target dimension combination can be a single cell, such as... Figure 3 As shown, {A[a2],B[b2],C[c6]} is a cell in the data space. The data space to be queried, indicated by the target dimension combination, can also be a regular data space composed of multiple cells in a multidimensional data space, such as... Figure 4 As shown in the figure, {A[a2,a3], B[b2,b3], C[c1,c2]} is a regular data space.
[0045] For example, when updating or inserting data in a multidimensional database, it is usually necessary to first determine whether the data falls within an existing multidimensional data space, and specifically, which data subspaces within that multidimensional data space it falls into. Based on the data subspace the data falls into, it can be determined whether the data is within a locked range, and also to identify the associated data, thereby triggering a recalculation of the associated data. The computer device obtains a data query request targeting the multidimensional data space. The data query request carries a target dimension combination, which includes the dimension members corresponding to the data to be queried in each dimension of the multidimensional data space.
[0046] Step S204: Obtain the spatial index corresponding to the multidimensional data space; the multidimensional data space includes multiple data subspaces, and the spatial index includes index bitmaps corresponding to the dimension members included in each dimension. Each position in the index bitmap indicates a data subspace, and the element value at the same position in each index bitmap is used to indicate the subspace dimension combination corresponding to the data subspace.
[0047] The spatial index is used to indicate the combination of subspace dimensions corresponding to each data subspace in the multidimensional data space. The spatial index consists of index bitmaps corresponding to each dimension member. The index bitmaps corresponding to dimension members indicate the relationship between the dimension members and each data subspace, that is, the data subspace that the dimension member corresponds to. The number of element values contained in the index bitmap is the same as the number of data subspaces in the multidimensional data space, and each element value at each position in the index bitmap corresponds to a data subspace.
[0048] For example, such as Figure 5As shown in the figure, the multidimensional data space is a two-dimensional space, where a1-a6 and b1-b6 are the dimension members corresponding to the multidimensional data space. The multidimensional data space contains three data subspaces, namely {A[a1,a2], B[b3,b4]}, {A[a2,a3,a4], B[b4,b5]}, and {A[a5], B[b2,b3,b4]}. Figure 5 The spatial index corresponding to the multidimensional data space in the example is as follows: Figure 6 As shown, this includes index bitmaps corresponding to each dimension member. The numbers refer to the numbers corresponding to each data subspace. Data subspace 1 corresponds to the first row of the index bitmap, data subspace 2 corresponds to the second row, and data subspace 3 corresponds to the third row. Only data subspace 1 matches dimension member a1; therefore, the index bitmap corresponding to a1 is {1,0,0}. Both data subspaces 1 and 2 match dimension member a2; therefore, the index bitmap corresponding to a2 is {1,1,0}, and so on, obtaining the index bitmaps corresponding to each dimension member. For data subspace 1, the subspace dimension combination corresponding to data subspace 1 can be determined by the element values corresponding to the first row positions in each index bitmap. That is, the subspace dimension combination corresponding to data subspace 1 consists of the dimension members with an element value of 1 in the first row.
[0049] For example, a computer device obtains the spatial index corresponding to a multidimensional data space. Specifically, based on the data subspace hit by the dimension member, the element values at the corresponding positions in the index bitmap of the dimension member are updated to obtain the index bitmap corresponding to the dimension member. Based on the index bitmaps corresponding to each dimension member, the spatial index corresponding to the multidimensional data space is obtained.
[0050] Step S206: Perform logical operations on the index bitmaps corresponding to each target member in the spatial index to obtain the result bitmaps corresponding to the target dimension combinations.
[0051] The result bitmap is a bitmap used to indicate the data subspace hit by the target dimension combination. Similar to the index bitmap, each position in the result bitmap indicates a data subspace, and the value at each position is the result value, used to indicate whether the target dimension combination hits the data subspace corresponding to that position. When the target dimension combination is a single cell, hitting the data subspace means that the target dimension combination falls within the data subspace; when the target dimension combination is a regular data space composed of multiple cells, hitting the data subspace means that there is an intersection between the target dimension combination and the data subspace.
[0052] For example, a computer device performs logical operations on the element values at the same position in the index bitmap corresponding to each target member, obtaining the result value corresponding to each position. Based on the result values corresponding to each position, a result bitmap corresponding to the target dimension combination is obtained. For example, Figure 7 As shown, for Figure 5 In the multidimensional data space shown, when the target dimension combination is {A[a3], B[b4]}, performing an AND operation on the index bitmaps corresponding to a3 and b4 respectively yields the result bitmap {0,1,0} corresponding to the target dimension combination. The result bitmap indicates that the target dimension combination falls within data subspace 2, i.e., it hits data subspace 2. When the target dimension combination is {A[a3], B[b3]}, performing an AND operation on the index bitmaps corresponding to a3 and b3 respectively yields the result bitmap {0,0,0} corresponding to the target dimension combination. The result bitmap indicates that the target dimension combination does not hit any of the data subspaces.
[0053] Step S208: Based on the result bitmap, determine the query result corresponding to the data query request.
[0054] For example, the computer device determines the data subspace hit by the target dimension combination based on the element values at various positions in the result bitmap. Based on the data subspace hit by the target dimension combination, the query result corresponding to the data query request is determined.
[0055] In some embodiments, when the business requirement is to determine whether the data is within a locked range before inserting or updating data in a multidimensional database, the hit data subspace is directly used as the query result. Based on whether the data subspace contained in the query result is a locked data space, it can be determined whether the data update can be executed. That is, if the data subspace contained in the query result is not a locked data space, the data update is executed; if the data subspace contained in the query result is a locked data space, the data update is not executed.
[0056] In some embodiments, when the business requirement is to insert or update data in a multidimensional database while simultaneously determining the associated data space corresponding to the data space to be queried (the data space to be queried refers to the data space corresponding to the data to be inserted or updated) and synchronously updating the associated data space, based on each data subspace hit by the target dimension combination, the expression hit by each hit data subspace is determined. Based on the hit expression, the associated data space corresponding to the data space to be queried is determined, and the dimension combination corresponding to the associated data space is taken as the associated dimension combination. The associated dimension combination is taken as the query result. Based on the query result, while updating the data on the target dimension combination in the multidimensional data space, the associated data on the associated dimension combination is recalculated.
[0057] For example, suppose the set of expressions is as follows:
[0058] Expression A: {[a1],[b2],[c1]}={[a1],[b1,b2],[c2]}+{[a1],[b1,b2],[c3]};
[0059] Expression B: {[a1],[b1,b3],[c1]}={[a2],[b1,b3],[c1]}+{[a3],[b2],[c1]};
[0060] Expression C: {[a1],[b1],[c1,c2]}={[a2],[b2],[c1,c2]}+{[a3],[b3],[c2]}.
[0061] When the target dimension combination matches the data subspace {[a3],[b2],[c1]}, further query the expression matched by {[a3],[b2],[c1]}. The data subspaces on the right side of the equals sign of the expression are factor data subspaces. Compare {[a3],[b2],[c1]} with the factor data subspaces corresponding to each expression to determine that the data subspace {[a3],[b2],[c1]} matches expression B. The two factor data subspaces corresponding to expression B are as follows: Figure 8 As shown, at this point, the dimension combination {[a1],[b1,b3],[c1]} corresponding to the data subspace on the left side of the expression is taken as the associated dimension combination.
[0062] In the aforementioned data query method, when querying the data subspaces hit by the target dimension combination in the multidimensional data space, the index bitmaps corresponding to each target member in the target dimension combination are obtained from the spatial index corresponding to the multidimensional data space. The index bitmaps corresponding to the target members indicate the relationship between the target members and each data subspace, that is, whether the subspace dimension combination corresponding to each data subspace contains the target member. Logical operations are then performed on the index bitmaps corresponding to each target member to obtain the result bitmap corresponding to the target dimension combination. The result bitmap accurately indicates the relationship between the target dimension combination and each data subspace in the multidimensional data space, i.e., which data subspaces the target dimension combination hits. By performing logical operations on the index bitmaps corresponding to each target member in the spatial index, the data query process can be simplified, quickly and accurately determining which data subspaces the target dimension combination hits, effectively improving the efficiency of data querying.
[0063] In one embodiment, such as Figure 9 As shown, obtaining the spatial index corresponding to the multidimensional data space includes:
[0064] Step S902: Take the data subspace corresponding to the subspace dimension combination to which the dimension member belongs as the data subspace hit by the dimension member, and obtain the data subspace hit by each dimension member respectively.
[0065] Step S904: For any dimension member, determine the element value corresponding to the data subspace where the dimension member is hit as the first tag value, and determine the element value corresponding to the data subspace where the dimension member is not hit as the second tag value. Based on the element values of each data subspace for the dimension member, obtain the index bitmap corresponding to the dimension member.
[0066] Step S906: Based on the index bitmaps corresponding to each dimension member, obtain the spatial index corresponding to the multidimensional data space.
[0067] Here, the first flag value is used to mark the data subspace where the dimension member has been hit. The second flag value is used to mark the data subspace where the dimension member has not been hit. For ease of subsequent logical operations, the first flag value can be set to 1, and the second flag value can be set to 0.
[0068] For example, the computer device sequentially takes each dimension member in the multidimensional data space as the current dimension member. Among the subspace dimension combinations corresponding to each data subspace, it determines the subspace dimension combination that contains the current dimension member. This subspace dimension combination containing the current dimension member is then taken as the data subspace hit by the current dimension member. It can be understood that the data subspace hit by the dimension member refers to the data subspace that intersects with the data space indicated by the dimension member, for example, such as... Figure 5 As shown, the dashed box marks the data space indicated by dimension member a2. Data subspaces 1 and 2 both intersect with the data space indicated by dimension member a2. Therefore, the data subspaces hit by dimension member a2 are data subspaces 1 and 2. The element values corresponding to the hit data subspaces in the index bitmap are then determined as the first marker value, and the element values corresponding to the unhit data subspaces in the index bitmap are determined as the second marker value. Based on the element values of each data subspace for the current dimension member, the index bitmap corresponding to the current dimension member is obtained. Specifically, the element values corresponding to each data subspace are filled into the corresponding positions in the index bitmap to obtain the index bitmap corresponding to the current dimension member. The positions of each data subspace in the index bitmap are fixed. Finally, based on the index bitmaps corresponding to each dimension member, the spatial index corresponding to the multidimensional data space is obtained.
[0069] In the above embodiments, for each dimension member in the multidimensional data space, a corresponding index bitmap is determined, and each position in the index bitmap corresponding to the dimension member indicates a data subspace. Based on the index bitmaps corresponding to each dimension member, the data subspace hit by the dimension member can be quickly determined. The spatial index corresponding to the multidimensional data space is determined based on the index bitmaps corresponding to each dimension member. The spatial index provides a retrieval basis for subsequent queries of the data subspace hit by the target dimension combination. Through the spatial index, the data subspace hit by the target dimension combination can be queried quickly and accurately, thereby effectively improving the efficiency of data querying.
[0070] In one embodiment, logical operations are performed on the index bitmaps corresponding to each target member in the spatial index to obtain the result bitmap corresponding to the target dimension combination, including:
[0071] Obtain the index bitmap corresponding to each target member in the spatial index;
[0072] Perform an OR operation on the index bitmaps corresponding to each target member belonging to the same target dimension to obtain the dimension bitmaps corresponding to each target dimension.
[0073] Perform a bitwise AND operation on the element values corresponding to the same data subspace in each dimension bitmap to obtain the result value corresponding to each data subspace.
[0074] Based on the result values corresponding to each data subspace, a result bitmap corresponding to the target dimension combination is obtained.
[0075] Here, the target dimension refers to the dimension to which each target member belongs in the target dimension combination. The dimension bitmap is a bitmap obtained by performing an OR operation on the index bitmaps corresponding to each target member of the same target dimension, and is used to indicate the data subspaces hit by the target dimension combination on that target dimension.
[0076] For example, the computer device obtains the index bitmaps corresponding to each target member in a combination of target dimensions. Then, it performs an OR operation on the index bitmaps corresponding to each target member belonging to the same target dimension to obtain the dimension bitmaps corresponding to each target dimension. Specifically, each target dimension is sequentially used as the current target dimension. When the current target dimension corresponds to only one target member, the index bitmap corresponding to that target member is used as the dimension bitmap corresponding to the current target dimension. When the current target dimension corresponds to two or more target members, an OR operation is performed on the index bitmaps corresponding to each target member of the current target dimension to obtain the dimension bitmap corresponding to the current target dimension.
[0077] The computer device performs a bitwise AND operation on the element values corresponding to each dimension bitmap of the same data subspace, obtaining the result values for each data subspace. Based on the result values for each data subspace, a result bitmap corresponding to the target dimension combination is obtained. Specifically, a first bitmap and a second bitmap are determined in each dimension bitmap. A bitwise AND operation is performed on the first bitmap and the second bitmap to obtain an intermediate bitmap. This intermediate bitmap is then used as the first bitmap. A second bitmap is determined in the remaining dimension bitmaps. The process of performing a bitwise AND operation on the first bitmap and the second bitmap to obtain the intermediate bitmap is repeated until a termination condition is met, resulting in the result bitmap corresponding to the target dimension combination. The termination condition is that there are no remaining dimension bitmaps, i.e., the bitwise AND operation on each dimension bitmap is completed, or all result values in the intermediate bitmap are the second marker values. When all result values in the intermediate bitmap are the second marker values, there is no need to perform a bitwise AND operation with the remaining dimension bitmaps; the result values in the result bitmap are directly determined to be the second marker values. This improves the efficiency of calculating the result bitmap, thereby improving the efficiency of data querying.
[0078] For example, such as Figure 10 As shown, for Figure 4 In the multidimensional data space shown, when the target dimension combination is {A[a2,a3], B[a2,a3]}, firstly, an OR operation is performed on the index bitmaps corresponding to each target member belonging to the same target dimension, and then an AND operation is performed on the dimension bitmaps corresponding to each target dimension to obtain the result bitmap. The element in the first row of the result bitmap is 1, indicating that the target dimension combination hits the data subspace corresponding to the first row, that is, there is an intersection between the target dimension combination and the data subspace of number 1.
[0079] In the above embodiments, after obtaining the index bitmaps corresponding to each target member, an OR operation is first performed on the index bitmaps corresponding to each target member belonging to the same target dimension to obtain the dimension bitmaps corresponding to each target dimension. The dimension bitmaps corresponding to the target dimensions can indicate the data subspaces hit by the target dimension combination on that target dimension. Then, an AND operation is performed on the dimension bitmaps corresponding to each target dimension to obtain the result bitmaps corresponding to the target dimension combination. The result bitmaps obtained in this way can indicate the data subspaces hit by the target dimension combination in the multidimensional data space. This is because when a data subspace is hit by each target dimension in the target dimension combination, the result value corresponding to the data subspace after the AND operation is still the first marker value, indicating that the data subspace is hit by the target dimension combination. In this way, by performing logical operations on the index bitmaps corresponding to each target member, the result bitmaps corresponding to the target dimension combination can be quickly and accurately determined. Based on the result bitmaps, the relationship between the target dimension combination and each data subspace can be quickly determined, thereby improving the efficiency of data query.
[0080] In one embodiment, logical operations are performed on the index bitmaps corresponding to each target member in the spatial index to obtain the result bitmap corresponding to the target dimension combination, including:
[0081] Obtain the first sparse index corresponding to the multidimensional data space; the first sparse index includes the first index value corresponding to each dimension member. When each element value in the index bitmap corresponding to the dimension member is a first tag value, the first index value corresponding to the dimension member is the first tag value. When each element value in the index bitmap corresponding to the dimension member has a second tag value, the first index value corresponding to the dimension member is the second tag value.
[0082] The target dimension to which the target member whose first index value is the second tag value in the first sparse index belongs is taken as the dimension to be calculated.
[0083] Logical operations are performed on the index bitmaps corresponding to the target members in the spatial index for each dimension to be calculated, to obtain the result bitmap corresponding to the combination of target dimensions.
[0084] The first index value indicates whether a dimension member hits all data subspaces in the multidimensional data space. The first sparse index indicates which dimension members in the multidimensional data space hit all data subspaces. The first sparse index records the first index value corresponding to each dimension member. The first index value corresponding to a dimension member that hits all data subspaces is the first marker value, and the first index value corresponding to a dimension member that does not hit any data subspace is the second marker value. The dimension to be computed refers to the dimension of the target member to which logical operations need to be performed.
[0085] For example, a computer device obtains a first sparse index corresponding to a multidimensional data space. Specifically, while generating the spatial index corresponding to the multidimensional data space, a bitwise AND operation can be performed on each element value in the index bitmap corresponding to each dimension member to obtain the first index value corresponding to each dimension member. Then, based on the first sparse index, the dimension to be calculated is determined among each target member, that is, the target dimension to which the target member whose first index value is the second marker value belongs is taken as the dimension to be calculated. It can be understood that when there is a target member with a first index value of the first marker value among the target members corresponding to the target dimension, regardless of whether the target dimension contains one or more target members, a bitwise OR operation is performed on the index bitmap corresponding to each target member under the target dimension to obtain each element value in the dimension bitmap corresponding to the target dimension as the first marker value. Therefore, when performing logical operations on each target dimension, it is not necessary to take the target dimension to which the target member whose first index value is the first marker value belongs as the dimension to be calculated. Then, a bitwise OR operation is performed on the index bitmap corresponding to each target member belonging to the same dimension to be calculated to obtain the dimension bitmap corresponding to each dimension to be calculated. Then, a bitwise AND operation is performed on each dimension bitmap to obtain the result bitmap corresponding to the combination of target dimensions.
[0086] In the above embodiments, to accelerate data query efficiency, a first sparse index is created simultaneously with the spatial index. This first sparse index indicates which dimension members in each dimension member hit all data subspaces. When a target dimension combination contains a target member with a first index value of a first marker value, it indicates that an OR operation is performed on the index bitmaps corresponding to each target member under that target dimension, resulting in each element in the dimension bitmap corresponding to that target dimension having the first marker value. Therefore, when performing logical operations on each target dimension, it is unnecessary to use the target dimension to which the target member with the first index value of the first marker value belongs as the dimension to be calculated, thereby reducing unnecessary computation, saving computer resources, and effectively improving data query efficiency.
[0087] In one embodiment, logical operations are performed on the index bitmaps corresponding to each target member in the spatial index to obtain the result bitmap corresponding to the target dimension combination, including:
[0088] Obtain the second sparse index corresponding to the multidimensional data space; the second sparse index includes the second index value corresponding to each dimension member. When each element value in the index bitmap corresponding to the dimension member has a first marker value, the second index value corresponding to the dimension member is the first marker value. When each element value in the index bitmap corresponding to the dimension member is a second marker value, the second index value corresponding to the dimension member is the second marker value.
[0089] When the second index value corresponding to any target member in the second sparse index is the second label value, the result value corresponding to each data subspace is determined to be the second label value.
[0090] Based on the result values corresponding to each data subspace, a result bitmap corresponding to the target dimension combination is obtained.
[0091] The second index value indicates whether a dimension member does not hit all data subspaces in the multidimensional data space. The second sparse index indicates which dimension members in the multidimensional data space do not hit all data subspaces. The second sparse index records the second index value corresponding to each dimension member. The second index value corresponding to a dimension member that hits at least one data subspace is the first marker value, and the second index value corresponding to a dimension member that does not hit all data subspaces is the second marker value.
[0092] For example, the computer device obtains the second sparse index corresponding to the multidimensional data space. Specifically, while generating the spatial index corresponding to the multidimensional data space, an OR operation can be performed on the element values in the index bitmap corresponding to each dimension member to obtain the second index value corresponding to each dimension member. When the second index value corresponding to any target member in the target dimension combination is the second marker value in the second sparse index, it indicates that the target member has not hit any data subspace in the multidimensional data space. Therefore, the target dimension combination also cannot hit any data subspace in the multidimensional data space, and the result value corresponding to each data subspace is determined as the second marker value. Based on the result values corresponding to each data subspace, the result bitmap corresponding to the target dimension combination is obtained. If there is no target member in the target dimension combination whose second index value is the second marker value, the result bitmap corresponding to the target dimension combination is obtained by performing logical operations on the index bitmap corresponding to each target member.
[0093] In one embodiment, while generating the spatial index corresponding to the multidimensional data space, a first sparse index and a second sparse index corresponding to the multidimensional data space are determined. When any target member in the target dimension combination has a second index value corresponding to a second marker value in the second sparse index, the result value corresponding to each data subspace is directly determined as the second marker value, resulting in a bitmap corresponding to the target dimension combination. When no target member has a second index value corresponding to a second marker value, based on the first sparse index, the target dimension to which the target member with a first index value corresponding to a second marker value in the first sparse index belongs is taken as the dimension to be calculated. Logical operations are performed on the index bitmaps corresponding to the target members of each dimension to be calculated in the spatial index to obtain the bitmap corresponding to the target dimension combination. In this way, by creating the spatial index and the first sparse index and the second sparse index simultaneously, and by using the first sparse index and the second sparse index together to reduce unnecessary calculations, data query efficiency can be further improved.
[0094] In the above embodiments, to accelerate data query efficiency, a second sparse index is created simultaneously with the spatial index. The second sparse index indicates which dimension members do not match any data subspace. When a target dimension combination contains a target member whose second index value is the second marker value, it indicates that the target dimension combination cannot match any data subspace in the multidimensional data space. In this case, the result value corresponding to each data subspace is directly determined to be the second marker value, resulting in a result bitmap. This eliminates the need for logical operations on the index bitmaps corresponding to each target member, effectively improving data query efficiency.
[0095] In one embodiment, logical operations are performed on the index bitmaps corresponding to each target member in the spatial index to obtain the result bitmap corresponding to the target dimension combination, including:
[0096] When the number of data subspaces included in the multidimensional data space exceeds the preset number, the data subspaces included in the multidimensional data space are grouped to obtain multiple sets of subspaces;
[0097] Based on the spatial index, determine the subspace index corresponding to each subspace set;
[0098] Each set of subspaces is used as the current set of subspaces;
[0099] Obtain the sub-index bitmap corresponding to each target member in the subspace index of the current subspace set;
[0100] Perform an OR operation on the sub-index bitmaps corresponding to each target member belonging to the same target dimension to obtain the sub-dimension bitmaps corresponding to each target dimension.
[0101] Perform AND operations on the sub-dimensional bitmaps corresponding to each target dimension in sequence to obtain the sub-result bitmaps corresponding to the current subspace set;
[0102] By stitching together the sub-result bitmaps corresponding to each subspace set, the result bitmap corresponding to the target dimension combination is obtained.
[0103] The preset quantity can be set according to actual needs. A subspace set refers to a collection composed of multiple data subspaces.
[0104] For example, when the number of data subspaces included in a multidimensional data space exceeds a preset number, the data subspaces can be grouped to obtain multiple subspace sets. For example, such as... Figure 11 As shown, when the number of data subspaces exceeds 128, they can be grouped into sets of 64, resulting in multiple subspace sets. Correspondingly, the index bitmap corresponding to each dimension member is divided into multiple sub-index bitmaps. The element values in rows 1 to 64 are grouped into the same sub-index bitmap, and the elements in rows 65 to 128 are grouped into the same sub-index bitmap. Furthermore, in the spatial index, the sub-index bitmaps corresponding to the same dimension member for each subspace set are determined, resulting in the sub-index bitmaps for each dimension member for each subspace set. Based on the sub-index bitmaps corresponding to each dimension member for the same subspace set, the subspace index for each subspace set is obtained.
[0105] The computer device uses each subspace set as the current subspace set. It obtains the sub-index bitmap corresponding to each target member in the subspace index of the current subspace set. It performs an OR operation on the sub-index bitmaps corresponding to each target member belonging to the same target dimension to obtain the sub-dimension bitmaps corresponding to each target dimension. Then, it sequentially performs AND operations on the sub-dimension bitmaps corresponding to each target dimension to obtain the sub-result bitmap corresponding to the current subspace set. Specifically, it determines the first and second sub-dimension bitmaps in each sub-dimension bitmap, performs an AND operation on the first and second sub-dimension bitmaps to obtain an intermediate sub-dimension bitmap, and uses this intermediate sub-dimension bitmap as the first sub-dimension bitmap. It then re-determines the second sub-dimension bitmap from the remaining sub-dimension bitmaps corresponding to the current subspace set, and returns to the step of performing an AND operation on the first and second sub-dimension bitmaps to obtain the intermediate sub-dimension bitmap, until the termination condition is met, resulting in the sub-result bitmap corresponding to the current subspace set. The termination condition is that there are no remaining sub-dimension bitmaps, meaning the AND operation on all sub-dimension bitmaps of the current subspace set is completed, or all result values in the intermediate sub-dimension bitmaps are the second marker value. When all result values in the intermediate sub-dimension bitmaps are the second marker value, there is no need to perform an AND operation with the remaining sub-dimension bitmaps. The result values in the sub-result bitmaps corresponding to the current subspace set are directly determined as the second marker value. This improves the efficiency of calculating the result bitmaps, thereby improving the efficiency of data querying.
[0106] The computer device treats each subspace set as the current subspace set, obtains the corresponding sub-result bitmap for each subspace set, and then concatenates these sub-result bitmaps to obtain the result bitmap corresponding to the target dimension combination. In actual implementation, the computer device can process each subspace set in parallel to obtain the corresponding sub-result bitmap for each subspace set, thus improving data query efficiency.
[0107] In the above embodiments, when the multidimensional data space contains a large number of data subspaces, the index bitmaps corresponding to each dimension member are segmented to obtain subspace indices corresponding to multiple subspace sets. By grouping the data subspaces, grouped result bitmaps can be obtained. When performing a bitwise AND operation on the sub-dimensional bitmaps corresponding to the previous subspace set, if an intermediate sub-dimensional bitmap with all element values being the second marker value appears, the result values in the sub-result bitmap corresponding to that subspace set are directly determined to be the second marker value, and the process jumps directly to obtaining the sub-result bitmap corresponding to the next subspace set. This reduces unnecessary calculations, saves computer resources, and improves data query efficiency.
[0108] In one embodiment, determining the query result corresponding to the data query request based on the result bitmap includes:
[0109] The data subspace corresponding to the position of the first marker value in the result bitmap is determined as the target subspace hit by the target dimension combination in the multidimensional data space;
[0110] The query results corresponding to the data query request are obtained based on the target subspace.
[0111] The target subspace refers to the data subspace in which the target dimension combination hits the multidimensional data space.
[0112] For example, the computer device determines the data subspace corresponding to the position of the result value in the result bitmap as the target subspace in the multidimensional data space where the target dimension combination is hit. Then, based on the target subspace, the query result corresponding to the data query request is determined. When the target dimension combination is a single cell, hitting the data subspace means that the target dimension combination falls within the data subspace. When the target dimension combination is a regular data space composed of multiple cells, hitting the data subspace means that there is an intersection between the target dimension combination and the data subspace.
[0113] In the above embodiments, based on the result values corresponding to each position in the result bitmap, the target subspace hit by the target dimension combination in the multidimensional data space can be quickly and accurately determined, thereby obtaining the query results corresponding to the data query request, which can effectively simplify the data query process and improve the data query efficiency.
[0114] In one specific embodiment, the data query method proposed in this application can be applied to scenarios involving multidimensional data locking, that is, before updating data, querying whether the data falls within the locked multidimensional data space. The data query method includes the following steps:
[0115] 1. Create an index bitmap
[0116] The computer device determines the corresponding index bitmap for each dimension member based on the rule cubes (i.e., data subspaces) that each dimension member hits within the dimensional irregular space (i.e., multidimensional data space). Each position in the index bitmap indicates a rule cube, and the element value at the same position in each index bitmap indicates the subspace dimension combination corresponding to the rule cube. If a dimension member hits a rule cube, the element value at the corresponding position in the index bitmap is set to 1; if a dimension member does not hit a rule cube, the element value at the corresponding position in the index bitmap is set to 0.
[0117] 2. Create bitmaps with all zeros and bitmaps with all one values.
[0118] To accelerate data retrieval, computer equipment creates a two-level sparse index, consisting of an all-zero bitmap and an all-one bitmap. Specifically, a bitwise AND operation is performed on the element values in the index bitmap corresponding to each dimension member to obtain the first index value for each dimension member. This first index value is then used to create an all-one bitmap (i.e., the first sparse index). Similarly, an OR operation is performed on the element values in the index bitmap corresponding to each dimension member to obtain the second index value for each dimension member. This second index value is then used to create an all-zero bitmap (i.e., the second sparse index). For example... Figure 5 The multidimensional data space in the image corresponds to all-zero bitmaps and all-one bitmaps, such as... Figure 12 As shown.
[0119] 3. Data Query
[0120] When updating data in a multidimensional database, the computer device obtains a data query request for the multidimensional data space. This request carries the target dimension combination corresponding to the data to be updated, which includes multiple target members. First, the second index value corresponding to each target member in the all-zero bitmap is determined. If a target member with a second index value of 0 exists, it indicates that the target dimension combination does not match any regular cube, meaning the data to be updated is not within the locked multidimensional data space, and the data update operation can be performed. If no target member with a second index value of 0 exists, the target member with a first index value of 0 is determined in the all-one bitmap. The target dimension to which the target member with the first index value of 0 belongs is taken as the dimension to be calculated. Then, an OR operation is performed on the index bitmaps corresponding to each target member belonging to the same dimension to be calculated, resulting in a dimension bitmap for each dimension to be calculated. Finally, an AND operation is performed on each dimension bitmap to obtain the result bitmap corresponding to the target dimension combination.
[0121] In the above embodiments, by creating index bitmaps corresponding to each dimension member, when performing data queries targeting a combination of dimensions, the index bitmaps corresponding to each target dimension in the target dimension combination are obtained. Logical operations are then performed on the index bitmaps corresponding to each target member, enabling rapid and accurate determination of the rule cubes matched by the target dimension combination. However, in real-world applications, the number of rule cubes constituting a multidimensional irregular space is often very large, reaching tens of thousands or even millions, making brute-force matching extremely slow. In this case, by creating index bitmaps and performing logical operations on them, the data query process can be effectively simplified, improving data query efficiency. Furthermore, by adding secondary sparse indexes, namely all-zero bitmaps and all-one bitmaps, query efficiency can be greatly accelerated, unnecessary logical operations can be avoided, and data query efficiency can be further improved.
[0122] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0123] Based on the same inventive concept, this application also provides a data query apparatus for implementing the data query method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more data query apparatus embodiments provided below can be found in the limitations of the data query method described above, and will not be repeated here.
[0124] In one embodiment, such as Figure 13 As shown, a data query device is provided, including: a request retrieval module 1302, an index retrieval module 1304, a result bitmap determination module 1306, and a query result determination module 1308, wherein:
[0125] The request acquisition module 1302 is used to acquire a data query request for a multidimensional data space. The data query request carries a target dimension combination, which includes the target members corresponding to each dimension of the data space to be queried in the multidimensional data space.
[0126] The index acquisition module 1304 is used to acquire the spatial index corresponding to the multidimensional data space. The multidimensional data space includes multiple data subspaces. The spatial index includes index bitmaps corresponding to the dimension members included in each dimension. Each position in the index bitmap indicates a data subspace. The element value at the same position in each index bitmap is used to indicate the subspace dimension combination corresponding to the data subspace.
[0127] The result bitmap determination module 1306 is used to perform logical operations on the index bitmaps corresponding to each target member in the spatial index to obtain the result bitmaps corresponding to the target dimension combinations.
[0128] The query result determination module 1308 is used to determine the query result corresponding to the data query request based on the result bitmap.
[0129] In one embodiment, the index acquisition module 1304 is further configured to:
[0130] The data subspace corresponding to the combination of subspace dimensions to which a dimension member belongs is taken as the data subspace hit by the dimension member, thus obtaining the data subspace hit by each dimension member. For any dimension member, the element value corresponding to the data subspace hit by the dimension member is determined as the first tag value, and the element value corresponding to the data subspace not hit by the dimension member is determined as the second tag value. Based on the element values of each data subspace for the dimension member, the index bitmap corresponding to the dimension member is obtained. Based on the index bitmap corresponding to each dimension member, the spatial index corresponding to the multidimensional data space is obtained.
[0131] In one embodiment, the resulting bitmap determination module 1306 is further configured to:
[0132] Obtain the index bitmap corresponding to each target member in the spatial index; perform an OR operation on the index bitmaps corresponding to each target member belonging to the same target dimension to obtain the dimension bitmap corresponding to each target dimension; perform an AND operation on the element values corresponding to each dimension bitmap of the same data subspace to obtain the result value corresponding to each data subspace; based on the result value corresponding to each data subspace, obtain the result bitmap corresponding to the combination of target dimensions.
[0133] In one embodiment, the resulting bitmap determination module 1306 is further configured to:
[0134] Obtain the first sparse index corresponding to the multidimensional data space; the first sparse index includes the first index value corresponding to each dimension member. When each element value in the index bitmap corresponding to the dimension member is a first label value, the first index value corresponding to the dimension member is the first label value. When each element value in the index bitmap corresponding to the dimension member has a second label value, the first index value corresponding to the dimension member is the second label value. Take the target dimension to which the target member whose first index value is a second label value in the first sparse index belongs as the dimension to be calculated. Perform logical operations on the index bitmaps corresponding to the target members of each dimension to be calculated in the spatial index to obtain the result bitmap corresponding to the combination of target dimensions.
[0135] In one embodiment, the resulting bitmap determination module 1306 is further configured to:
[0136] Obtain the second sparse index corresponding to the multidimensional data space; the second sparse index includes the second index values corresponding to the dimension members included in each dimension. When each element value in the index bitmap corresponding to the dimension member has a first marker value, the second index value corresponding to the dimension member is the first marker value; when each element value in the index bitmap corresponding to the dimension member is a second marker value, the second index value corresponding to the dimension member is the second marker value; when the second index value corresponding to any target member in the second sparse index is the second marker value, determine the result value corresponding to each data subspace as the second marker value; based on the result values corresponding to each data subspace, obtain the result bitmap corresponding to the target dimension combination.
[0137] In one embodiment, the resulting bitmap determination module 1306 is further configured to:
[0138] When the number of data subspaces included in the multidimensional data space exceeds a preset number, the data subspaces included in the multidimensional data space are grouped to obtain multiple subspace sets; based on the spatial index, the subspace index corresponding to each subspace set is determined; each subspace set is used as the current subspace set in turn; the sub-index bitmap corresponding to each target member in the subspace index corresponding to the current subspace set is obtained; the sub-index bitmaps corresponding to each target member belonging to the same target dimension are ORed to obtain the sub-dimension bitmaps corresponding to each target dimension; the sub-dimension bitmaps corresponding to each target dimension are ANDed to obtain the sub-result bitmaps corresponding to the current subspace set in turn; the sub-result bitmaps corresponding to each subspace set are concatenated to obtain the result bitmap corresponding to the target dimension combination.
[0139] In one embodiment, the query result determination module 1308 is further configured to:
[0140] The data subspace corresponding to the position of the first marker value in the result bitmap is determined as the target subspace in the multidimensional data space where the target dimension combination is hit; the query results corresponding to the data query request are obtained based on the target subspace.
[0141] The aforementioned data query device, when querying the data subspaces hit by a target dimension combination in a multidimensional data space, retrieves the index bitmaps corresponding to each target member in the target dimension combination from the spatial index corresponding to the multidimensional data space. The index bitmaps corresponding to the target members indicate the relationship between the target members and each data subspace, that is, whether the subspace dimension combination corresponding to each data subspace contains the target member. Logical operations are then performed on the index bitmaps corresponding to each target member to obtain the result bitmap corresponding to the target dimension combination. The result bitmap accurately indicates the relationship between the target dimension combination and each data subspace in the multidimensional data space, i.e., which data subspaces the target dimension combination hits. By performing logical operations on the index bitmaps corresponding to each target member in the spatial index, the data query process can be simplified, quickly and accurately determining which data subspaces the target dimension combination hits, effectively improving the efficiency of data querying.
[0142] Each module in the aforementioned data query device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0143] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 14 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores data such as target dimension combinations and spatial indexes. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When executed by the processor, the computer program implements a data query method.
[0144] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 15As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a data query method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0145] Those skilled in the art will understand that Figure 14 , 15 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0146] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0147] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.
[0148] In one embodiment, a computer program product or computer program is provided, the computer product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, causing the computer device to perform the steps in the above-described method embodiments.
[0149] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0150] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0151] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0152] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A data query method, characterized in that, The method includes: Obtain a data query request for a multidimensional data space; the data query request carries a target dimension combination, the target dimension combination including the target members corresponding to the data space to be queried in each dimension of the multidimensional data space; Obtain the spatial index corresponding to the multidimensional data space; the multidimensional data space includes an irregular data space composed of multiple data subspaces, and there is an intersection between the various data subspaces; the spatial index includes an index bitmap corresponding to the dimension members included in each dimension, each position in the index bitmap indicates a data subspace, and the element value at the same position in each index bitmap is used to indicate the subspace dimension combination corresponding to the corresponding data subspace; the subspace dimension combination refers to the set containing the dimension members corresponding to the data subspace in each dimension; Logical operations are performed on the index bitmaps corresponding to each of the target members in the spatial index to obtain the result bitmap corresponding to the target dimension combination; wherein, the process of determining the result bitmap corresponding to the target dimension combination includes: Logical operations are performed on the element values at the same position in the index bitmap corresponding to each target member to obtain the result value corresponding to each position. Based on the result value corresponding to each position, the result bitmap corresponding to the target dimension combination is obtained. Based on the result bitmap, the query result corresponding to the data query request is determined. The result bitmap is used to indicate the bitmap of the data subspace hit by the target dimension combination. When the target dimension combination is a regular data space composed of multiple cells, the target dimension combination hitting the data subspace means that there is an intersection between the target dimension combination and the data subspace.
2. The method according to claim 1, characterized in that, Obtaining the spatial index corresponding to the multidimensional data space includes: The data subspace corresponding to the combination of subspace dimensions to which the dimension member belongs is taken as the data subspace hit by the dimension member, thus obtaining the data subspace hit by each dimension member respectively; For any of the dimension members, the element value corresponding to the data subspace where the dimension member is hit is determined as the first tag value, and the element value corresponding to the data subspace where the dimension member is not hit is determined as the second tag value. Based on the element value of each data subspace for the dimension member, the index bitmap corresponding to the dimension member is obtained. Based on the index bitmaps corresponding to each of the aforementioned dimension members, the spatial index corresponding to the multidimensional data space is obtained.
3. The method according to claim 1, characterized in that, The step of performing logical operations on the index bitmaps corresponding to each of the target members in the spatial index to obtain the result bitmap corresponding to the target dimension combination includes: Obtain the first sparse index corresponding to the multidimensional data space; the first sparse index includes the first index value corresponding to the dimension members included in each dimension. When each element value in the index bitmap corresponding to the dimension member is a first marker value, the first index value corresponding to the dimension member is the first marker value. When each element value in the index bitmap corresponding to the dimension member has a second marker value, the first index value corresponding to the dimension member is the second marker value. The target dimension to which the target member whose first index value is the second tag value in the first sparse index belongs is taken as the dimension to be calculated. Logical operations are performed on the index bitmaps corresponding to the target members of each dimension to be calculated in the spatial index to obtain the result bitmaps corresponding to the combination of the target dimensions.
4. The method according to claim 1, characterized in that, The step of performing logical operations on the index bitmaps corresponding to each of the target members in the spatial index to obtain the result bitmap corresponding to the target dimension combination includes: Obtain the second sparse index corresponding to the multidimensional data space; the second sparse index includes the second index value corresponding to each dimension member included in each dimension. When each element value in the index bitmap corresponding to the dimension member has a first marker value, the second index value corresponding to the dimension member is the first marker value. When each element value in the index bitmap corresponding to the dimension member is a second marker value, the second index value corresponding to the dimension member is the second marker value. When the second index value corresponding to any of the target members in the second sparse index is the second tag value, the result value corresponding to each of the data subspaces is determined to be the second tag value. Based on the result values corresponding to each of the data subspaces, a result bitmap corresponding to the target dimension combination is obtained.
5. The method according to claim 1, characterized in that, The step of performing logical operations on the index bitmaps corresponding to each of the target members in the spatial index to obtain the result bitmap corresponding to the target dimension combination includes: When the number of data subspaces included in the multidimensional data space exceeds a preset number, the data subspaces included in the multidimensional data space are grouped to obtain multiple subspace sets; Based on the spatial index, determine the subspace index corresponding to each of the subspace sets; Each of the aforementioned subspace sets is taken as the current subspace set; Obtain the sub-index bitmap corresponding to each of the target members in the sub-space index corresponding to the current sub-space set; Perform an OR operation on the sub-index bitmaps corresponding to each target member belonging to the same target dimension to obtain the sub-dimension bitmaps corresponding to each target dimension. Perform AND operations on the sub-dimensional bitmaps corresponding to each target dimension in sequence to obtain the sub-result bitmaps corresponding to the current subspace set; By splicing the sub-result bitmaps corresponding to each of the subspace sets, the result bitmap corresponding to the target dimension combination is obtained.
6. The method according to any one of claims 1-5, characterized in that, Determining the query result corresponding to the data query request based on the result bitmap includes: The data subspace corresponding to the position of the result value in the result bitmap is determined as the target subspace in the multidimensional data space hit by the target dimension combination; The query results corresponding to the data query request are obtained based on the target subspace.
7. The method according to claim 6, characterized in that, The step of obtaining the query result corresponding to the data query request based on the target subspace includes: Based on the resulting bitmap, determine the target subspace hit by the target dimension combination; The target subspace is matched with a predefined set of expressions, which define computational relationships between data subspaces; Based on the matching results, determine the associated data subspace corresponding to the target subspace in the expression; The dimension combination corresponding to the associated data subspace is taken as the associated dimension combination, and the associated dimension combination is taken as the query result.
8. A data query device, characterized in that, The device includes: The request acquisition module is used to acquire a data query request for a multidimensional data space; the data query request carries a target dimension combination, the target dimension combination includes multiple target members corresponding to each dimension of the data space to be queried in the multidimensional data space; An index acquisition module is used to acquire the spatial index corresponding to the multidimensional data space; the multidimensional data space includes an irregular data space composed of multiple data subspaces, and there is an intersection between the various data subspaces; the spatial index includes index bitmaps corresponding to the dimension members included in each dimension, each position in the index bitmap indicates a data subspace, and the element value at the same position in each index bitmap is used to indicate the subspace dimension combination corresponding to the corresponding data subspace; the subspace dimension combination refers to a set containing the dimension members corresponding to the data subspace in each dimension; The result bitmap determination module is used to perform logical operations on the index bitmaps corresponding to each of the target members in the spatial index to obtain the result bitmap corresponding to the target dimension combination; wherein, the determination process of the result bitmap corresponding to the target dimension combination includes: performing logical operations on the element values located at the same position in the index bitmaps corresponding to each target member to obtain the result values corresponding to each position, and obtaining the result bitmap corresponding to the target dimension combination based on the result values corresponding to each position. The query result determination module is used to determine the query result corresponding to the data query request based on the result bitmap; the result bitmap is used to indicate the bitmap of the data subspace hit by the target dimension combination; when the target dimension combination is a regular data space composed of multiple cells, the target dimension combination hitting the data subspace means that there is an intersection between the target dimension combination and the data subspace.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.