Data pivoting method and device

By querying preset dimensions in the data source and generating a dimension tree, the problem that the existing technology cannot connect to the database aggregation operation results is solved, and efficient data pivot analysis and display are achieved.

CN112883023BActive Publication Date: 2025-03-18BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201911200925.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-11-29
Publication Date
2025-03-18
Estimated Expiration
2039-11-29

AI Technical Summary

Technical Problem

The prior art cannot connect and analyze the aggregation results of the database with the pivot table, which limits the function and efficiency of the pivot.

Method used

By querying the preset row dimensions, column dimensions and indicator dimensions in the data source, row nodes and column nodes are generated, and row aggregation tree and column aggregation tree are established based on the dependent relationship of the dimensions, so as to realize perspective analysis of the database aggregation operation results.

Benefits of technology

It realizes dynamic updates and real-time display of database aggregation operations results, enhances the function and efficiency of data pivot, and can display various dimension values ​​and their aggregation operations results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112883023B_ABST
    Figure CN112883023B_ABST
Patent Text Reader

Abstract

The present invention discloses a data pivot method and device, and relates to the field of computer technology. A specific implementation of the method includes: using preset row dimension names, column dimension names, and indicator dimension names to query in a data source to obtain at least one initial record; generating a row node containing key-value pair data with any row dimension value in the initial record as a key and the indicator dimension value in the initial record as a value from each initial record, and establishing a row aggregation tree according to the subordinate relationship of the row dimension value in the key-value pair data from the generated row node; generating a column node containing key-value pair data with any column dimension value in the initial record as a key and the indicator dimension value in the initial record as a value from each initial record, and establishing a column aggregation tree according to the subordinate relationship of the column dimension value in the key-value pair data from the generated column node; and displaying the row aggregation tree and the column aggregation tree. This implementation can perform pivot analysis on the aggregation operation results of the database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a data perspective method and device. Background Art

[0002] Pivot refers to displaying the results of certain aggregate calculations in a two-dimensional table based on the set row dimension, column dimension, and indicator dimension (i.e., value dimension), such as summing, calculating the minimum value, calculating the maximum value, etc. Pivot is an interactive data display process that can dynamically update the calculation results and display them in real time based on changes in the row dimension, column dimension, and indicator dimension. The Pivot Table in Excel (an office software) is a commonly used Pivot tool, but its disadvantage is that it cannot establish a connection with the database and cannot perform pivot analysis based on the aggregate calculation results of the database. Summary of the invention

[0003] In view of this, an embodiment of the present invention provides a data pivoting method and device, which can perform pivoting analysis on the aggregation operation results of a database.

[0004] To achieve the above objective, according to one aspect of the present invention, a data perspective method is provided.

[0005] The data pivot method of the embodiment of the present invention includes: using at least one preset row dimension name, at least one column dimension name and at least one indicator dimension name to query in the data source to obtain at least one initial record; wherein each initial record includes a row dimension value, a column dimension value and an indicator dimension value corresponding to the row dimension value and the column dimension value; when there are multiple row dimensions, each row dimension is at a different level, and the row dimensions of adjacent levels have a subordinate relationship; when there are multiple column dimensions, each column dimension is at a different level, and the column dimensions of adjacent levels have a subordinate relationship; generating at least one row node containing key-value pair data with any row dimension value in the initial record as a key and the indicator dimension value in the initial record as a value from each initial record, and establishing a row aggregation tree according to the subordinate relationship of the row dimension values ​​in the key-value pair data from the generated row node; generating at least one column node containing key-value pair data with any column dimension value in the initial record as a key and the indicator dimension value in the initial record as a value from each initial record, and establishing a column aggregation tree according to the subordinate relationship of the column dimension values ​​in the key-value pair data from the generated column node; and displaying the row aggregation tree and the column aggregation tree.

[0006] Optionally, any node in the row aggregation tree is generated by at least one row node, the key of any node is the same as the key of the at least one row node, and the value of any node is obtained by aggregation calculation of the value of the at least one row node in a preset manner; any node in the column aggregation tree is generated by at least one column node, the key of any node is the same as the key of the at least one column node, and the value of any node is obtained by aggregation calculation of the value of the at least one column node in the preset manner.

[0007] Optionally, any node in the row aggregation tree further contains a single row of aggregation data corresponding to any column dimension value; wherein the single row of aggregation data is the aggregation calculation result of the indicator dimension value corresponding to the column dimension value in the node row dimension value.

[0008] Optionally, the single-row aggregate data corresponding to any column dimension value contained in any node in the row aggregation tree is obtained according to the following steps: each column dimension, the node row dimension and its high-level row dimension are determined as target dimensions; the subordinate relationship between the row dimensions and the subordinate relationship between the column dimensions in the target dimension are maintained and the highest-level column dimension is placed at the next level of the lowest-level row dimension to form a target subordinate relationship; a target node containing key-value pair data with any target dimension value in the initial record as the key and the indicator dimension value in the initial record as the value is generated from each initial record, and a target tree is established by the generated target nodes according to the target subordinate relationship; wherein, any node in the target tree is generated by at least one target node, the key of any node is the same as the key of the at least one target node, and the value of any node is obtained by the aggregation calculation of the value of the at least one target node in a preset manner; a node whose key is the row dimension value of any node in the row aggregation tree is queried in the target tree, a node whose key is the value of any column dimension is obtained in the downstream nodes of the queried node, and the value of the obtained node is determined as the single-row aggregate data.

[0009] Optionally, the row aggregation tree, column aggregation tree and target tree are all multi-layer nested JSON data, and the preset method includes at least one of the following: summing, calculating the maximum value, and calculating the minimum value.

[0010] To achieve the above objective, according to another aspect of the present invention, a data perspective device is provided.

[0011] The data pivot device of the embodiment of the present invention may include: a source data acquisition unit, which is used to query in the data source by using at least one preset row dimension name, at least one column dimension name and at least one indicator dimension name to obtain at least one initial record; wherein each initial record includes a row dimension value, a column dimension value and an indicator dimension value corresponding to the row dimension value and the column dimension value; when there are multiple row dimensions, each row dimension is at a different level, and the row dimensions of adjacent levels have a subordinate relationship; when there are multiple column dimensions, each column dimension is at a different level, and the column dimensions of adjacent levels have a subordinate relationship; a row aggregation tree establishment unit, which is used to At least one row node containing key-value pair data with any row dimension value in the initial record as the key and the indicator dimension value in the initial record as the value is generated from each initial record, and a row aggregation tree is established from the generated row node according to the subordinate relationship of the row dimension values ​​in the key-value pair data; a column aggregation tree establishment unit is used to generate at least one column node containing key-value pair data with any column dimension value in the initial record as the key and the indicator dimension value in the initial record as the value from each initial record, and a column aggregation tree is established from the generated column node according to the subordinate relationship of the column dimension values ​​in the key-value pair data; a drawing unit is used to display the row aggregation tree and the column aggregation tree.

[0012] Optionally, any node in the row aggregation tree is generated by at least one row node, the key of any node is the same as the key of the at least one row node, and the value of any node is obtained by aggregation calculation of the value of the at least one row node in a preset manner; any node in the column aggregation tree is generated by at least one column node, the key of any node is the same as the key of the at least one column node, and the value of any node is obtained by aggregation calculation of the value of the at least one column node in the preset manner.

[0013] Optionally, any node in the row aggregation tree further contains a single row of aggregation data corresponding to any column dimension value, and the single row of aggregation data is the aggregation calculation result of the indicator dimension value corresponding to the column dimension value at the node row dimension value; and the device further includes a single row aggregation data calculation unit, which is used to calculate the single row aggregation data according to the following steps: determine each column dimension, the node row dimension and its high-level row dimension as the target dimension; maintain the subordinate relationship between the row dimensions and the subordinate relationship between the column dimensions in the target dimension and place the highest-level column dimension at the next level of the lowest-level row dimension to form a target subordinate relationship; generate a key from each initial record containing any target dimension value in the initial record as the key and the indicator dimension value in the initial record as the value The target node of the value pair data is established by the generated target nodes according to the target subordinate relationship; wherein, any node in the target tree is generated by at least one target node, the key of any node is the same as the key of the at least one target node, and the value of any node is obtained by the value of the at least one target node through aggregation calculation in a preset manner; in the target tree, a node whose key is the row dimension value of any node in the row aggregation tree is queried, and a node whose key is the any column dimension value is obtained in the downstream nodes of the queried node, and the value of the obtained node is determined as the single-row aggregation data; and the row aggregation tree, column aggregation tree and target tree are all multi-layer nested JSON data, and the preset method includes at least one of the following: summing, calculating the maximum value, and calculating the minimum value.

[0014] To achieve the above objective, according to another aspect of the present invention, an electronic device is provided.

[0015] An electronic device of the present invention comprises: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the data perspective method provided by the present invention.

[0016] To achieve the above objective, according to yet another aspect of the present invention, a computer-readable storage medium is provided.

[0017] A computer-readable storage medium of the present invention stores a computer program, and when the program is executed by a processor, the data perspective method provided by the present invention is implemented.

[0018] According to the technical solution of the present invention, one embodiment of the above invention has the following advantages or beneficial effects:

[0019] First, it can support one or more databases, use the database as a data source and use the preset row dimension name, column dimension name and indicator dimension name to query to obtain the initial record. After that, a row node with the row dimension value as the key is generated according to each initial record to establish a row aggregation tree, and a column node with the column dimension value as the key is generated to establish a column aggregation tree. In the process of establishing the row aggregation tree and the column aggregation tree, the row nodes with the same key and the column nodes with the same key are merged and the aggregation operation is performed at the same time, and the operation results are stored as value data in the corresponding nodes. Finally, the row aggregation tree and the column aggregation tree are displayed using the front-end rendering method, so that the subordinate relationship between each dimension value and the dimension value can be displayed, and the aggregation operation result of each row dimension value (that is, the aggregation operation result of each row dimension value relative to all column dimension values) and the aggregation operation result of each column dimension value (that is, the aggregation operation result of each column dimension value relative to all row dimension values) can be displayed.

[0020] Secondly, on the basis of displaying the aggregation operation results of each row dimension value and each column dimension value, the present invention can further display the aggregation operation results of the indicator dimension value corresponding to any column dimension value in any row dimension value. Specifically, first select the target dimension and determine the subordinate relationship between the target dimensions, then convert the initial record into a target node with any target dimension value as the key to establish a target tree, and finally query the node corresponding to the row dimension value from the target tree, and determine the node corresponding to the column dimension value in its downstream node (i.e., descendant node), and the value of the node is the above-mentioned aggregation operation result. Through the above settings, the aggregation operation results at the intersection of any row dimension value and any column dimension value in the two-dimensional table can be displayed, thereby achieving a better data pivot function.

[0021] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific implementation examples. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0023] Figure 1 It is a schematic diagram of the main steps of the data pivot method according to an embodiment of the present invention;

[0024] Figure 2 is a schematic diagram of a row aggregation tree structure according to an embodiment of the present invention;

[0025] Figure 3 is a schematic diagram of a column aggregation tree structure according to an embodiment of the present invention;

[0026] Figure 4 is a schematic diagram of a target tree structure according to an embodiment of the present invention;

[0027] Figure 5It is a schematic diagram of components of a data perspective device according to an embodiment of the present invention;

[0028] Figure 6 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;

[0029] Figure 7 It is a schematic diagram of the structure of an electronic device used to implement the data perspective method in an embodiment of the present invention. DETAILED DESCRIPTION

[0030] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0031] It should be pointed out that the embodiments of the present invention and the technical features therein may be combined with each other without conflict.

[0032] Figure 1 Schematic diagram of main steps of the method according to an embodiment of the present invention.

[0033] like Figure 1 As shown, the data pivoting method of the embodiment of the present invention can be specifically performed according to the following steps:

[0034] Step S101: query in a data source using at least one preset row dimension name, at least one column dimension name, and at least one indicator dimension name to obtain at least one initial record.

[0035] In this step, the row dimension, column dimension, and indicator dimension are all original dimensions in the data source, and the data source can be various databases or data warehouses. Generally, the row dimension, column dimension, and indicator dimension can be determined according to user selection. Each initial record may include row dimension values, column dimension values, and indicator dimension values ​​corresponding to the row dimension values ​​and column dimension values. In practical applications, each initial record includes data for each row dimension and column dimension selected by the user, and data for each indicator dimension corresponding to these data, and the initial record can be stored in list format.

[0036] In the above row dimensions, if there are multiple row dimensions, each row dimension is at a different level, and the row dimensions at adjacent levels have a subordinate relationship; if there are multiple column dimensions, each column dimension is at a different level, and the column dimensions at adjacent levels have a subordinate relationship. For example, if there are three row dimensions: country, province, and city (all three are row dimension names), the levels of the three can generally be set to gradually decrease, such as setting the level of the country dimension to 3, the level of the province dimension to 2, and the level of the city dimension to 1. At this time, for the province dimension, the country dimension and the city dimension are dimensions of adjacent levels, among which the country dimension is its high-level dimension (also the previous level dimension), and the city dimension is its low-level dimension (also the next level dimension). There is a subordinate relationship between the province dimension and the country dimension, and between the province dimension and the city dimension (taking the province dimension and the country dimension as an example, for any value of the province dimension, there must be a value in the country dimension that includes the value of the province dimension. At this time, the two have a subordinate relationship. The country dimension can be called the parent dimension or upstream dimension of the province dimension, and the province dimension is the child dimension or downstream dimension of the country dimension). It can be seen that for two dimensions that have a subordinate relationship, there is generally also a subordinate relationship between the dimension values ​​of the two dimensions.

[0037] The following introduces a specific example of data pivoting, and the rest of the data pivoting method of the embodiment of the present invention will be mainly explained through this example. In this example, the row dimensions are province and city, and the column dimensions are company and employee. The values ​​of the province dimension are Shanxi and Shandong, the values ​​of the city dimension are Taiyuan, Datong (both belong to Shanxi), Jinan, Qingdao (both belong to Shandong), the values ​​of the company dimension are A and B, the values ​​of the employee dimension are a, b (both belong to A), c, d (both belong to B), and the indicator dimension is workload. It can be understood that there can be multiple indicator dimensions, and the present invention is not limited to this. By querying the data source, the initial records are as follows (each row in Table 1 is an initial record):

[0038] Table 1

[0039] Shanxi Taiyuan A a 12 Shanxi Datong A a 9 Shandong Jinan A a 7 Shandong Qingdao A a 10 Shanxi Taiyuan A b 11 Shanxi Datong A b 8 Shandong Jinan A b 6 Shandong Jinan B c 13 Shandong Qingdao B c 9 Shanxi Datong B c 9 Shanxi Datong B d 15 Shandong Qingdao B d 14

[0040] Step S102: Generate at least one row node from each initial record, which contains key-value pair data with any row dimension value in the initial record as the key and the indicator dimension value in the initial record as the value, and establish a row aggregation tree based on the generated row nodes according to the subordinate relationship of the row dimension values ​​in the key-value pair data.

[0041] In this step, at least one row node is first generated for each initial record, and each row node includes a key-value pair data, wherein the key is any row dimension value of the initial record (i.e., the initial record that generates the row node), and the value is the indicator dimension value of the initial record. Therefore, for any initial record, the number of row nodes that can be generated is equal to the total number of row dimensions in the initial record. For example, each initial record in Table 1 can generate two row nodes. For the first record, the key-value pair data of one row node generated is (Shanxi, 12), and the key-value pair data of the other row node is (Taiyuan, 12). In addition, in the following description, the key of the row node refers to the key in the key-value pair data in the row node, the value of the row node refers to the value in the key-value pair data in the row node, and the row dimension value of the row node refers to the row dimension value corresponding to the key of the key-value pair data in the row node. At the same time, the row node can also be identified by its row dimension value. For example, the Shanxi row node refers to the row node whose row dimension value is Shanxi.

[0042] After obtaining the row nodes, a row aggregation tree with a tree structure can be established according to the subordinate relationship between the row dimension values ​​of the row nodes. In practical applications, the above tree structure can be a TreeMap (a mapping based on a tree structure), which can be represented using the JS object notation JSON (JavaScript Object Notation) format. In the row aggregation tree, any node is generated by at least one row node, and the key of any node is the same as the key of each row node that generates the node. The value of any node is obtained by the aggregation calculation of the value of the row node that generates the node in a preset manner. The above preset method can be determined by user selection, and can be summation, counting, calculating the maximum value, calculating the minimum value, calculating the average value, etc. The following will be explained using summation as an example.

[0043] In a specific application scenario, each row node is added to the row aggregation tree one by one. If a node with the same key as the row node to be added already exists in the current row aggregation tree, the node is combined with the row node to be added into one node. The key of the combined node is the same as the two, and the value is the aggregate calculation result of the two values ​​(such as the sum of the two values); if there is no node with the same key as the row node to be added in the current row aggregation tree, the row node to be added is added to the parent dimension value node of the current row aggregation tree according to the subordinate relationship of the row dimension value of the row node to be added (such as the parent dimension value of the row dimension value of the row node to be added), and its key-value pair data remains unchanged; if there is no node with the same key as the row node to be added in the current row aggregation tree, and there is no parent dimension value node, it is added to the root node (root node), and its key-value pair data remains unchanged. In some embodiments, to avoid calculation errors that may be caused when different row nodes have the same key, the global name of the row node to be added can be compared with the global name of the node in the current row aggregation tree when establishing the row aggregation tree to determine the joining method. The above global name is composed of the row dimension value of the node and its upstream node (i.e., the parent node, ancestor node, etc., the high-level node in the same path, excluding the root node). For example, the global name of the Taiyuan row node is Shanxi-Taiyuan.

[0044] Figure 2 Schematic diagram of the row aggregation tree structure of an embodiment of the present invention. Figure 2 As shown, the Shanxi node (i.e., the node with Shanxi as the key) is composed of multiple Shanxi row nodes, and the value of this node is the aggregation result of the Shanxi row dimension value relative to all column dimension values; the Shandong row node is composed of multiple Shandong row nodes, and the value of this node is the aggregation result of the Shandong row dimension value relative to all column dimension values; the Taiyuan row node is composed of multiple Taiyuan row nodes, and the value of this node is the aggregation result of the Taiyuan row dimension value relative to all column dimension values; the Datong row node is composed of multiple Datong row nodes, and the value of this node is the aggregation result of the Datong row dimension value relative to all column dimension values; the Jinan row node is composed of multiple Jinan row nodes, and the value of this node is the aggregation result of the Jinan row dimension value relative to all column dimension values; the Qingdao row node is composed of multiple Qingdao row nodes, and the value of this node is the aggregation result of the Qingdao row dimension value relative to all column dimension values.

[0045] Step S103: Generate at least one column node from each initial record, which contains key-value pair data with any column dimension value in the initial record as the key and the indicator dimension value in the initial record as the value, and establish a column aggregation tree based on the subordinate relationship of the column dimension values ​​in the key-value pair data.

[0046] In this step, at least one column node is first generated for each initial record, and each column node includes a key-value pair data, wherein the key is any column dimension value of the initial record (i.e., the initial record that generates the column node), and the value is the indicator dimension value of the initial record. Therefore, for any initial record, the number of column nodes that can be generated is equal to the total number of column dimensions in the initial record. For example, each initial record in Table 1 can generate two column nodes. For the first record, the key-value pair data of one column node generated is (A, 12), and the key-value pair data of the other column node is (a, 12). In addition, in the following description, the key of a column node refers to the key in the key-value pair data in the column node, the value of a column node refers to the value in the key-value pair data in the column node, and the column dimension value of a column node refers to the column dimension value corresponding to the key of the key-value pair data in the column node. At the same time, a column node can also be identified by its column dimension value, for example, a column node refers to a column node with a column dimension value of a.

[0047] After obtaining the column nodes, a row aggregation tree with a tree structure can be established according to the subordinate relationship between the column dimension values ​​of the column nodes. In practical applications, the above tree structure can be a TreeMap, which can be represented in JSON format. In the column aggregation tree, any node is generated by at least one column node, and the key of any node is the same as the key of each column node that generates the node. The value of any node is obtained by the aggregation calculation of the value of the column node that generates the node in a preset manner. The above preset method can be determined by user selection, which can be summation, counting, calculation of maximum value, calculation of minimum value, calculation of average value, etc.

[0048] In a specific application scenario, each column node can be added to the column aggregation tree one by one. If there is already a node with the same key as the column node to be added in the current column aggregation tree, the node is combined with the column node to be added into one node, and the key of the combined node is the same as the two, and the value is the aggregate calculation result of the two values ​​(such as the sum of the two values); if there is no node with the same key as the column node to be added in the current column aggregation tree, the column node to be added is added under the parent dimension value node of the current column aggregation tree according to the subordinate relationship of the column dimension value of the column node to be added (such as the parent dimension value of the column dimension value of the column node to be added), and its key-value pair data remains unchanged; if there is no node with the same key as the column node to be added in the current column aggregation tree, and there is no parent dimension value node, it is added under the root node (root node), and its key-value pair data remains unchanged. In some embodiments, in order to avoid calculation errors that may be caused when different column nodes have the same key, when establishing the column aggregation tree, the global name of the column node to be added can be compared with the global name of the node in the current column aggregation tree to determine the joining method, and the above global name is composed of the column dimension value of the node and its upstream node. For example, the global name of the node in column a is A——a.

[0049] Figure 3 Schematic diagram of the column aggregation tree structure of an embodiment of the present invention. Figure 3 As shown, the A node (i.e., the node with key A) is composed of multiple A column nodes, and the value of this node is the aggregation result of the A column dimension value relative to all row dimension values; the B node is composed of multiple B column nodes, and the value of this node is the aggregation result of the B column dimension value relative to all row dimension values; the a node is composed of multiple a column nodes, and the value of this node is the aggregation result of the a column dimension value relative to all row dimension values; the b node is composed of multiple b column nodes, and the value of this node is the aggregation result of the b column dimension value relative to all row dimension values; the c node is composed of multiple c column nodes, and the value of this node is the aggregation result of the c column dimension value relative to all row dimension values; the d node is composed of multiple d column nodes, and the value of this node is the aggregation result of the d column dimension value relative to all row dimension values.

[0050] It is understandable that the above step S103 and step S102 can be executed in any order or simultaneously, and the present invention does not limit the execution order of the two steps.

[0051] On the basis of obtaining the global aggregation results of each row dimension value and each column dimension value through the above steps, in order to improve the effect of data perspective analysis, as a preferred solution, the aggregation results of each row dimension value corresponding to each column dimension value can also be calculated. In an embodiment of the present invention, a single row of aggregation data can be added to each node of the row aggregation tree to represent the aggregation results of each row dimension value corresponding to each column dimension value. Specifically, for any node of the row aggregation tree, its single row of aggregation data refers to the aggregation results of the row dimension value of the node relative to each column dimension value. It can be seen that the single row of aggregation data of any node is generally multidimensional data, and the number of dimensions of the multidimensional data is equal to the number of column dimension values. For example, for Figure 2 The Taiyuan node in , its single row aggregate data is the aggregation result of the Taiyuan row dimension value relative to each column dimension value, which is 6-dimensional data (because the total number of column dimension values ​​is 6).

[0052] Preferably, in the embodiment of the present invention, any node of the row aggregation tree (hereinafter referred to as the first node, for example) can be obtained by the following steps: Figure 2The first step is to determine each column dimension, the first node row dimension, and the high-level row dimension of the first node row dimension (including the previous row dimension, the next previous row dimension, etc.) as the target dimension, maintain the subordinate relationship between the row dimensions and the column dimensions in the target dimension, and place the highest-level column dimension at the next level of the lowest-level row dimension to form a target subordinate relationship. For example, when the first node row dimension is the province, the target dimensions are province, company, and employee, and the target subordinate relationship is (from high level to low level) province-company-employee; when the first node row dimension is the city, the target dimensions are province, city, company, and employee, and the target subordinate relationship is (from high level to low level) province-city-company-employee. It can be understood that the target subordination also includes the subordination between dimension values, such as the subordination between Shanxi and Taiyuan, the subordination between A and a, and the subordination between Taiyuan and A (in the "province-city-company-employee" subordination, the city dimension and the company dimension have a subordination relationship, and the values ​​of the city dimension and the values ​​of the company dimension can be considered to have a subordination relationship).

[0053] In the second step, a target node containing key-value pair data with any target dimension value in the initial record as the key and the indicator dimension value in the initial record as the value is generated from each initial record, and a target tree is established from the generated target nodes according to the target subordination relationship. In the target tree, any node is generated from at least one target node, the key of any node is the same as the key of the at least one target node, and the value of any node is obtained by aggregating the values ​​of the at least one target node in a preset manner.

[0054] Figure 4 Schematic diagram of the target tree structure of an embodiment of the present invention. Figure 4 As mentioned above, in this scenario, it is necessary to calculate Figure 2 For a single row of aggregated data of the Taiyuan node in Table 1, the target dimensions are province, city, company and employee, and the target affiliation is province-city-company-employee. An initial record in Table 1 can generate 4 target nodes. For example, for the first initial record in Table 1, the four target nodes generated are (Shanxi, 12), (Taiyuan, 12), (A, 12), and (a, 12). After obtaining the target node, a target tree can be established through the target node in a manner similar to the generation of the row aggregation tree and the column aggregation tree. Different from the generation of the row aggregation tree and the column aggregation tree, in the target node whose key is the column field value generated by any initial record, the low-level target node is only subordinate to the high-level target node therein, but not to the high-level target node generated by other initial records, and the highest-level target node whose key is the column field value is subordinate to the lowest-level target node generated by the initial record whose key is the row dimension value.

[0055] Taking the first and second initial records in Table 1 as an example, the target nodes generated by the first initial record are (Shanxi, 12), (Taiyuan, 12), (A, 12), (a, 12), where (a, 12) is subordinate to (A, 12), and (A, 12) is subordinate to (Taiyuan, 12). The target nodes generated by the second initial record are (Shanxi, 9), (Datong, 9), (A, 9), (a, 9), where (a, 9) is subordinate to (A, 9), and (A, 9) is subordinate to (Datong, 9). (a, 12) generated by the first initial record is not subordinate to (A, 9) generated by the second initial record, and (a, 9) generated by the second initial record is not subordinate to (A, 12) generated by the first initial record.

[0056] The third step is to determine the node whose key is the first node row dimension value in the established target tree (i.e. Figure 4 The values ​​of its downstream nodes (i.e., descendant nodes) can form a single row of aggregated data for the first node. Figure 4 In the example, the downstream nodes of the Taiyuan node are (A, 23), (a, 12), and (b, 11), so the single-row aggregated data of the first node is (23, 12, 11), where 23 is the aggregated result of the first node corresponding to the dimension value of column A, 12 is the aggregated result of the first node corresponding to the dimension value of column a, and 11 is the aggregated result of the first node corresponding to the dimension value of column b. The above steps can be used to determine the single-row aggregated data of each node in the row aggregation tree.

[0057] Understandably, if you need to calculate Figure 2 For a single row of aggregated data at the Zhongshan West node, the target dimensions are province, company, and employee, and the generated target tree is a three-layer tree result (excluding the root node) established according to province-company-employee. In addition, in specific applications, the breadth-first traversal method can be used to query nodes in the row aggregation tree, column aggregation tree, and target tree to improve query efficiency.

[0058] Step S104: Display the row aggregation tree and the column aggregation tree.

[0059] In this step, the existing data drawing method or rendering method can be used to display the row aggregation tree and the column aggregation tree, so as to display the tree structure in the row aggregation tree and the column aggregation tree (including the subordinate relationship between the dimensions and the subordinate relationship between the dimension values), the aggregation result of each row dimension value relative to all column dimension values ​​(that is, the value of each node of the row aggregation tree), the aggregation result of each column dimension value relative to all row dimension values ​​(that is, the value of each node of the column aggregation tree), and the aggregation result of any row dimension value relative to any column dimension value (that is, the single-row aggregation data of the row aggregation tree node) to the user, so as to realize the full-dimensional data perspective analysis. In the actual application scenario, the element table (a drawing tool) component can be used and the row aggregation tree and the column aggregation tree can be drawn and displayed using the lazy loading method.

[0060] In the technical solution of the embodiment of the present invention, one or more databases can be supported, and the database is used as a data source and the preset row dimension name, column dimension name and indicator dimension name are used for query to obtain the initial record. Thereafter, a row node with the row dimension value as the key is generated according to each initial record to establish a row aggregation tree, and a column node with the column dimension value as the key is generated to establish a column aggregation tree. In the process of establishing the row aggregation tree and the column aggregation tree, the row nodes with the same key and the column nodes with the same key are merged and the aggregation operation is performed at the same time, and the operation results are stored as value data in the corresponding nodes. Finally, the row aggregation tree and the column aggregation tree are displayed using the front-end rendering method, so that each dimension value and the subordinate relationship between the dimension values ​​can be displayed, and the aggregation operation results of each row dimension value and the aggregation operation results of each column dimension value can be displayed at the same time. On the basis of displaying the aggregation operation results of each row dimension value and each column dimension value, the present invention can further display the aggregation operation results of the indicator dimension value corresponding to any column dimension value in any row dimension value. Specifically, first select the target dimension and determine the subordinate relationship between the target dimensions, then convert the initial record into a target node with any target dimension value as the key to establish a target tree, and finally query the node corresponding to the row dimension value from the target tree, and determine the node corresponding to the column dimension value in its downstream node, and the value of the node is the above-mentioned aggregation operation result. Through the above settings, the aggregation operation result at the intersection of any row dimension value and any column dimension value in the two-dimensional table can be displayed, thereby achieving a better data pivot function.

[0061] It should be noted that, for the convenience of description, the aforementioned method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the present invention is not limited by the described action sequence, and some steps can actually be performed in other sequences or simultaneously. In addition, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily necessary to implement the present invention.

[0062] In order to better implement the above-mentioned solution of the embodiment of the present invention, relevant devices for implementing the above-mentioned solution are also provided below.

[0063] See also Figure 5 As shown, the data pivoting device 500 provided by the embodiment of the present invention may include: a source data acquiring unit 501 , a row aggregation tree establishing unit 502 , a column aggregation tree establishing unit 503 and a drawing unit 504 .

[0064] Among them, the source data acquisition unit 501 can be used to query in the data source using at least one preset row dimension name, at least one column dimension name and at least one indicator dimension name to obtain at least one initial record; wherein each initial record includes a row dimension value, a column dimension value and an indicator dimension value corresponding to the row dimension value and the column dimension value; when there are multiple row dimensions, each row dimension is at a different level, and the row dimensions of adjacent levels have a subordinate relationship; when there are multiple column dimensions, each column dimension is at a different level, and the column dimensions of adjacent levels have a subordinate relationship.

[0065] The row aggregation tree establishment unit 502 can be used to generate at least one row node containing key-value pair data with any row dimension value in the initial record as the key and the indicator dimension value in the initial record as the value from each initial record, and the generated row node establishes a row aggregation tree according to the subordinate relationship of the row dimension values ​​in the key-value pair data; the column aggregation tree establishment unit 503 can be used to generate at least one column node containing key-value pair data with any column dimension value in the initial record as the key and the indicator dimension value in the initial record as the value from each initial record, and the generated column node establishes a column aggregation tree according to the subordinate relationship of the column dimension values ​​in the key-value pair data; the drawing unit 504 can be used to display the row aggregation tree and the column aggregation tree.

[0066] In actual applications, any node in the row aggregation tree is generated by at least one row node, the key of any node is the same as the key of the at least one row node, and the value of any node is obtained by aggregating and calculating the value of the at least one row node in a preset manner; any node in the column aggregation tree is generated by at least one column node, the key of any node is the same as the key of the at least one column node, and the value of any node is obtained by aggregating and calculating the value of the at least one column node in the preset manner.

[0067] As a preferred solution, any node in the row aggregation tree further contains a single row of aggregation data corresponding to any column dimension value, and the single row of aggregation data is the aggregation calculation result of the indicator dimension value corresponding to the column dimension value on the row dimension value of the node; the device further includes a single row of aggregation data calculation unit, which can be used to calculate the single row of aggregation data according to the following steps: determine each column dimension, the row dimension of the node and its high-level row dimension as the target dimension; maintain the subordinate relationship between the row dimensions and the subordinate relationship between the column dimensions in the target dimension and place the highest-level column dimension at the next level of the lowest-level row dimension to form a target subordinate relationship; generate a single row of aggregation data containing the following from each initial record: The target node of the key-value pair data with any target dimension value in the initial record as the key and the indicator dimension value in the initial record as the value, establishes a target tree by the generated target nodes according to the target subordinate relationship; wherein, any node in the target tree is generated by at least one target node, the key of any node is the same as the key of the at least one target node, and the value of any node is obtained by aggregation calculation of the value of the at least one target node in a preset manner; in the target tree, query the node whose key is the row dimension value of any node in the row aggregation tree, obtain the node whose key is the any column dimension value in the downstream nodes of the queried node, and determine the value of the obtained node as the single row aggregation data.

[0068] In addition, in an embodiment of the present invention, the row aggregation tree, column aggregation tree and target tree are all multi-layer nested JSON data, and the preset method includes at least one of the following: summing, calculating the maximum value, and calculating the minimum value.

[0069] In the technical solution of the embodiment of the present invention, one or more databases can be supported, and the database is used as a data source and the preset row dimension name, column dimension name and indicator dimension name are used for query to obtain the initial record. Thereafter, a row node with the row dimension value as the key is generated according to each initial record to establish a row aggregation tree, and a column node with the column dimension value as the key is generated to establish a column aggregation tree. In the process of establishing the row aggregation tree and the column aggregation tree, the row nodes with the same key and the column nodes with the same key are merged and the aggregation operation is performed at the same time, and the operation results are stored as value data in the corresponding nodes. Finally, the row aggregation tree and the column aggregation tree are displayed using the front-end rendering method, so that each dimension value and the subordinate relationship between the dimension values ​​can be displayed, and the aggregation operation results of each row dimension value and the aggregation operation results of each column dimension value can be displayed at the same time. On the basis of displaying the aggregation operation results of each row dimension value and each column dimension value, the present invention can further display the aggregation operation results of the indicator dimension value corresponding to any column dimension value in any row dimension value. Specifically, first select the target dimension and determine the subordinate relationship between the target dimensions, then convert the initial record into a target node with any target dimension value as the key to establish a target tree, and finally query the node corresponding to the row dimension value from the target tree, and determine the node corresponding to the column dimension value in its downstream node, and the value of the node is the above-mentioned aggregation operation result. Through the above settings, the aggregation operation result at the intersection of any row dimension value and any column dimension value in the two-dimensional table can be displayed, thereby achieving a better data pivot function.

[0070] Figure 6 An exemplary system architecture 600 to which the data pivoting method or data pivoting apparatus according to the embodiment of the present invention can be applied is shown.

[0071] like Figure 6 As shown, the system architecture 600 may include terminal devices 601, 602, 603, a network 604 and a server 605 (this architecture is only an example, and the components included in the specific architecture may be adjusted according to the specific application). The network 604 is used to provide a medium for a communication link between the terminal devices 601, 602, 603 and the server 605. The network 604 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0072] The user can use the terminal devices 601, 602, 603 to interact with the server 605 through the network 604 to receive or send messages, etc. Various client applications can be installed on the terminal devices 601, 602, 603, such as a data perspective application (only an example).

[0073] The terminal devices 601 , 602 , and 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.

[0074] The server 605 may be a server that provides various services, such as a database server (only an example) that supports pivot-type applications operated by users using the terminal devices 601, 602, and 603. The database server may process the received data query request and feed back the processing result (such as the queried data - only an example) to the terminal devices 601, 602, and 603.

[0075] It should be noted that the data perspective method provided in the embodiment of the present invention is generally executed by the terminal devices 601 , 602 , and 603 , and accordingly, the data perspective device is generally arranged in the terminal devices 601 , 602 , and 603 .

[0076] It should be understood that Figure 6 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0077] The present invention also provides an electronic device. The electronic device of the embodiment of the present invention comprises: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the data perspective method provided by the present invention.

[0078] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of an electronic device suitable for implementing an embodiment of the present invention. Figure 7 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0079] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the computer system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0080] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed so that a computer program read therefrom is installed into the storage section 708 as needed.

[0081] In particular, according to the embodiments disclosed in the present invention, the process described in the main step diagram above can be implemented as a computer software program. For example, the embodiments of the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the main step diagram. In the above embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit 701, the above functions defined in the system of the present invention are executed.

[0082] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0083] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0084] The units involved in the embodiments of the present invention may be implemented by software or hardware. The units described may also be set in a processor, for example, may be described as: a processor includes a source data acquisition unit, a row aggregation tree establishment unit, a column aggregation tree establishment unit and a drawing unit. The names of these units do not constitute a limitation on the unit itself in some cases, for example, the source data acquisition unit may also be described as "a unit that provides initial records to the row aggregation tree establishment unit and the column aggregation tree establishment unit".

[0085] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by the device, the steps executed by the device include: querying in the data source using at least one preset row dimension name, at least one column dimension name, and at least one indicator dimension name to obtain at least one initial record; generating at least one row node containing key-value pair data with any row dimension value in the initial record as the key and the indicator dimension value in the initial record as the value from each initial record, and establishing a row aggregation tree according to the subordinate relationship of the row dimension value in the key-value pair data from the generated row node; generating at least one column node containing key-value pair data with any column dimension value in the initial record as the key and the indicator dimension value in the initial record as the value from each initial record, and establishing a column aggregation tree according to the subordinate relationship of the column dimension value in the key-value pair data from the generated column node; displaying the row aggregation tree and the column aggregation tree.

[0086] In the technical solution of the embodiment of the present invention, one or more databases can be supported, and the database is used as a data source and the preset row dimension name, column dimension name and indicator dimension name are used for query to obtain the initial record. Thereafter, a row node with the row dimension value as the key is generated according to each initial record to establish a row aggregation tree, and a column node with the column dimension value as the key is generated to establish a column aggregation tree. In the process of establishing the row aggregation tree and the column aggregation tree, the row nodes with the same key and the column nodes with the same key are merged and the aggregation operation is performed at the same time, and the operation results are stored as value data in the corresponding nodes. Finally, the row aggregation tree and the column aggregation tree are displayed using the front-end rendering method, so that each dimension value and the subordinate relationship between the dimension values ​​can be displayed, and the aggregation operation results of each row dimension value and the aggregation operation results of each column dimension value can be displayed at the same time. On the basis of displaying the aggregation operation results of each row dimension value and each column dimension value, the present invention can further display the aggregation operation results of the indicator dimension value corresponding to any column dimension value in any row dimension value. Specifically, first select the target dimension and determine the subordinate relationship between the target dimensions, then convert the initial record into a target node with any target dimension value as the key to establish a target tree, and finally query the node corresponding to the row dimension value from the target tree, and determine the node corresponding to the column dimension value in its downstream node, and the value of the node is the above-mentioned aggregation operation result. Through the above settings, the aggregation operation result at the intersection of any row dimension value and any column dimension value in the two-dimensional table can be displayed, thereby achieving a better data pivot function.

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

Claims

1. A data pivot method, characterized in that: include: Using at least one preset row dimension name, at least one column dimension name, and at least one indicator dimension name, query in a data source to obtain at least one initial record; Each initial record includes a row dimension value, a column dimension value, and an indicator dimension value corresponding to the row dimension value and the column dimension value; when there are multiple row dimensions, each row dimension is at a different level, and the row dimensions at adjacent levels have a subordinate relationship; when there are multiple column dimensions, each column dimension is at a different level, and the column dimensions at adjacent levels have a subordinate relationship; At least one row node containing key-value pair data with any row dimension value in the initial record as the key and the indicator dimension value in the initial record as the value is generated from each initial record, and a row aggregation tree is established from the generated row nodes according to the subordinate relationship of the row dimension values ​​in the key-value pair data; Generate at least one column node containing key-value pair data with any column dimension value in the initial record as the key and the indicator dimension value in the initial record as the value from each initial record, and establish a column aggregation tree from the generated column nodes according to the subordinate relationship of the column dimension values ​​in the key-value pair data; And, the row aggregation tree and the column aggregation tree are displayed.

2. The method according to claim 1, characterized in that Any node in the row aggregation tree is generated by at least one row node, the key of the any node is the same as the key of the at least one row node, and the value of the any node is obtained by aggregating and calculating the value of the at least one row node in a preset manner; Any node in the column aggregation tree is generated by at least one column node, the key of any node is the same as the key of the at least one column node, and the value of any node is obtained by aggregation calculation of the value of the at least one column node in the preset manner.

3. The method according to claim 2, characterized in that Any node in the row aggregation tree further contains a single row of aggregation data corresponding to any column dimension value; wherein the single row of aggregation data is the aggregation calculation result of the indicator dimension value corresponding to the column dimension value on the node row dimension value.

4. The method according to claim 3, characterized in that The single row of aggregated data corresponding to any column dimension value contained in any node in the row aggregation tree is obtained according to the following steps: Determine each column dimension, the node row dimension and its high-level row dimension as the target dimension; maintain the subordinate relationship between the row dimensions and the subordinate relationship between the column dimensions in the target dimension and place the highest-level column dimension at the next level of the lowest-level row dimension to form a target subordinate relationship; A target node containing key-value pair data with any target dimension value in the initial record as the key and the indicator dimension value in the initial record as the value is generated from each initial record, and a target tree is established from the generated target nodes according to the target subordinate relationship; wherein any node in the target tree is generated by at least one target node, the key of any node is the same as the key of the at least one target node, and the value of any node is obtained by aggregating and calculating the value of the at least one target node in a preset manner; In the target tree, query the node whose key is the row dimension value of any node in the row aggregation tree, obtain the node whose key is the any column dimension value in the downstream node of the queried node, and determine the value of the obtained node as the single row aggregation data.

5. The method according to claim 4, characterized in that The row aggregation tree, column aggregation tree and target tree are all multi-layer nested JSON data, and the preset method includes at least one of the following: summing, calculating the maximum value, and calculating the minimum value.

6. A data perspective device, characterized in that: include: A source data acquisition unit, used to query in a data source using at least one preset row dimension name, at least one column dimension name, and at least one indicator dimension name to obtain at least one initial record; Each initial record includes a row dimension value, a column dimension value, and an indicator dimension value corresponding to the row dimension value and the column dimension value; when there are multiple row dimensions, each row dimension is at a different level, and the row dimensions at adjacent levels have a subordinate relationship; when there are multiple column dimensions, each column dimension is at a different level, and the column dimensions at adjacent levels have a subordinate relationship; A row aggregation tree building unit, used to generate at least one row node containing key-value pair data with any row dimension value in the initial record as the key and the indicator dimension value in the initial record as the value from each initial record, and to build a row aggregation tree from the generated row nodes according to the subordinate relationship of the row dimension values ​​in the key-value pair data; A column aggregation tree building unit, used to generate at least one column node containing key-value pair data with any column dimension value in the initial record as the key and the indicator dimension value in the initial record as the value from each initial record, and to build a column aggregation tree from the generated column nodes according to the subordinate relationship of the column dimension values ​​in the key-value pair data; A drawing unit is used to display the row aggregation tree and the column aggregation tree.

7. The device according to claim 6, characterized in that Any node in the row aggregation tree is generated by at least one row node, the key of the any node is the same as the key of the at least one row node, and the value of the any node is obtained by aggregating and calculating the value of the at least one row node in a preset manner; Any node in the column aggregation tree is generated by at least one column node, the key of any node is the same as the key of the at least one column node, and the value of any node is obtained by aggregation calculation of the value of the at least one column node in the preset manner.

8. The device according to claim 7, characterized in that Any node in the row aggregation tree further contains a single row of aggregation data corresponding to any column dimension value, and the single row of aggregation data is an aggregation calculation result of the indicator dimension value corresponding to the column dimension value on the row dimension value of the node; and the device further includes a single row of aggregation data calculation unit, which is used to calculate the single row of aggregation data according to the following steps: Determine each column dimension, the node row dimension and its high-level row dimension as the target dimension; maintain the subordinate relationship between the row dimensions and the subordinate relationship between the column dimensions in the target dimension and place the highest-level column dimension at the next level of the lowest-level row dimension to form a target subordinate relationship; A target node containing key-value pair data with any target dimension value in the initial record as the key and the indicator dimension value in the initial record as the value is generated from each initial record, and a target tree is established from the generated target nodes according to the target subordinate relationship; wherein any node in the target tree is generated by at least one target node, the key of any node is the same as the key of the at least one target node, and the value of any node is obtained by aggregating and calculating the value of the at least one target node in a preset manner; Querying in the target tree a node whose key is a row dimension value of any node in the row aggregation tree, obtaining a node whose key is any column dimension value in a downstream node of the queried node, and determining the value of the obtained node as the single row aggregation data; Furthermore, the row aggregation tree, column aggregation tree and target tree are all multi-layer nested JSON data, and the preset method includes at least one of the following: summing, calculating the maximum value, and calculating the minimum value.

9. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Method and system for establishing global positioning system (GPS) database for data warehouse of business intelligence system

    CN102629253A

  • Uncertain incast traffic aggregation method based on multidimensional minimized grouping

    CN105847160A