CN118277417A - Data query method, device, computer equipment and storage medium - Google Patents

Data query method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN118277417A
CN118277417A CN202410501166.5A CN202410501166A CN118277417A CN 118277417 A CN118277417 A CN 118277417A CN 202410501166 A CN202410501166 A CN 202410501166A CN 118277417 A CN118277417 A CN 118277417A
Authority
CN
China
Prior art keywords
dimension
index
data
target
subspace
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410501166.5A
Other languages
Chinese (zh)
Inventor
丁少鸿
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kingdee Software China Co Ltd
Original Assignee
Kingdee Software China Co Ltd
Filing date
Publication date
Application filed by Kingdee Software China Co Ltd filed Critical Kingdee Software China Co Ltd
Publication of CN118277417A publication Critical patent/CN118277417A/en
Pending legal-status Critical Current

Links

Abstract

The present application relates to a data query method, apparatus, computer device, storage medium and computer program product. The method comprises the following steps: acquiring a data query request aiming at a multidimensional data space; the data query request carries a target dimension combination; acquiring a spatial index corresponding to the multidimensional data space; the multi-dimensional data space comprises a plurality of data subspaces, the space index comprises index bitmaps respectively corresponding to dimension members included in each dimension, each position in the index bitmaps respectively indicates one data subspace, and element values at the same position in each index bitmap are used for indicating subspace dimension combinations corresponding to the corresponding data subspaces; performing logic operation on index bitmaps corresponding to each target member in the spatial index to obtain a result bitmap corresponding to the target dimension combination; and determining a query result corresponding to the data query request based on the result bitmap. By adopting the method, the data query efficiency can be improved.

Description

Data query method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technology, and in particular, to a data query method, apparatus, computer device, storage medium, and computer program product.
Background
With the development of computer technology, data query technology for multidimensional data space has emerged. Multidimensional data space generally refers to a data structure or spatial model that is capable of adapting to and representing a spatial structure of irregular, non-uniform, or complex shape in a multidimensional dataset. The multidimensional data space may have any dimensions, each of which may represent a different attribute or feature. In an actual application scenario, the number of each data subspace forming the multidimensional data space is often very large, reaching tens of thousands or even millions.
In the traditional technology, data query is performed in a multidimensional data space in a violent matching mode, namely, the data query is matched with all data subspaces in the multidimensional data space one by one, so that the problem of low query efficiency exists.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a data query method, apparatus, computer device, computer-readable storage medium, and computer program product that can improve data query efficiency.
The application provides a data query method. The method comprises the following steps:
Acquiring a data query request aiming at a multidimensional data space; the data query request carries a target dimension combination, wherein the target dimension combination comprises target members respectively corresponding to the data space to be queried in each dimension of the multidimensional data space;
acquiring a spatial index corresponding to the multidimensional data space; the multi-dimensional data space comprises a plurality of data subspaces, the space index comprises index bitmaps respectively corresponding to dimension members included in each dimension, each position in the index bitmaps respectively indicates one data subspace, and element values at the same position in each index bitmap are used for indicating subspace dimension combinations corresponding to the corresponding data subspaces;
Performing logic operation on index bitmaps corresponding to each target member in the spatial index to obtain a result bitmap corresponding to the target dimension combination;
And determining a query result corresponding to the data query request based on the result bitmap.
The application also provides a data query device. The device comprises:
The request acquisition module is used for acquiring a data query request aiming at the multidimensional data space; the data query request carries a target dimension combination, wherein the target dimension combination comprises target members respectively corresponding to the data space to be queried in each dimension of the multidimensional data space;
the index acquisition module is used for acquiring a spatial index corresponding to the multidimensional data space; the multi-dimensional data space comprises a plurality of data subspaces, the space index comprises index bitmaps respectively corresponding to dimension members included in each dimension, each position in the index bitmaps respectively indicates one data subspace, and element values at the same position in each index bitmap are used for indicating subspace dimension combinations corresponding to the corresponding data subspaces;
The result bitmap determining module is used for carrying out logic operation on index bitmaps respectively corresponding to each target member in the space index to obtain a result bitmap corresponding to the target dimension combination;
And the query result determining module is used for determining a query result corresponding to the data query request based on the result bitmap.
A computer device comprising a memory storing a computer program and a processor implementing the steps of the data query method described above when the processor executes the computer program.
A computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the data querying method described above.
A computer program product comprising a computer program which, when executed by a processor, implements the steps of the data query method described above.
The data query method, the data query device, the computer equipment, the storage medium and the computer program product acquire index bitmaps respectively corresponding to each target member in the target dimension combination in the spatial index corresponding to the multidimensional data space when the data subspace hit by the target dimension combination is queried in the multidimensional data space. The index bitmap corresponding to the target member may indicate a relationship between the target member and each data subspace, that is, whether the subspace dimension combination corresponding to each data subspace contains the target member. And further, carrying out logic operation on the index bitmaps corresponding to the target members respectively to obtain a result bitmap corresponding to the target dimension combination. The resulting bitmap can accurately indicate the relationship between the target dimension combination and each of the data subspaces in the multidimensional data space, i.e., which data subspaces the target dimension combination hits. By carrying out logic operation on index bitmaps corresponding to each target member in the spatial index, the data query process can be simplified, which data subspaces are hit by the target dimension combination can be rapidly and accurately determined, and the data query efficiency is effectively improved.
Drawings
FIG. 1 is an application environment diagram of a data polling method in one embodiment;
FIG. 2 is a flow diagram of a method of data polling in one embodiment;
FIG. 3 is a schematic diagram of a multidimensional data space in one embodiment;
FIG. 4 is a schematic diagram of a multidimensional data space in another embodiment;
FIG. 5 is a schematic diagram of a multidimensional data space in another embodiment;
FIG. 6 is a schematic diagram of an index bitmap in one embodiment;
FIG. 7 is a schematic diagram of performing logical operations on an index bitmap in one embodiment;
FIG. 8 is a schematic diagram of a factor data subspace in one embodiment;
FIG. 9 is a flow diagram of determining a spatial index in one embodiment;
FIG. 10 is a schematic diagram of a logical operation performed on an index bitmap in another embodiment;
FIG. 11 is a diagram of grouping data subspaces in one embodiment;
FIG. 12 is a schematic diagram of a two-level sparse index in one embodiment;
FIG. 13 is a block diagram of a data polling device in one embodiment;
FIG. 14 is an internal block diagram of a computer device in one embodiment;
fig. 15 is an internal structural view of a computer device in another embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The data query method provided by the embodiment of the application can be applied to an application environment shown in figure 1. Wherein the terminal 102 communicates with the server 104 via a network. The data storage system may store data that the server 104 needs to process. The data storage system may be integrated on the server 104 or may be located on a cloud or other network server. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices, and portable wearable devices, which may be smart televisions, smart car devices, and the like. The portable wearable device may be a smart watch, smart bracelet, headset, or the like. The server 104 may be implemented as a stand-alone server or as a server cluster of multiple servers. The terminal 102 and the server 104 may be directly or indirectly connected through wired or wireless communication, and the present application is not limited herein.
The terminal and the server can be independently used for executing the data query method provided in the embodiment of the application.
For example, a terminal obtains a data query request for a multidimensional data space, the data query request carrying a target dimension combination, the target dimension combination comprising a plurality of target members. The terminal acquires a space index corresponding to a multi-dimensional data space, wherein the multi-dimensional data space comprises a plurality of data subspaces, the space index comprises index bitmaps respectively corresponding to dimension members included in each dimension, each position in the index bitmaps respectively indicates one data subspace, and element values at the same position in each index bitmap are used for indicating subspace dimension combinations corresponding to the corresponding data subspaces. And the terminal carries out logic operation on index bitmaps corresponding to the target members in the spatial indexes respectively to obtain a result bitmap corresponding to the target dimension combination. And the terminal determines a query result corresponding to the data query request based on the result bitmap.
The terminal and the server can also cooperate to perform the data query method provided in the embodiments of the present application.
In one embodiment, as shown in fig. 2, a data query method is provided, and the method is applied to a computer device, which is a terminal or a server, and is executed by the terminal or the server, or may be implemented through interaction between the terminal and the server. The data query method comprises the following steps:
Step S202, acquiring a data query request for a multidimensional data space; the data query request carries a target dimension combination, wherein the target dimension combination comprises target members respectively corresponding to the data space to be queried in each dimension of the multidimensional data space.
The multidimensional data space refers to a data structure or a spatial model, and can adapt to and represent a spatial structure of irregular, nonuniform or complex shape in a multidimensional data set, and the multidimensional data space can have multiple dimensions, each dimension represents different attributes, and each dimension can have multiple dimension members, namely multiple attribute values. A multidimensional data space is an irregular data space that is stitched from a plurality of data subspaces, where intersections may exist between the respective data subspaces. The data subspace is a rule data space determined by a set of dimension members corresponding respectively across a plurality of dimensions. The subspace dimension combination corresponding to the data subspace refers to a set comprising dimension members respectively corresponding to the data subspace in each dimension.
For example, as shown in fig. 3, the regular cubes α, β, γ are respectively three different data subspaces, the data space formed by each data subspace is a multidimensional data space, the three-dimensional space (including A, B, C three dimensions) is shown in the figure, the a dimension includes dimension members a1-a10, the B dimension includes dimension members B1-B8, the C dimension includes dimension members C1-C6, the subspace dimension combinations corresponding to each data subspace in the figure are { a2, a3, a7], B2, B4, B8, C3, C5 } { a2, a3, a7, B3, B5, C3 } and { a3, a7, B2, B4, C1, C6 } respectively, and the multidimensional data space formed by each data subspace can be represented as { a2, a3, a7, B2, B4, C3, C8 { C3, C5 } and { a2, B3, C2, C4 } are { a3, C2, C4 } and { a3, C2, C3, C2.
Further by way of example, in a practical application scenario, the multidimensional data space for home billing may consist of three dimensions, a date dimension, a spending account dimension, and a family member dimension. The date dimension may include four dimension members of one quarter, two quarters, three quarters and four quarters, the expenditure type dimension may include four dimension members of daily necessities, traffic, catering and medical treatment, the family member dimension may include three dimension members of A, B and C, the multidimensional data space is divided into a plurality of cells by the dimension members corresponding to each dimension respectively, each cell is formed by combination of dimension members, for example { one quarter, traffic, A } corresponds to one cell, and the value stored in the cell is the expenditure amount corresponding to the combination of dimension members.
The target dimension combination is a dimension combination formed by dimension members corresponding to each dimension of the data to be queried in the multidimensional data space, and the dimension members included in the target dimension combination are target members. Based on the individual target members in the target dimension combination, a data space to be queried may be determined. The data space to be queried refers to a data space corresponding to data to be queried corresponding to a query request. The data space to be queried indicated by the target dimension combination may be a cell, as shown in fig. 3, { a2, B2, C6] is a cell in the data space, and the data space to be queried indicated by the target dimension combination may also be a regular data space composed of a plurality of cells in the multidimensional data space, as shown in fig. 4, { a2, a3, B2, B3, C1, C2 } is a regular data space.
Illustratively, when data updating or insertion is performed in a multidimensional database, it is often necessary to first determine whether data falls into an existing multidimensional data space, and in particular which data subspaces in the multidimensional data space. According to the data subspace in which the data falls, whether the data is located in the locking range or not can be determined, and associated data corresponding to the data can be determined, so that the recalculation of the associated data is triggered. The method comprises the steps that a computer device obtains a data query request aiming at a multidimensional data space, wherein the data query request carries a target dimension combination, and the target dimension combination comprises dimension members respectively corresponding to data to be queried in each dimension in the multidimensional data space.
Step S204, obtaining a spatial index corresponding to the multidimensional data space; the multidimensional data space comprises a plurality of data subspaces, the space index comprises index bitmaps respectively corresponding to dimension members included in each dimension, each position in the index bitmaps respectively indicates one data subspace, and element values at the same position in each index bitmap are used for indicating subspace dimension combinations corresponding to the corresponding data subspaces.
The space index is used for indicating subspace dimension combinations corresponding to each data subspace in the multidimensional data space, and the space index is composed of index bitmaps corresponding to each dimension member in each dimension. The index bitmap corresponding to the dimension member is used for indicating the relation between the dimension member and each data subspace, namely indicating the data subspace hit by the dimension member. The index bitmap contains the same number of element values as the number of data subspaces in the multidimensional data space, and the element values at each position in the index bitmap sequentially correspond to one data subspace.
For example, as shown in fig. 5, the multidimensional data space in the drawing is a two-dimensional space, where a1-a6 and B1-B6 are dimension members corresponding to the multidimensional data space, the multidimensional data space includes 3 data subspaces { a1, a2 }, B [ B3, B4] }, { a [ a2, a3, a4] }, B [ B4, B5] } and { a [ a5], B [ B2, B3, B4] }, the spatial index corresponding to the multidimensional data space in fig. 5 is as shown in fig. 6, wherein the index bitmap corresponding to each dimension member is included, the number refers to the number corresponding to each data subspace, wherein the data subspace 1 corresponds to the position of the first row in the index bitmap, the data subspace 2 corresponds to the position of the second row in the index bitmap, and the data subspace 3 corresponds to the position of the third row in the index bitmap. Only the data subspace 1 hits the dimension member a1 in the 3 data subspaces, so that the index bitmap corresponding to the data subspace a1 is {1, 0}, the data subspace 1 and the data subspace 2 hit the dimension member a2 at the same time, so that the index bitmap corresponding to the data subspace a2 is {1, 0}, and the like, and the index bitmaps corresponding to the dimension members are respectively obtained. For the data subspace No. 1, a subspace dimension combination corresponding to the data subspace No. 1 can be determined through the corresponding element values at the first line position in each index bitmap, namely, each dimension member with the element value of 1 at the first line position forms the subspace dimension combination corresponding to the data subspace No. 1.
Illustratively, a computer device obtains a spatial index for a multidimensional data space. Specifically, based on the data subspace hit by the dimension member, updating the element value at the corresponding position in the index bitmap of the dimension member to obtain the index bitmap corresponding to the dimension member, and based on the index bitmaps respectively corresponding to the dimension members, obtaining the spatial index corresponding to the multidimensional data space.
Step S206, performing logic operation on the index bitmaps respectively corresponding to the target members in the spatial index to obtain a result bitmap corresponding to the target dimension combination.
Wherein the result bitmap refers to a bitmap of the data subspace for indicating target dimension combination hits. Similar to the index bitmap, each position in the result bitmap indicates a data subspace, and the numerical value at each position is the result value, which is used for indicating whether the target dimension combination hits the data subspace corresponding to the position. When the target dimension combination is a cell, the target dimension combination hits the data subspace, namely the target dimension combination falls into the data subspace; when the target dimension combination is a regular data space composed of a plurality of cells, a hit of the target dimension combination to the data subspace means that there is an intersection between the target dimension combination and the data subspace.
The computer device performs a logical operation on element values located at the same position in the index bitmap corresponding to each target member to obtain result values corresponding to each position, and obtains a result bitmap corresponding to the target dimension combination based on the result values corresponding to each position. For example, as shown in fig. 7, for the multidimensional data space shown in fig. 5, when the target dimension combination is { a [ a3], B [ B4] }, performing an and operation on the index bitmaps corresponding to a3 and B4 respectively to obtain a result bitmap {0,1,0} corresponding to the target dimension combination, where the result bitmap indicates that the target dimension combination falls into the data subspace No. 2, i.e., hits the data subspace No. 2; when the target dimension combination is { A [ a3], B [ B3] }, performing AND operation on the index bitmaps corresponding to a3 and B3 respectively to obtain a result bitmap {0, 0} corresponding to the target dimension combination, wherein the result bitmap indicates that the target dimension combination does not hit each data subspace.
Step S208, determining a query result corresponding to the data query request based on the result bitmap.
Illustratively, the computer device determines a data subspace for the target dimension combination hit based on the element values at each location in the result bitmap. And determining a query result corresponding to the data query request based on the data subspace hit by the target dimension combination.
In some embodiments, when the service requirement is before data is inserted or updated in the multidimensional database, whether the data is located in the locking range is determined, the hit data subspace is directly used as a query result, whether the data update can be executed can be determined according to whether the data subspace included in the query result is a locked data space, that is, when the data subspace included in the query result is not the locked data space, the current data update is executed, and when the data subspace included in the query result is the locked data space, the current data update is not executed.
In some embodiments, when the service requirement is that data is inserted or updated in the multidimensional database, determining an associated data space corresponding to a data space to be queried (the data space to be queried refers to a data space corresponding to data to be inserted or updated), and synchronously updating the associated data space, determining an expression hit by each hit data subspace based on each data subspace hit by a target dimension combination, determining the associated data space corresponding to the data space to be queried based on the hit expression, and taking a dimension combination corresponding to the associated data space as an associated dimension combination. And combining the associated dimensions as a query result. Based on the query results, the associated data on the associated dimension combination is recalculated while updating the data on the target dimension combination in the multidimensional data space.
For example, assume the expression set is as follows:
Expression a: { [ a1], [ b2], [ c1] } = { [ a1], [ b1, b2], [ c2] } + { [ a1], [ b1, b2], [ c3] };
Expression B: { [ a1], [ b1, b3], [ c1] } = { [ a2], [ b1, b3], [ c1] } + { [ a3], [ b2], [ c1] };
Expression C: { [ a1], [ b1], [ c1, c2] } = { [ a2], [ b2], [ c1, c2] } + { [ a3], [ b3], [ c2] }.
When the target dimension combination hits the data subspace { [ a3], [ b2], [ c1] }, the expression hit by { [ a3], [ b2], [ c1] } is further queried, and each data subspace on the right side of the expression equal sign is the factor data subspace. The factor data subspaces corresponding to the expressions are compared to determine the data subspaces of { [ a3], [ B2], [ c1] } hit the expression B, and the two factor data subspaces corresponding to the expression B are shown in FIG. 8, wherein the dimension combinations of { [ a1], [ B1, B3], [ c1] } corresponding to the data subspaces on the left side of the expression are used as the associated dimension combinations.
In the data query method, when the data subspace hit by the target dimension combination is queried in the multidimensional data space, the index bitmaps respectively corresponding to the target members in the target dimension combination are acquired from the space indexes corresponding to the multidimensional data space. The index bitmap corresponding to the target member may indicate a relationship between the target member and each data subspace, that is, whether the subspace dimension combination corresponding to each data subspace contains the target member. And further, carrying out logic operation on the index bitmaps corresponding to the target members respectively to obtain a result bitmap corresponding to the target dimension combination. The resulting bitmap can accurately indicate the relationship between the target dimension combination and each of the data subspaces in the multidimensional data space, i.e., which data subspaces the target dimension combination hits. By carrying out logic operation on index bitmaps corresponding to each target member in the spatial index, the data query process can be simplified, which data subspaces are hit by the target dimension combination can be rapidly and accurately determined, and the data query efficiency is effectively improved.
In one embodiment, as shown in fig. 9, obtaining a spatial index corresponding to a multidimensional data space includes:
Step S902, the data subspace corresponding to the subspace dimension combination to which the dimension member belongs is used as the data subspace hit by the dimension member, and the data subspace hit by each dimension member is obtained.
Step S904, for any dimension member, determining an element value corresponding to a data subspace hit by the dimension member as a first flag value, determining an element value corresponding to a data subspace missed by the dimension member as a second flag value, and obtaining an index bitmap corresponding to the dimension member based on the element values of the data subspace for the dimension member.
Step S906, based on the index bitmaps respectively corresponding to the dimension members, the spatial index corresponding to the multidimensional data space is obtained.
Wherein the first tag value refers to a value of a data subspace used for tagging dimension member hits. The second tag value refers to a value used to tag the data subspace of dimension member misses. To facilitate subsequent logical operations, the first flag value may be set to 1 and the second flag value may be set to 0.
The computer device sequentially takes each dimension member in the multidimensional data space as a current dimension member, determines a subspace dimension combination containing the current dimension member in subspace dimension combinations respectively corresponding to each data subspace, and takes the subspace dimension combination containing the current dimension member as a hit data subspace of the current dimension member. It will be appreciated that the data subspace hit by the dimension member refers to a data subspace having an intersection with the data space indicated by the dimension member, for example, as shown in fig. 5, the dashed box marks the data space indicated by the dimension member a2, and the data subspace No. 1 and the data subspace No. 2 have an intersection with the data space indicated by the dimension member a2, so the data subspace hit by the dimension member a2 is the data subspace No. 1 and the data subspace No. 2. And determining the element value corresponding to the data subspace hit by the current dimension member in the index bitmap as a first mark value, and determining the element value corresponding to the data subspace missed by the current dimension member in the index bitmap as a second mark value. And obtaining an index bitmap corresponding to the current dimension member based on the element values of the current dimension member of each data subspace. Specifically, filling element values corresponding to each data subspace into positions corresponding to the data subspaces in the index bitmap to obtain the index bitmap corresponding to the current dimension member. The corresponding position of each data subspace in the index bitmap is fixed. And finally, obtaining a spatial index corresponding to the multidimensional data space based on the index bitmaps respectively corresponding to the members of each dimension.
In the above embodiment, 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 respectively corresponding to the dimension members, the data subspaces hit by the dimension members can be rapidly determined. And determining a spatial index corresponding to the multidimensional data space based on index bitmaps respectively corresponding to the dimension members, wherein the spatial index can provide a retrieval basis for the data subspace hit by the subsequent query target dimension combination. The data subspace hit by the target dimension combination can be quickly and accurately queried through the spatial index, so that the data query efficiency is effectively improved.
In one embodiment, performing a logical operation on index bitmaps corresponding to each target member in the spatial index to obtain a result bitmap corresponding to the target dimension combination, where the method includes:
Obtaining index bitmaps respectively corresponding to each target member in the spatial index;
Performing OR operation on index bitmaps respectively corresponding to all target members belonging to the same target dimension to respectively obtain dimension bitmaps corresponding to all target dimensions;
performing AND operation on element values corresponding to the same data subspace in each dimension bitmap to obtain result values corresponding to each data subspace;
And obtaining a result bitmap corresponding to the target dimension combination based on the result values respectively corresponding to the data subspaces.
The target dimension refers to the dimension of each target member in the target dimension combination. The dimension bitmap refers to a bitmap obtained by performing or operation on index bitmaps corresponding to each target member of the same target dimension, and is used for indicating each data subspace hit by the target dimension combination in the target dimension.
Illustratively, the computer device obtains index bitmaps corresponding to each target member in the index bitmaps in each target dimension combination. And further performing OR operation on the index bitmaps respectively corresponding to the target members belonging to the same target dimension to respectively obtain dimension bitmaps corresponding to the target dimensions. Specifically, each target dimension is sequentially used as a current target dimension, when the current target dimension corresponds to only one target member, an index bitmap corresponding to the target member is used as a dimension bitmap corresponding to the current target dimension, and when the current target dimension corresponds to two or more target members, or operation is performed on the index bitmaps corresponding to each target member corresponding to the current target dimension, so as to obtain a dimension bitmap corresponding to the current target dimension.
And the computer equipment performs AND operation on the element values corresponding to the same data subspace in each dimension bitmap to respectively obtain the result values corresponding to the data subspaces, and obtains the result bitmap corresponding to the target dimension combination based on the result values corresponding to the data subspaces. Specifically, determining a first bitmap and a second bitmap in each dimension bitmap, performing AND operation on the first bitmap and the second bitmap to obtain an intermediate bitmap, further using the intermediate bitmap as the first bitmap, re-determining the second bitmap in the rest dimension bitmaps, and returning to performing AND operation on the first bitmap and the second bitmap to obtain the intermediate bitmap until the end condition is met, thereby obtaining a result bitmap corresponding to the target dimension combination. The ending condition is that no dimension bitmap remains, that is, the AND operation on each dimension bitmap is completed, or each result value in the intermediate bitmap is the second flag value. When each result value in the intermediate bitmap is the second mark value, the intermediate bitmap does not need to be subjected to AND operation with the rest of dimension bitmaps, and each result value in the result bitmap is directly determined to be the second mark value, so that the efficiency of calculating the result bitmap can be improved, and the efficiency of data query is improved.
For example, as shown in fig. 10, for the multidimensional data space shown in fig. 4, when the target dimension combination is { a [ a2, a3], B [ a2, a3] }, the or operation is first performed on the index bitmaps respectively corresponding to each target member belonging to the same target dimension, and then the and operation is performed on the dimension bitmaps respectively corresponding to each target dimension, so as to obtain a result bitmap, and an element located in the first row in the result bitmap is 1, which indicates 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 No. 1.
In the above embodiment, after the index bitmaps respectively corresponding to the target members are obtained, the index bitmaps respectively corresponding to the target members belonging to the same target dimension are first or operated to obtain the dimension bitmaps respectively corresponding to the target dimensions. The dimension bitmap corresponding to the target dimension may indicate the respective data subspaces that the target dimension combination hits on the target dimension. And performing AND operation on the dimension bitmaps corresponding to the target dimensions respectively to obtain a result bitmap corresponding to the target dimension combination, wherein the obtained result bitmap can indicate a data subspace hit by the target dimension combination in the multidimensional data space. Because when a data subspace is hit by each target dimension in the target dimension combination, the result value corresponding to operating the data subspace is still the first flag value, which indicates that the data subspace is hit by the target dimension combination. In this way, the result bitmaps corresponding to the target dimension combinations can be quickly and accurately determined by carrying out logic operation on the index bitmaps corresponding to the target members respectively, and the relation between the target dimension combinations and each data subspace can be quickly determined based on the result bitmaps, so that the efficiency of data query is improved.
In one embodiment, performing a logical operation on index bitmaps corresponding to each target member in the spatial index to obtain a result bitmap corresponding to the target dimension combination, where the method includes:
Acquiring a first sparse index corresponding to the multidimensional data space; the first sparse index comprises first index values respectively corresponding to dimension members included in each dimension, when each element value in an index bitmap corresponding to the dimension member is a first mark value, the first index value corresponding to the dimension member is a first mark value, and when each element value in the index bitmap corresponding to the dimension member is a second mark value, the first index value corresponding to the dimension member is a second mark value;
taking a target dimension of a target member, which corresponds to a first index value which is a second mark value in the first sparse index, as a dimension to be calculated;
And carrying out logic operation on index bitmaps corresponding to the target members corresponding to the dimensions to be calculated in the space indexes to obtain a result bitmap corresponding to the target dimension combination.
Wherein the first index value is used to indicate whether the dimension member hits all data subspaces in the multidimensional data space. The first sparse index is used for indicating that the dimension members of all the data subspaces are hit in each dimension member included in the multidimensional data space, the first sparse index records first index values corresponding to the dimension members respectively, the first index values corresponding to the dimension members hit all the data subspaces are first mark values, and the first index values corresponding to the dimension members not hit any one data subspace are second mark values. The dimension to be calculated refers to the dimension of the target member, which needs to be subjected to logic operation.
Illustratively, a computer device obtains a first sparse index corresponding to a multidimensional data space. Specifically, when generating the spatial index corresponding to the multidimensional data space, performing an and operation on each element value in the index bitmap corresponding to each dimension member to obtain a first index value corresponding to each dimension member. And determining the dimension to be calculated in each target member according to the first sparse index, namely, taking the target dimension of the target member with the first index value being the second mark value as the dimension to be calculated. It can be understood that when there is a target member whose first index value is the first flag value in each target member corresponding to the target dimension, whether the target dimension includes one or more target members, the index bitmap corresponding to each target member in the target dimension is or is operated to obtain that each element value in the dimension bitmap corresponding to the target dimension is the first flag value. Therefore, when the logical operation is performed on each target dimension, the target dimension to which the target member whose first index value is the first flag value belongs does not need to be used as the dimension to be calculated. And further performing OR operation on the index bitmaps respectively corresponding to the target members belonging to the same dimension to be calculated to obtain dimension bitmaps respectively corresponding to the dimensions to be calculated. And performing AND operation on each dimension bitmap to obtain a result bitmap corresponding to the target dimension combination.
In the above embodiment, in order to accelerate the efficiency of data query, the spatial index is created, and at the same time, the first sparse index is created, where the first sparse index may indicate the dimension members that hit all the data subspaces among the dimension members. When target members with the first index value being the first mark value exist in the target dimension combination, indicating that the index bitmaps corresponding to the target members in the target dimension are subjected to OR operation, and obtaining that the element values in the dimension bitmaps corresponding to the target dimension are all the first mark values. Therefore, when the logical operation is performed on each target dimension, the target dimension of the target member with the first index value being the first mark value is not required to be used as the dimension to be calculated, so that unnecessary calculation processes are reduced, computer resources can be saved, and the efficiency of data query is effectively improved.
In one embodiment, performing a logical operation on index bitmaps corresponding to each target member in the spatial index to obtain a result bitmap corresponding to the target dimension combination, where the method includes:
Acquiring a second sparse index corresponding to the multidimensional data space; the second sparse index comprises second index values respectively corresponding to dimension members included in each dimension, when each element value in an index bitmap corresponding to the dimension member has a first mark value, the second index value corresponding to the dimension member is the first mark value, and when each element value in the index bitmap corresponding to the dimension member is the second mark value, the second index value corresponding to the dimension member is the second mark value;
when a second index value corresponding to any target member in the second sparse index is a second mark value, determining that a result value corresponding to each data subspace is the second mark value;
And obtaining a result bitmap corresponding to the target dimension combination based on the result values respectively corresponding to the data subspaces.
Wherein the second index value is used to indicate whether the dimension member does not hit all of the data subspaces in the multidimensional data space. The second sparse index is used for indicating that the dimension members of all the data subspaces are not hit in the dimension members included in the multidimensional data space, the second sparse index records second index values corresponding to the dimension members respectively, the second index value corresponding to the dimension member hit at least one data subspace is a first mark value, and the second index value corresponding to the dimension member not hit all the data subspaces is a second mark value.
Illustratively, the computer device obtains a second sparse index corresponding to the multidimensional data space. Specifically, while generating the spatial index corresponding to the multidimensional data space, each element value in the index bitmap corresponding to each dimension member may be subjected to or operation, so as to obtain the second index value corresponding to each dimension member. When the second index value corresponding to any one target member in the target dimension combination in the second sparse index is the second flag value, it is indicated that the target member does not hit any one data subspace in the multidimensional data space, and therefore the target dimension combination cannot hit any one data subspace in the multidimensional data space, and the result value corresponding to each data subspace is determined to be the second flag value. And obtaining a result bitmap corresponding to the target dimension combination based on the result values respectively corresponding to the data subspaces. If the target member with the second index value being the second mark value does not exist in the target dimension combination, the result bitmap corresponding to the target dimension combination is obtained through carrying out logic operation on the index bitmaps respectively corresponding to the target members.
In one embodiment, a first sparse index and a second sparse index corresponding to the multi-dimensional data space are determined while generating the spatial index corresponding to the multi-dimensional data space. And when the second index value corresponding to any one target member in the target dimension combination in the second sparse index is a second mark value, directly determining the result value corresponding to each data subspace as the second mark value, and obtaining a result bitmap corresponding to the target dimension combination. And when no target member with the second index value being the second mark value exists, taking the target dimension of the target member with the corresponding first index value being the second mark value in the first sparse index as the dimension to be calculated based on the first sparse index. And carrying out logic operation on index bitmaps corresponding to the target members corresponding to the dimensions to be calculated in the space indexes to obtain a result bitmap corresponding to the target dimension combination. In this way, the first sparse index and the second sparse index are created while the spatial index is created, and unnecessary calculation processes are reduced based on the first sparse index and the second sparse index together, so that the data query efficiency can be further improved.
In the above embodiment, in order to accelerate the efficiency of data query, the spatial index is created, and at the same time, the second sparse index is created, where the second sparse index may indicate that none of the dimension members of the data subspace is hit. When the target member with the second index value being the second mark value exists in the target dimension combination, the target dimension combination is indicated to not hit any one data subspace in the multidimensional data space, at the moment, the result value corresponding to each data subspace is directly determined to be the second mark value, a result bitmap is obtained, and the result bitmap is not required to be obtained through carrying out logic operation on the index bitmaps corresponding to each target member, so that the efficiency of data query can be effectively improved.
In one embodiment, performing a logical operation on index bitmaps corresponding to each target member in the spatial index to obtain a result bitmap corresponding to the target dimension combination, where the method includes:
When the number of the data subspaces included in the multidimensional data space exceeds the preset number, grouping the data subspaces included in the multidimensional data space to obtain a plurality of subspace sets;
determining subspace indexes corresponding to the subspace sets respectively based on the spatial indexes;
Respectively taking each subspace set as a current subspace set;
obtaining sub-index bitmaps respectively corresponding to each target member in the sub-space indexes corresponding to the current sub-space set;
Performing OR operation on the sub-index bitmaps respectively corresponding to all target members belonging to the same target dimension to respectively obtain sub-dimension bitmaps corresponding to all target dimensions;
sequentially performing AND operation on the sub-dimension bitmaps corresponding to the target dimensions respectively to obtain a sub-result bitmap corresponding to the current subspace set;
And splicing the sub-result bitmaps respectively corresponding to the sub-space sets to obtain a result bitmap corresponding to the target dimension combination.
The preset number can be set according to actual conditions. A subspace set refers to a set of multiple data subspaces.
For example, when the multi-dimensional data space includes more than a preset number of data subspaces, the data subspaces may be grouped to obtain a plurality of subspace sets. For example, as shown in fig. 11, when the number of data subspaces exceeds 128, each 64 data subspaces may be divided into a group to obtain a plurality of subspace sets, so that the index bitmap corresponding to each dimension member is correspondingly segmented into a plurality of sub-index bitmaps, the element values in 1 to 64 rows are divided into the same sub-index bitmap, and the elements in 65 to 128 rows are divided into the same sub-index bitmap. And further, in the space index, determining sub-index bitmaps corresponding to the same dimension members for each sub-space set respectively, and obtaining the sub-index bitmaps corresponding to each dimension member for each sub-space set respectively. And respectively obtaining the subspace indexes corresponding to the subspace sets based on the corresponding sub-index bitmaps of the same subspace set under each dimension member.
The computer device takes each subspace set as a current subspace set respectively. And obtaining sub-index bitmaps respectively corresponding to the target members in the sub-space indexes corresponding to the current sub-space set. And performing OR operation on the sub-index bitmaps respectively corresponding to the target members belonging to the same target dimension to respectively obtain the sub-dimension bitmaps corresponding to the target dimensions. And then, sequentially performing AND operation on the sub-dimension bitmaps corresponding to the target dimensions respectively to obtain a sub-result bitmap corresponding to the current subspace set. Specifically, a first sub-dimension bitmap and a second sub-dimension bitmap are determined in each sub-dimension bitmap, the first sub-dimension bitmap and the second sub-dimension bitmap are subjected to AND operation to obtain an intermediate sub-dimension bitmap, the intermediate sub-dimension bitmap is further used as the first sub-dimension bitmap, the second sub-dimension bitmap is redetermined in the remaining sub-dimension bitmaps corresponding to the current subspace set, and the step of carrying out AND operation on the first sub-dimension bitmap and the second sub-dimension bitmap to obtain the intermediate sub-dimension bitmap is carried out until the end condition is met, so that a sub-result bitmap corresponding to the current subspace set is obtained. The ending condition is that no remaining sub-dimension bitmap exists, that is, the and operation on the sub-dimension bitmaps of each current subspace set is completed, or each result value in the intermediate sub-dimension bitmap is the second flag value. When each result value in the intermediate sub-dimension bitmap is the second mark value, the and operation is not needed to be carried out on the intermediate sub-dimension bitmap, each result value in the sub-result bitmap corresponding to the current subspace set is directly determined to be the second mark value, and therefore the efficiency of calculating the result bitmap can be improved, and the efficiency of data query is improved.
The computer equipment takes each subspace set as the current subspace set respectively, and after obtaining the sub-result bitmaps respectively corresponding to each subspace set, the computer equipment splices the sub-result bitmaps respectively corresponding to each subspace set, and obtains the result bitmaps corresponding to the target dimension combination. In the actual implementation process, the computer equipment can perform parallel processing on each subspace set to obtain the sub-result bitmap corresponding to each subspace set, so that the data query efficiency is improved.
In the above embodiment, when the number of data subspaces included in the multidimensional data space is large, the index bitmaps respectively corresponding to the members in each dimension are segmented, so as to obtain subspace indexes respectively corresponding to the subspace sets. By grouping the data subspaces, a grouping result bitmap can be realized, when an intermediate subspace bitmap with element values being second mark values appears in the process of performing AND operation on the subspace bitmaps corresponding to the previous subspace set, each result value in the subspace result bitmap corresponding to the subspace set is directly determined to be the second mark value, and the process directly jumps to the subspace result bitmap corresponding to the next subspace set. Unnecessary calculation processes can be reduced, computer resources are saved, and data query efficiency is improved.
In one embodiment, determining a query result corresponding to the data query request based on the result bitmap includes:
Determining a data subspace corresponding to a position with a result value of a first mark value in the result bitmap as a target subspace hit by the target dimension combination in the multidimensional data space;
And obtaining a query result corresponding to the data query request based on the target subspace.
Wherein, the target subspace refers to a data subspace hit by the target dimension combination in the multidimensional data space.
The computer device determines a data subspace corresponding to a position in the result bitmap, where the result value is the first marker value, as a target subspace hit by the target dimension combination in the multidimensional data space. And further determining a query result corresponding to the data query request based on the target subspace. When the target dimension combination is a cell, the target dimension combination hit data subspace means that the target dimension combination falls into the data subspace, and when the target dimension combination is a regular data space composed of a plurality of cells, the target dimension combination hit data subspace means that an intersection exists between the target dimension combination and the data subspace.
In the above embodiment, based on the result values corresponding to the respective positions in the result bitmap, the target subspace hit by the target dimension combination in the multidimensional data space can be rapidly and accurately determined, so that the query result corresponding to the data query request is obtained, the data query process can be effectively simplified, and the data query efficiency can be improved.
In a specific embodiment, the data query method provided by the application can be applied to a scenario of multi-dimensional data locking, namely, whether the query data falls into a locked multi-dimensional data space or not before data updating is carried out. The data query method comprises the following steps:
1. creating an index bitmap
The computer device will determine an index bitmap for each respective dimension member based on the regular cubes (i.e., data subspaces) that each respective dimension member hits in the dimension irregular space (i.e., multidimensional data space). Each position in the index bitmap indicates a regular cube, the element value of the same position in each index bitmap is used for indicating a subspace dimension combination corresponding to the corresponding regular cube, if the dimension member hits the regular cube, the element value of the corresponding position in the index bitmap is determined to be 1, and if the dimension member does not hit the regular cube, the element value of the corresponding position in the index bitmap is determined to be 0.
2. Creating all 0 bitmaps and all 1 bitmaps
To expedite data queries, computer devices create a two-level sparse index, including an all 0 bitmap and an all 1 bitmap. Specifically, performing an and operation on each element value in the index bitmap corresponding to each dimension member to obtain a first index value corresponding to each dimension member, and obtaining an all-1 bitmap (i.e., a first sparse index) by using the first index values corresponding to each dimension member. And performing OR operation on each element value in the index bitmap corresponding to each dimension member to obtain second index values corresponding to each dimension member, and obtaining an all-0 bitmap (namely a second sparse index) by the second index values corresponding to each dimension member. For example, the all 0 bit map and the all 1 bit map corresponding to the multidimensional data space in fig. 5 are shown in fig. 12.
3. Data query
When the multidimensional database is updated, the computer equipment acquires a data query request aiming at the multidimensional data space, wherein the data query request carries a target dimension combination corresponding to data to be updated, and the target dimension combination comprises a plurality of target members. First, determining a second index value corresponding to each target member in the all-0 bitmap, and when the target member with the second index value of 0 exists, determining that the target dimension combination does not hit any rule cube, which means that the data to be updated does not fall in the locked multidimensional data space, and performing data updating operation. When no target member with the second index value of 0 exists, determining the target member with the first index value of 0 in the all-1 bitmap, taking the target dimension of the target member with the first index value of 0 as the dimension to be calculated, and further carrying out or operation on the index bitmaps respectively corresponding to all target members belonging to the same dimension to be calculated to obtain the dimension bitmaps respectively corresponding to all the dimensions to be calculated. And performing AND operation on each dimension bitmap to obtain a result bitmap corresponding to the target dimension combination.
In the above embodiment, by creating the index bitmaps respectively corresponding to the members of each dimension, when the data query for the target dimension combination is performed, the index bitmaps respectively corresponding to each target dimension in the target dimension combination are obtained, and then the logical operation is performed on the index bitmaps respectively corresponding to each target member, so that the regular cubes hit by the target dimension combination can be rapidly and accurately determined. However, in a realistic application scenario, the number of all regular cubes constituting the multidimensional irregular space tends to be very large, up to ten thousand or even millions, and the query performance of data query through violent matching is extremely slow. In the scheme, the index bitmap is created, and the logical operation is carried out on the index bitmap, so that the data query process can be effectively simplified, and the data query efficiency is improved. In addition, by adding the two-level sparse indexes, namely the full 0 bitmap and the full 1 bitmap, the query efficiency can be greatly accelerated, unnecessary logic operation is avoided, and the data query efficiency is further improved.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a data query device for realizing the above related data query method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiments of one or more data query devices provided below may refer to the limitation of the data query method hereinabove, and will not be repeated herein.
In one embodiment, as shown in fig. 13, there is provided a data query apparatus, including: a request acquisition module 1302, an index acquisition module 1304, a result bitmap determination module 1306, and a query result determination module 1308, wherein:
a request acquisition module 1302, configured to acquire a data query request for a multidimensional data space; the data query request carries a target dimension combination, wherein the target dimension combination comprises target members respectively corresponding to the data space to be queried in each dimension of the multidimensional data space.
An index obtaining module 1304, configured to obtain a spatial index corresponding to the multidimensional data space; the multidimensional data space comprises a plurality of data subspaces, the space index comprises index bitmaps respectively corresponding to dimension members included in each dimension, each position in the index bitmaps respectively indicates one data subspace, and element values at the same position in each index bitmap are used for indicating subspace dimension combinations corresponding to the corresponding data subspaces.
The result bitmap determining module 1306 is configured to perform a logical operation on index bitmaps corresponding to each target member in the spatial index, so as to obtain a result bitmap corresponding to the target dimension combination.
The query result determining module 1308 is configured to determine a query result corresponding to the data query request based on the result bitmap.
In one embodiment, the index acquisition module 1304 is further configured to:
Taking 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 obtaining the data subspace hit by each dimension member respectively; for any dimension member, determining an element value corresponding to a data subspace hit by the dimension member as a first mark value, determining an element value corresponding to a data subspace missed by the dimension member as a second mark value, and obtaining an index bitmap corresponding to the dimension member based on the element values of the data subspaces for the dimension member; and obtaining a space index corresponding to the multidimensional data space based on the index bitmaps respectively corresponding to the members of each dimension.
In one embodiment, the result bitmap determination module 1306 is further configured to:
Obtaining index bitmaps respectively corresponding to each target member in the spatial index; performing OR operation on index bitmaps respectively corresponding to all target members belonging to the same target dimension to respectively obtain dimension bitmaps corresponding to all target dimensions; performing AND operation on element values corresponding to the same data subspace in each dimension bitmap to obtain result values corresponding to each data subspace; and obtaining a result bitmap corresponding to the target dimension combination based on the result values respectively corresponding to the data subspaces.
In one embodiment, the result bitmap determination module 1306 is further configured to:
Acquiring a first sparse index corresponding to the multidimensional data space; the first sparse index comprises first index values respectively corresponding to dimension members included in each dimension, when each element value in an index bitmap corresponding to the dimension member is a first mark value, the first index value corresponding to the dimension member is a first mark value, and when each element value in the index bitmap corresponding to the dimension member is a second mark value, the first index value corresponding to the dimension member is a second mark value; taking a target dimension of a target member, which corresponds to a first index value which is a second mark value in the first sparse index, as a dimension to be calculated; and carrying out logic operation on index bitmaps corresponding to the target members corresponding to the dimensions to be calculated in the space indexes to obtain a result bitmap corresponding to the target dimension combination.
In one embodiment, the result bitmap determination module 1306 is further configured to:
Acquiring a second sparse index corresponding to the multidimensional data space; the second sparse index comprises second index values respectively corresponding to dimension members included in each dimension, when each element value in an index bitmap corresponding to the dimension member has a first mark value, the second index value corresponding to the dimension member is the first mark value, and when each element value in the index bitmap corresponding to the dimension member is the second mark value, the second index value corresponding to the dimension member is the second mark value; when a second index value corresponding to any target member in the second sparse index is a second mark value, determining that a result value corresponding to each data subspace is the second mark value; and obtaining a result bitmap corresponding to the target dimension combination based on the result values respectively corresponding to the data subspaces.
In one embodiment, the result bitmap determination module 1306 is further configured to:
when the number of the data subspaces included in the multidimensional data space exceeds the preset number, grouping the data subspaces included in the multidimensional data space to obtain a plurality of subspace sets; determining subspace indexes corresponding to the subspace sets respectively based on the spatial indexes; sequentially taking each subspace set as a current subspace set; obtaining sub-index bitmaps respectively corresponding to each target member in the sub-space indexes corresponding to the current sub-space set; performing OR operation on the sub-index bitmaps respectively corresponding to all target members belonging to the same target dimension to respectively obtain sub-dimension bitmaps corresponding to all target dimensions; sequentially performing AND operation on the sub-dimension bitmaps corresponding to the target dimensions respectively to obtain a sub-result bitmap corresponding to the current subspace set; and splicing the sub-result bitmaps respectively corresponding to the sub-space sets to obtain a result bitmap corresponding to the target dimension combination.
In one embodiment, the query result determination module 1308 is further to:
determining a data subspace corresponding to a position with a result value of a first mark value in the result bitmap as a target subspace hit by the target dimension combination in the multidimensional data space; and obtaining a query result corresponding to the data query request based on the target subspace.
According to the data query device, when the data subspace hit by the target dimension combination is queried in the multidimensional data space, index bitmaps respectively corresponding to all target members in the target dimension combination are acquired from the space indexes corresponding to the multidimensional data space. The index bitmap corresponding to the target member may indicate a relationship between the target member and each data subspace, that is, whether the subspace dimension combination corresponding to each data subspace contains the target member. And further, carrying out logic operation on the index bitmaps corresponding to the target members respectively to obtain a result bitmap corresponding to the target dimension combination. The resulting bitmap can accurately indicate the relationship between the target dimension combination and each of the data subspaces in the multidimensional data space, i.e., which data subspaces the target dimension combination hits. By carrying out logic operation on index bitmaps corresponding to each target member in the spatial index, the data query process can be simplified, which data subspaces are hit by the target dimension combination can be rapidly and accurately determined, and the data query efficiency is effectively improved.
The various modules in the data querying device described above may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which may be as shown in fig. 14. The computer device includes a processor, a memory, an Input/Output interface (I/O) and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used for storing data such as target dimension combinations, spatial indexes and the like. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a data query method.
In one embodiment, a computer device is provided, which may be a terminal, and an internal structure diagram thereof may be as shown in fig. 15. The computer device includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input means. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a data query method. The display unit of the computer device is used for forming a visual picture, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be a key, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by persons skilled in the art that the structures shown in fig. 14 and 15 are merely block diagrams of portions of structures associated with aspects of the present application and are not intended to limit the computer apparatus to which aspects of the present application may be applied, and that a particular computer apparatus may include more or less components than those shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, implements the steps of the method embodiments described above.
In one embodiment, a computer program product or computer program is provided that includes computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the above-described method embodiments.
It should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data need to comply with the related laws and regulations and standards of the related country and region.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magneto-resistive random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (PHASE CHANGE Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in various forms such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.

Claims (11)

1. A method of querying data, the method comprising:
Acquiring a data query request aiming at a multidimensional data space; the data query request carries a target dimension combination, wherein the target dimension combination comprises target members respectively corresponding to the data space to be queried in each dimension of the multidimensional data space;
Acquiring a spatial index corresponding to the multidimensional data space; the multi-dimensional data space comprises a plurality of data subspaces, the space index comprises index bitmaps respectively corresponding to dimension members included in each dimension, each position in the index bitmaps respectively indicates one data subspace, and element values at the same position in each index bitmap are used for indicating subspace dimension combinations corresponding to the corresponding data subspaces;
Performing logic operation on index bitmaps corresponding to the target members in the spatial index respectively to obtain a result bitmap corresponding to the target dimension combination;
and determining a query result corresponding to the data query request based on the result bitmap.
2. The method of claim 1, wherein the obtaining the spatial index of the multi-dimensional data space correspondence comprises:
taking 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 obtaining the data subspace hit by each dimension member respectively;
Determining an element value corresponding to a data subspace hit by the dimension member as a first mark value, determining an element value corresponding to a data subspace missed by the dimension member as a second mark value, and obtaining an index bitmap corresponding to the dimension member based on the element values of the data subspace for the dimension member;
and obtaining a spatial index corresponding to the multidimensional data space based on the index bitmaps respectively corresponding to the dimension members.
3. The method of claim 1, wherein performing a logical operation on the index bitmaps corresponding to the target members in the spatial index to obtain the result bitmaps corresponding to the target dimension combinations includes:
obtaining index bitmaps respectively corresponding to the target members in the spatial index;
Performing OR operation on index bitmaps corresponding to the target members belonging to the same target dimension respectively to obtain dimension bitmaps corresponding to the target dimensions respectively;
Performing AND operation on element values corresponding to the same data subspace in each dimension bitmap to obtain result values corresponding to each data subspace;
and obtaining a result bitmap corresponding to the target dimension combination based on the result values respectively corresponding to the data subspaces.
4. The method of claim 1, wherein performing a logical operation on the index bitmaps corresponding to the target members in the spatial index to obtain the result bitmaps corresponding to the target dimension combinations includes:
Acquiring a first sparse index corresponding to the multidimensional data space; the first sparse index comprises first index values respectively corresponding to dimension members included in each dimension, when each element value in an index bitmap corresponding to the dimension member is a first mark value, the first index value corresponding to the dimension member is the first mark value, and when each element value in the index bitmap corresponding to the dimension member is a second mark value, the first index value corresponding to the dimension member is the second mark value;
Taking a target dimension of a target member, which corresponds to the first index value in the first sparse index and is the second mark value, as a dimension to be calculated;
And carrying out logic operation on index bitmaps corresponding to the target members corresponding to the dimensions to be calculated in the space indexes to obtain result bitmaps corresponding to the target dimension combinations.
5. The method of claim 1, wherein performing a logical operation on the index bitmaps corresponding to the target members in the spatial index to obtain the result bitmaps corresponding to the target dimension combinations includes:
Acquiring a second sparse index corresponding to the multidimensional data space; the second sparse index comprises second index values respectively corresponding to dimension members included in each dimension, when a first mark value exists in each element value in an index bitmap corresponding to the dimension member, the second index value corresponding to the dimension member is the first mark value, and when each element value in the index bitmap corresponding to the dimension member is the second mark value, the second index value corresponding to the dimension member is the second mark value;
when a second index value corresponding to any target member in the second sparse index is the second marker value, determining that a result value corresponding to each data subspace is the second marker value;
and obtaining a result bitmap corresponding to the target dimension combination based on the result values respectively corresponding to the data subspaces.
6. The method of claim 1, wherein performing a logical operation on the index bitmaps corresponding to the target members in the spatial index to obtain the result bitmaps corresponding to the target dimension combinations includes:
When the number of the data subspaces included in the multidimensional data space exceeds a preset number, grouping the data subspaces included in the multidimensional data space to obtain a plurality of subspace sets;
determining subspace indexes corresponding to the subspace sets respectively based on the spatial indexes;
Respectively taking each subspace set as a current subspace set;
Obtaining sub-index bitmaps respectively corresponding to the target members in the sub-space indexes corresponding to the current sub-space set;
performing OR operation on the sub-index bitmaps respectively corresponding to the target members belonging to the same target dimension to respectively obtain sub-dimension bitmaps corresponding to the target dimensions;
Sequentially performing AND operation on the sub-dimension bitmaps respectively corresponding to the target dimensions to obtain a sub-result bitmap corresponding to the current subspace set;
And splicing the sub-result bitmaps respectively corresponding to the sub-space sets to obtain the result bitmaps corresponding to the target dimension combinations.
7. The method of any of claims 1-6, wherein determining a query result corresponding to the data query request based on the result bitmap comprises:
Determining a data subspace corresponding to a position with a first mark value as a result value in the result bitmap as a target subspace hit by the target dimension combination in the multidimensional data space;
and obtaining a query result corresponding to the data query request based on the target subspace.
8. A data querying device, the device comprising:
The request acquisition module is used for acquiring a data query request aiming at the multidimensional data space; the data query request carries a target dimension combination, wherein the target dimension combination comprises a plurality of target members respectively corresponding to a data space to be queried in each dimension of the multidimensional data space;
The index acquisition module is used for acquiring a spatial index corresponding to the multidimensional data space; the multi-dimensional data space comprises a plurality of data subspaces, the space index comprises index bitmaps respectively corresponding to dimension members included in each dimension, each position in the index bitmaps respectively indicates one data subspace, and element values at the same position in each index bitmap are used for indicating subspace dimension combinations corresponding to the corresponding data subspaces;
The result bitmap determining module is used for carrying out logic operation on index bitmaps corresponding to the target members in the space indexes respectively to obtain result bitmaps corresponding to the target dimension combinations;
And the query result determining module is used for determining a query result corresponding to the data query request based on the result bitmap.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
11. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
CN202410501166.5A 2024-04-24 Data query method, device, computer equipment and storage medium Pending CN118277417A (en)

Publications (1)

Publication Number Publication Date
CN118277417A true CN118277417A (en) 2024-07-02

Family

ID=

Similar Documents

Publication Publication Date Title
CN109471874A (en) Data analysis method, device and storage medium
CN116522003B (en) Information recommendation method, device, equipment and medium based on embedded table compression
CN117370488A (en) Data processing method, device, electronic equipment and computer readable storage medium
CN116932935A (en) Address matching method, device, equipment, medium and program product
CN118277417A (en) Data query method, device, computer equipment and storage medium
CN116304251A (en) Label processing method, device, computer equipment and storage medium
CN116226202A (en) Multidimensional database query method, multidimensional database query device, computer equipment and storage medium
CN116051345A (en) Image data processing method, device, computer equipment and readable storage medium
CN110032445B (en) Big data aggregation calculation method and device
Li et al. SP-phoenix: a massive spatial point data management system based on phoenix
CN115168409B (en) Data query method and device for database sub-tables and computer equipment
CN116882408B (en) Construction method and device of transformer graph model, computer equipment and storage medium
CN116204541A (en) Multidimensional database updating method, multidimensional database updating device, computer equipment and storage medium
CN116450872B (en) Spark distributed vector grid turning method, system and equipment
CN117435589A (en) Data transfer method, device, computer equipment and storage medium
CN117312653A (en) Service policy determination method, device, computer equipment and storage medium
CN117909550A (en) Query method, query device, computer equipment and storage medium
CN116758144A (en) Method, device, equipment and storage medium for acquiring spherical center coordinates of reflective sphere
CN116909875A (en) Real-time test data generation method, device, computer equipment and storage medium
CN116029026A (en) Model file processing method, device, equipment, storage medium and program product
CN117390011A (en) Report data processing method, device, computer equipment and storage medium
CN118332002A (en) Data query method, device, computer equipment and storage medium
CN117349320A (en) Data processing method, device, computer equipment and storage medium
CN117453957A (en) Resource processing method, device, computer equipment and storage medium
CN118115025A (en) Business target data adjustment method, device, computer equipment, medium and product

Legal Events

Date Code Title Description
PB01 Publication