Table generation method, device, electronic device and storage medium
The method of generating cross-tabs by aggregating data has solved the problem of low cross-tab generation efficiency in the prior art, and an efficient table generation process is realized.
Patent Information
- Application Number
- CN202210514017.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-12
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2042-05-12
AI Technical Summary
The generation efficiency of cross-tabs in the prior art is low, mainly because the process of generating table headers needs to rely on traversal of detailed data.
By obtaining the aggregated data of the table to be generated, data aggregation is performed based on the preset aggregated dimensions, data correspondence between the first dimension data, the second dimension data and the index data are generated, and the second dimension data and the index dimension are aggregated to generate the second header data of the table, and finally a complete table is generated based on the aggregated data.
It improves the efficiency of cross-tab generation, avoids traversing detailed data, and directly uses aggregated data to generate table headers, thereby improving processing speed.
Smart Images

Figure CN114861618B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to a table generation method, device, electronic device and storage medium. Background Art
[0002] With the development of data processing technology, a technology for displaying data using cross tables has emerged. By distributing different dimensions as table headers in the horizontal / vertical directions, the data to be displayed can be displayed at the corresponding intersection of the table headers during the data display process, thereby more intuitively reflecting the relationship between data and dimensions.
[0003] In the related art, the method of generating a cross-tabulation requires merging the same table headers, and filling the metric name into the specified position of the table header during the header merging and generation process. The process of generating the table header is generally implemented by tree search, that is, by traversing the detailed data to merge the data, and then generating the table header. However, this method of generating the table header needs to rely on the traversal of the detailed data, so the generation efficiency of the cross-tabulation is low. Summary of the invention
[0004] The present disclosure provides a table generation method, device, electronic device and storage medium to at least solve the problem of low generation efficiency of cross-table in related technologies. The technical solution of the present disclosure is as follows:
[0005] According to a first aspect of an embodiment of the present disclosure, there is provided a table generating method, comprising:
[0006] Obtaining aggregated data of a table to be generated; the aggregated data is obtained by aggregation based on a preset aggregate dimension, and includes dimension data corresponding to the aggregate dimension and indicator data corresponding to the indicator dimension; the dimension data includes first dimension data corresponding to a first aggregate dimension and second dimension data corresponding to a second aggregate dimension; the first aggregate dimension is used to characterize first header data of the table to be generated;
[0007] Generate a data correspondence between the first dimension data, the second dimension data and the indicator data according to the aggregated data, and aggregate the second dimension data and the indicator dimension to generate second header data of the table to be generated;
[0008] A complete table corresponding to the table to be generated is generated according to the first header data, the second header data and the data correspondence.
[0009] In an exemplary embodiment, the second dimensional data and the indicator dimension are aggregated to generate the second header data of the table to be generated, including: determining the intermediate nodes of the aggregation tree according to the second dimensional data, and determining the leaf nodes of the aggregation tree according to the indicator dimension; obtaining the tree structure of the aggregation tree according to the intermediate nodes and the leaf nodes; and generating the second header data based on the tree structure.
[0010] In an exemplary embodiment, the number of the second aggregation dimensions is multiple; determining the intermediate nodes of the aggregation tree based on the second dimensional data includes: obtaining the hierarchical order of the intermediate nodes corresponding to each of the second aggregation dimensions; arranging and combining the corresponding second dimensional data of each of the second aggregation dimensions according to the hierarchical order of the intermediate nodes to obtain multiple second dimensional data combinations; generating the intermediate nodes based on the multiple second dimensional data combinations.
[0011] In an exemplary embodiment, generating the intermediate node according to the multiple second dimensional data combinations includes: merging the second dimensional data with the same content in the multiple second dimensional data combinations, and arranging the second dimensional data with different contents in a preset order to generate the intermediate node.
[0012] In an exemplary embodiment, after generating the complete table corresponding to the table to be generated, it also includes: in response to a data query request, obtaining table location information matching the data query request; based on the table location information, obtaining target leaf node sorting information matching the data query request; based on the pre-established association relationship between each indicator data and the leaf node sorting information, determining the target indicator data associated with the target leaf node sorting information; according to the data correspondence relationship, obtaining the first dimension data and the second dimension data corresponding to the target indicator data.
[0013] In an exemplary embodiment, the generating of the complete table corresponding to the table to be generated according to the first header data, the second header data and the data correspondence includes: using the first header data and the first dimension data corresponding to the first aggregation dimension to generate the first header data column of the complete table; determining the second header data corresponding to each indicator data according to the data correspondence; using each indicator data and the second header data corresponding to each indicator data to generate the second header data column of the complete table; wherein the number of rows of each indicator data in the second header data column is the same as the number of rows of the first dimension data corresponding to each indicator data in the first header data column; and obtaining the complete table according to the first header data column and the second header data column.
[0014] In an exemplary embodiment, determining the second header data corresponding to each indicator data according to the data correspondence includes: acquiring the second dimension data corresponding to each indicator data according to the data correspondence; and determining the second header data corresponding to each indicator data based on the second dimension data corresponding to each indicator data and the indicator dimension corresponding to each indicator data.
[0015] According to a second aspect of an embodiment of the present disclosure, there is provided a table generating device, including:
[0016] an aggregate data acquisition unit, configured to execute acquisition of aggregate data of a table to be generated; the aggregate data is obtained by aggregation based on a preset aggregate dimension, including dimension data corresponding to the aggregate dimension and indicator data corresponding to the indicator dimension; the dimension data includes first dimension data corresponding to a first aggregate dimension and second dimension data corresponding to a second aggregate dimension; the first aggregate dimension is used to characterize first header data of the table to be generated;
[0017] A second header generating unit is configured to generate a data correspondence between the first dimension data, the second dimension data and the indicator data according to the aggregated data, and aggregate the second dimension data and the indicator dimension to generate second header data of the table to be generated;
[0018] The complete table generating unit is configured to generate a complete table corresponding to the table to be generated according to the first header data, the second header data and the data correspondence relationship.
[0019] In an exemplary embodiment, the second header generation unit is further configured to determine the intermediate nodes of the aggregation tree according to the second dimensional data, and determine the leaf nodes of the aggregation tree according to the indicator dimension; obtain the tree structure of the aggregation tree according to the intermediate nodes and the leaf nodes; and generate the second header data based on the tree structure.
[0020] In an exemplary embodiment, the number of the second aggregation dimensions is multiple; the second header generation unit is further configured to execute obtaining the intermediate node hierarchy order corresponding to each second aggregation dimension; according to the intermediate node hierarchy order, the corresponding second dimension data of each second aggregation dimension are arranged and combined to obtain multiple second dimension data combinations; and the intermediate node is generated according to the multiple second dimension data combinations.
[0021] In an exemplary embodiment, the second header generation unit is further configured to merge the second dimensional data with the same content in the multiple second dimensional data combinations, and arrange the second dimensional data with different contents in a preset order to generate the intermediate node.
[0022] In an exemplary embodiment, the table generation device also includes: a dimensional data query unit, configured to execute in response to a data query request, obtain table location information matching the data query request; based on the table location information, obtain target leaf node sorting information matching the data query request; based on a pre-established association relationship between each indicator data and the leaf node sorting information, determine the target indicator data associated with the target leaf node sorting information; and according to the data correspondence relationship, obtain first dimensional data and second dimensional data corresponding to the target indicator data.
[0023] In an exemplary embodiment, the complete table generation unit is further configured to generate a first header data column of the complete table using the first header data and the first dimension data corresponding to the first aggregation dimension; determine the second header data corresponding to each indicator data according to the data correspondence; generate a second header data column of the complete table using the indicator data and the second header data corresponding to each indicator data; wherein the number of rows of each indicator data in the second header data column is the same as the number of rows of the first dimension data corresponding to each indicator data in the first header data column; and obtain the complete table based on the first header data column and the second header data column.
[0024] In an exemplary embodiment, the complete table generation unit is further configured to execute, according to the data correspondence, obtaining the second dimension data corresponding to each indicator data; based on the second dimension data corresponding to each indicator data and the indicator dimension corresponding to each indicator data, determining the second header data corresponding to each indicator data.
[0025] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the table generation method as described in any one of the embodiments of the first aspect.
[0026] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the table generation method as described in any one of the embodiments in the first aspect.
[0027] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, which includes instructions, characterized in that when the instructions are executed by a processor of an electronic device, the electronic device is enabled to execute the table generation method as described in any one of the embodiments in the first aspect.
[0028] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0029] By acquiring the aggregated data of the table to be generated; the aggregated data is aggregated based on the preset aggregation dimension, including the dimension data corresponding to the aggregation dimension and the indicator data corresponding to the indicator dimension; the dimension data includes the first dimension data corresponding to the first aggregation dimension and the second dimension data corresponding to the second aggregation dimension; the first aggregation dimension is used to characterize the first header data of the table to be generated; according to the aggregated data, the data correspondence relationship between the first dimension data, the second dimension data and the indicator data is generated, and the second dimension data and the indicator dimension are aggregated to generate the second header data of the table to be generated; according to the first header data, the second header data and the data correspondence relationship, a complete table corresponding to the table to be generated is generated. The present disclosure obtains aggregated data for generating a table to be generated, and the aggregated data is obtained by aggregation based on a pre-set aggregation dimension, wherein the aggregation dimension includes a first aggregation dimension and a second aggregation dimension, and the first aggregation dimension can be used to generate first header data, and the second dimension data included in the second aggregation dimension can be aggregated with the indicator dimension to obtain second header data, so that the final complete table can be obtained by utilizing the data correspondence between the indicator data and the first dimension data and the second dimension data, and the generated first header data and second header data. Compared with the traditional technology that needs to generate a header by traversing the detailed data, the present disclosure can directly generate a header by utilizing the aggregated data after the aggregation is completed, without the need to traverse the detailed data, thereby improving the efficiency of table generation.
[0030] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0032] Figure 1 The figure is an application environment diagram of a table generation method according to an exemplary embodiment.
[0033] Figure 2 The figure is a flowchart of a table generating method according to an exemplary embodiment.
[0034] Figure 3 The figure is a flowchart of generating second header data according to an exemplary embodiment.
[0035] Figure 4 It is a schematic diagram of a tree structure of an aggregation tree according to an exemplary embodiment.
[0036] Figure 5 The present invention is a flowchart of determining an intermediate node of an aggregation tree according to an exemplary embodiment.
[0037] Figure 6 The figure is a schematic diagram of a process of generating a tree structure of an aggregation tree according to an exemplary embodiment.
[0038] Figure 7 The figure is a flowchart of obtaining dimension data of target indicator data according to an exemplary embodiment.
[0039] Figure 8 The diagram is a schematic diagram showing construction of an auxiliary index according to an exemplary embodiment.
[0040] Fig. 9 The figure is a flowchart of generating a complete table corresponding to a table to be generated according to an exemplary embodiment.
[0041] Fig.10 The figure is a flowchart of a method for generating a cross table according to an exemplary embodiment.
[0042] Fig.11 The figure is a block diagram of a table generating device according to an exemplary embodiment.
[0043] Fig.12 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0044] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0045] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0046] It should also be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.
[0047] The table generation method provided in the present disclosure can be applied to Figure 1 In the application environment shown. Among them, the terminal 101 interacts with the server 102 through the network. Specifically, the terminal 101 can obtain the aggregated data obtained according to the pre-set aggregation dimension from the database of the server 102, which is used to generate the table aggregation data, and the aggregation data includes the dimension data corresponding to the aggregation dimension, and the indicator data corresponding to the indicator dimension, wherein the aggregation dimension includes the first aggregation dimension and the second aggregation dimension, and the first aggregation dimension can be used to generate the first header data of the table, and at the same time, the aggregation data can represent the data correspondence between the indicator data and the first dimension data and the second dimension data. The terminal 101 can aggregate the second dimension data and the indicator dimension according to the above data correspondence to generate the second header data, and finally the first header data, the second header data and the above data correspondence can be used to generate a complete table. Among them, the terminal 101 can be but not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices, and the server 102 can be implemented by an independent server or a server cluster composed of multiple servers.
[0048] Figure 2 is a flow chart of a table generation method according to an exemplary embodiment. Figure 2 As shown, the table generation method is used in the terminal 101 and includes the following steps.
[0049] In step S201, the aggregated data of the table to be generated is obtained; the aggregated data is obtained based on the preset aggregation dimension, including dimensional data corresponding to the aggregation dimension and indicator data corresponding to the indicator dimension; the dimensional data includes first dimensional data corresponding to the first aggregation dimension and second dimensional data corresponding to the second aggregation dimension; the first aggregation dimension is used to characterize the first header data of the table to be generated.
[0050] Among them, the table to be generated refers to the cross table to be generated, and the aggregated data refers to the data for generating the table to be generated after data aggregation is completed in advance. The aggregated data can be provided by the server 102. The server 102 can aggregate the detailed data stored in the server 102 based on the preset aggregation dimension, which can be preset by the user of the terminal 101, so as to obtain the above-mentioned aggregated data. For example, the server 102 can store the grades of all students in each class in multiple schools. The user can aggregate the grades of all students by taking the school and the class as the aggregation dimension, and obtain the average score or the highest score of each class in each school as the aggregated data. At the same time, the aggregated data can be composed of two parts, namely, the dimension data corresponding to the aggregation dimension and the indicator data representing the indicator dimension. For example, a piece of aggregated data can be school A-class A-average score A, then in the aggregated data, the aggregation dimension is the class, the dimension data corresponding to the aggregation dimension can be class A, the indicator dimension is the average score dimension, and the indicator data can be the average score A. Each piece of aggregated data can be composed of dimension data and indicator data.
[0051] At the same time, the aggregation dimension can further include a first aggregation dimension and a second aggregation dimension, wherein the dimension data corresponding to the first aggregation dimension can be used as the first dimension data, and the dimension data corresponding to the second aggregation dimension can be used as the second dimension data, and the first aggregation dimension and the second aggregation dimension can be selected by the user from the aggregation dimensions according to actual needs. And the first aggregation dimension is the dimension used to generate the first header data in the cross table. This dimension does not need to be crossed with the header, so the first aggregation dimension can be directly used as the first header data, that is, the header of the ordinary data column in the cross table, and the data column of the header is used to display the first dimension data. In addition, in special cases, all aggregation dimensions in the cross table to be generated can be used as second aggregation dimensions.
[0052] In step S202, based on the aggregated data, a data correspondence relationship between the first dimension data, the second dimension data and the indicator data is generated, and the second dimension data and the indicator dimension are aggregated to generate second header data of the table to be generated.
[0053] The second header data refers to the header in the cross data column in the cross table. The possible values of the second aggregation dimension need to be placed in the header for cross-tabulation. The data column in the header is used to display the indicator data. Therefore, the second header data consists of two parts: the dimensional data corresponding to the second aggregation dimension, that is, the second dimensional data, and the indicator dimension of the indicator data.
[0054] Specifically, after obtaining the aggregated data, the terminal 101 can obtain the corresponding relationship between each indicator data and the first dimension data and the second dimension data according to the aggregated data. For example, taking the school dimension as the first aggregation dimension and the class dimension as the second aggregation dimension, for school A-class A-average score A, a corresponding relationship between the indicator data average score A and the first dimension data school A and the second dimension data class A can be established, and for school A-class B-average score B, a corresponding relationship between the indicator data average score B and the first dimension data school A and the second dimension data class B can be established, and the terminal 101 can also aggregate the second dimension data and the indicator dimension to generate the second header data, for example, aggregate the class A and the average score dimension to generate the second header data A, and aggregate the class B and the average score dimension to generate the second header data B, and so on.
[0055] In step S203, a complete table corresponding to the table to be generated is generated according to the first header data, the second header data and the data correspondence relationship.
[0056] Finally, after determining the first header data and the second header data of the table to be generated, the indicator data can be further integrated using the data correspondence between the indicator data and the first dimension data and the second dimension data, thereby generating a complete table.
[0057] For example, as shown in Table 1, Table 1 is an aggregated data query table composed of aggregated data obtained by the terminal 101 in an embodiment. The aggregated data is aggregated by using the date dimension, the location dimension, and the host dimension as aggregation dimensions, while the user number dimension and the active duration dimension can be used as indicator dimensions, wherein the dimension data contained in the date dimension, i.e., the date data includes date A and date B, the dimension data contained in the location dimension, i.e., the location dimension data includes location A and location B, and the dimension data contained in the host dimension, i.e., the host dimension data includes person A, person B, and person C. The user number dimension and the active duration dimension are used as indicator dimensions, and the indicator data of the user number dimension can include the number of users A, the number of users B, the number of users C, the number of users D, and the number of users E, and the indicator data of the active duration dimension can include active duration A, active duration B, active duration C, active duration D, and active duration E.
[0058] Table 1 Aggregate data query table
[0059] Date Dimension Location Dimension Dimension of the host User number dimension Active time dimension Date A Location A Character A Number of usersA Active time A Date A Location A Character B Number of usersB Active time B Date B Location A Character A Number of users C Active time C Date B Location A Character B Number of users D Active time D Date B Location B Character C Number of users Active time E
[0060] If the date dimension is used as the first aggregation dimension, and the location dimension and the organizer dimension are used as the second aggregation dimension, the form of the table to be generated can be shown in Table 2. It can be seen that in Table 2, the date dimension is used as the first header data, and the data column corresponding to the first header data is arranged with date A and date B, while the second header data can include multiple, and all are composed of second dimension data and indicator dimensions, namely location B-person C-number of users dimension, location B-person C-active duration dimension, location A-person A-number of users dimension, location A-person A-active duration dimension, location A-person B-number of users dimension, location A-person B-active duration dimension. At the same time, the data column corresponding to the second header data can be arranged with the above indicator data, that is, the number of users A, the number of users B, the number of users C, the number of users D and the number of users E, and the active duration A, active duration B, active duration C, active duration D and active duration E.
[0061] Table 2 Table to be generated
[0062]
[0063]
[0064] In the above table generation method, the aggregated data of the table to be generated is obtained; the aggregated data is aggregated based on the preset aggregation dimension, including dimensional data corresponding to the aggregation dimension and indicator data corresponding to the indicator dimension; the dimensional data includes first dimensional data corresponding to the first aggregation dimension and second dimensional data corresponding to the second aggregation dimension; the first aggregation dimension is used to characterize the first header data of the table to be generated; according to the aggregated data, the data correspondence relationship between the first dimensional data, the second dimensional data and the indicator data is generated, and the second dimensional data and the indicator dimension are aggregated to generate the second header data of the table to be generated; according to the first header data, the second header data and the data correspondence relationship, a complete table corresponding to the table to be generated is generated. The present disclosure obtains aggregated data for generating a table to be generated, and the aggregated data is obtained by aggregation based on a pre-set aggregation dimension, wherein the aggregation dimension includes a first aggregation dimension and a second aggregation dimension, and the first aggregation dimension can be used to generate first header data, and the second dimension data included in the second aggregation dimension can be aggregated with the indicator dimension to obtain second header data, so that the final complete table can be obtained by utilizing the data correspondence between the indicator data and the first dimension data and the second dimension data, and the generated first header data and second header data. Compared with the traditional technology that needs to generate a header by traversing the detailed data, the present disclosure can directly generate a header by utilizing the aggregated data after the aggregation is completed, without the need to traverse the detailed data, thereby improving the efficiency of table generation.
[0065] In an exemplary embodiment, if Figure 3 As shown, step S202 may further include:
[0066] In step S301, the intermediate nodes of the aggregation tree are determined according to the second dimension data, and the leaf nodes of the aggregation tree are determined according to the indicator dimension.
[0067] Among them, the aggregation tree refers to a tree structure formed by aggregation data, which consists of a root node, an intermediate node, and a leaf node, wherein all nodes share the same root node. In this embodiment, the intermediate nodes of the aggregation tree can be composed of the second dimension data corresponding to each second aggregation dimension, and the leaf nodes can be determined by each indicator dimension. For example, for the location A-person A-number of users A in the aggregation data shown in Table 1, the location A and person A can be used as intermediate nodes, and the user number dimension can be used as a branch of the leaf node. For the location A-person A-active time A, the location A and person A can be used as intermediate nodes, and the active time dimension can be used as a branch of the leaf node. For the aggregation data of location A-person B-number of users C, the location A and person B can be used as intermediate nodes, and the user number dimension can be used as a branch of the leaf node. Through the second dimension data and indicator dimension contained in the above-mentioned aggregation data, multiple intermediate nodes and multiple leaf nodes of the aggregation tree can be determined.
[0068] In step S302, a tree structure of an aggregation tree is obtained according to the intermediate nodes and leaf nodes;
[0069] In step S303, second header data is generated based on the tree structure.
[0070] After the terminal 101 obtains the intermediate nodes and leaf nodes contained in each branch in step S301, it can establish the connection relationship between the intermediate nodes and leaf nodes of each branch, thereby obtaining the tree structure of the aggregation tree, and generate the corresponding second header data according to the tree structure. For example, the tree structure of the aggregation tree generated by the aggregation data shown in Table 1 can be as follows: Figure 4 As shown, the tree structure may include multiple branches, namely, location B-person C-number of users dimension, location B-person C-active duration dimension, location A-person A-number of users dimension, location A-person A-active duration dimension, location A-person B-number of users dimension, location A-person B-active duration dimension. Then, the second header data generated using the tree structure may also be adapted to the tree structure, that is, the second header data as shown in Table 2 is generated.
[0071] In this embodiment, the second dimension data can be used to determine the intermediate nodes of the aggregation tree, and the dimension indicators can be used to determine the corresponding leaf nodes, so that the second header data can be obtained by using the tree structure of the aggregation tree obtained by the intermediate nodes and the leaf nodes. Since the second dimension data is only related to the value range corresponding to the second aggregation dimension, and the indicator dimension is relatively fixed, there is no need to establish a data correspondence relationship between the indicator data and the first dimension data and the second dimension data. Therefore, the terminal 101 can establish the second header data process simultaneously with the server 102 executing the data aggregation process, and there is no need to execute the generation of the second header data after the server 102 obtains the aggregated data, thereby further improving the efficiency of table generation.
[0072] Furthermore, the number of the second aggregation dimensions is multiple; Figure 5 As shown, step S301 may further include:
[0073] In step S501, the hierarchical order of the intermediate nodes corresponding to each second aggregation dimension is obtained.
[0074] In this embodiment, the number of second aggregation dimensions can be multiple. For example, when the second aggregation dimension can include the location dimension and the organizer dimension, the intermediate node can also include multiple levels, where a certain level A can be used to arrange the second dimension data corresponding to the location dimension, and another level B can arrange the second dimension data corresponding to the organizer dimension. The hierarchical order of the intermediate nodes is the hierarchical order of the above-mentioned levels. For example, the intermediate nodes can be sorted according to level A-level B. At this time, the second dimension data corresponding to the location dimension is arranged in the upper layer first, and then the second dimension data corresponding to the organizer dimension is arranged in the lower layer. It can also be sorted according to level B-level A. At this time, the second dimension data corresponding to the organizer dimension is arranged in the upper layer first, and then the second dimension data corresponding to the location dimension is arranged in the lower layer. The above-mentioned hierarchical order of the intermediate nodes can be pre-set in the terminal 101, or it can be set by the user as needed.
[0075] In step S502, the second dimensional data corresponding to each second aggregation dimension are arranged and combined according to the order of the intermediate node levels to obtain a plurality of second dimensional data combinations.
[0076] The second dimensional data combination is a combination of dimensional data obtained by sorting and combining the second dimensional data according to the intermediate node level. For example, when the intermediate node level order is level A-level B, since this order represents that the second dimensional data corresponding to the location dimension is arranged in the upper layer first, and then the second dimensional data corresponding to the hosting person dimension is arranged in the lower layer, the generated second dimensional data combination can be a combination of location A-person A, or location A-person B, etc., and if the intermediate node level order is level B-level A, since this order represents that the second dimensional data corresponding to the hosting person dimension is arranged in the upper layer first, and then the second dimensional data corresponding to the location dimension is arranged in the lower layer, the generated second dimensional data combination can be a combination of person A-location A, or person B-location A, etc.
[0077] In step S503, an intermediate node is generated according to a combination of multiple second dimensional data.
[0078] After all the second dimensional data combinations are determined, the second dimensional data combinations may be integrated to obtain intermediate nodes of the aggregation tree.
[0079] In this embodiment, the user can set the hierarchical order of the intermediate nodes, arrange and combine the second dimensional data, and obtain the second dimensional data combination. Since the second dimensional data combination can be used to generate the intermediate nodes, and the intermediate nodes are used to generate the second header data, the hierarchical order of each second dimensional combination in the second header data can be adapted to the hierarchical order of the intermediate nodes, that is, the user can change the arrangement of the second header data by setting the hierarchical order of the intermediate nodes, thereby further meeting the user's needs for customized sorting of the table.
[0080] Furthermore, step S503 may further include: merging the second dimensional data with the same content in the plurality of second dimensional data combinations, and arranging the second dimensional data with different contents in a preset order to generate an intermediate node.
[0081] Among them, the preset order refers to the arrangement order of the second dimension order set in advance for multiple second dimension data of the same second aggregation dimension. For example, for the dimension data location A and location B contained in the location dimension, the arrangement order can be to place location A before location B, or to place location B before location A. The order can also be set by the user according to actual needs. Specifically, after obtaining each second dimension data combination, the second dimension data contained in each second dimension data combination can be determined. If there is second dimension data with the same content, the same second dimension data will be merged. If the content is different, it can be arranged according to the arrangement order set above to obtain the final intermediate node.
[0082] For example, Figure 6 As shown, the second dimensional data combination obtained in step S502 may include: location A-person A, location A-person B, and location B-person C, where the preset order may be that location B is ranked before location A, and person A is ranked before person B. Then, after location A-person A is obtained, the intermediate nodes in the first branch may be generated in order, and the user number dimension and the active time dimension are respectively connected to the above intermediate nodes as leaf nodes, such as Figure 6 As shown in part 601 of FIG. 1 , terminal 101 can then obtain location A-person B. Since location A has the same intermediate node as location A in the first branch, location A can be merged. At the same time, since person A is ranked before person B, task B can be arranged after the intermediate node of person A in the first branch to form a second branch. At the same time, the user number dimension and the active time dimension are connected to the intermediate node of the second branch as leaf nodes, as shown in FIG. Figure 6 Finally, the terminal 101 obtains the location B-person C, which is the second dimension data with different contents. Since the arrangement order of location B is before location A, the order of this branch can be set before the branch corresponding to location A as the third branch, and the user number dimension and the active time dimension are connected as leaf nodes respectively, thereby forming Figure 6 The tree structure shown in part 603.
[0083] In this embodiment, the intermediate nodes of the aggregation tree are generated by merging the same content and arranging the different contents in order. This process supports concurrent processing and can be applied to clustered processing application scenarios, thereby further improving the efficiency of table generation.
[0084] In addition, if Figure 7 As shown, after step S204, the following steps may also be included:
[0085] In step S701, in response to a data query request, table location information matching the data query request is obtained.
[0086] Among them, the data query request is a query request for querying the first dimension data and the second dimension data matching a certain indicator data. When the user views the generated complete table, he can click on the table position displayed in a certain table to trigger a data query request for the indicator data indicated by the table position. At this time, the terminal 101 can respond to the request to determine the table position information that matches the request, such as the row coordinates and column coordinate information of the grid corresponding to the triggering request.
[0087] In step S702, based on the table location information, the target leaf node sorting information matching the data query request is obtained.
[0088] In this embodiment, the terminal 101 pre-establishes a correspondence between the table position information and the leaf node sorting information, and can pre-establish a correspondence between the table column position and the leaf node sorting information. Since the second header data in this embodiment is generated based on a tree structure, the order of the second header data can be adapted to the sorting of the leaf nodes, as shown in Table 2 and Figure 4 As an example, take the second header data represented by the dimensions of location A-person A-active duration as an example. This column is the fifth column. Figure 4 In the tree structure, it is in the fourth sorting, while the second header data represented by the dimensions of location A-person B-number of users is in the sixth column. Figure 4 It is in the fifth sort in the tree structure in Table 2. It can be seen that by subtracting one from the table column position information, the corresponding leaf node sorting information can be obtained. In this embodiment, after obtaining the table position information, the target leaf node sorting information corresponding to the query request can be obtained based on the conversion relationship between the table position information and the node sorting information.
[0089] In step S703, based on the pre-established association relationship between each indicator data and the leaf node sorting information, the target indicator data associated with the target leaf node sorting information is determined.
[0090] At the same time, this embodiment also establishes an association relationship between each indicator data and leaf node sorting information, for example, it can be as follows Figure 8 As shown, when constructing an aggregation tree, the left and right leaf nodes of the aggregation tree are associated through an array to form an auxiliary index. Therefore, when obtaining the sorting information of the target leaf node, the corresponding array can be found by querying the auxiliary index, and the array can be used to represent the storage location of the indicator data. Therefore, the corresponding indicator data can be obtained according to the above association relationship as the target indicator data.
[0091] In step S704, first dimension data and second dimension data corresponding to the target indicator data are obtained according to the data correspondence relationship.
[0092] Finally, after the target indicator data is determined, the corresponding first dimension data and second dimension data can be queried based on the pre-constructed data correspondence.
[0093] In this embodiment, the data query can be assisted by establishing a correlation between each indicator data and the leaf node sorting information, that is, by constructing an auxiliary index, so as to improve the efficiency of data query.
[0094] In an exemplary embodiment, if Fig. 9 As shown, step S204 may further include:
[0095] In step S901 , the first header data column of the complete table is generated by using the first header data and the first dimension data corresponding to the first aggregation dimension.
[0096] Among them, the first header data column is a data column with the first header data as the header. Since the first header data represents the first aggregation dimension, the data in the first header data column can be obtained by arranging the first dimension data corresponding to the first aggregation dimension. For example, in the table shown in Table 2, the date dimension can be used as the first header data, and the first header data column is formed by the first dimension data contained in the date dimension, namely, date A and date B.
[0097] In step S902, the second header data corresponding to each indicator data is determined according to the data correspondence relationship.
[0098] Since the second header data is composed of the second dimension data and the indicator dimension, and the data correspondence records the correspondence between each indicator data and the second dimension data, the second header data can be obtained according to the above correspondence and the indicator dimension of the indicator data.
[0099] In step S903, each indicator data and the second header data corresponding to each indicator data are used to generate a second header data column of a complete table; wherein the number of rows of each indicator data in the second header data column is the same as the number of rows of the first dimension data corresponding to each indicator data in the first header data column.
[0100] After determining the second header data corresponding to each indicator data, the data correspondence relationship can be further used to fill the indicator data into the corresponding position of the table to be generated, thereby generating a complete table. For example, taking Table 2 as an example, for the indicator data number of users A, the corresponding second header data is the location A-person A-user number dimension, and the data correspondence relationship stores the correspondence between the number of users A and the date A. Therefore, when generating the second header data column, the number of users A can be set in the data column of the second header data represented by the location A-person A-user number dimension, and because the number of users A and the date A have a correspondence relationship, the number of rows of the number of users A in the second header data column can be adapted to the number of rows of the date A in the first header data column. For the number of users E, the corresponding second header data is the location B-person C-user number dimension, and because the number of users E and the date B have a correspondence relationship, the number of rows of the number of users E in the second header data column can be adapted to the number of rows of the date B in the first header data column. Through the above method, the indicator data contained in the aggregated data and the second header data can be used to generate the second header data column of the complete table.
[0101] In step S904, a complete table is obtained according to the first header data column and the second header data column.
[0102] Finally, after obtaining the first header data column in step S901 and the second header data column in step S903, the first header data column and the second header data column may be integrated to obtain a complete table.
[0103] In this embodiment, after obtaining the data correspondence relationship, as well as the first header data and the second header data, the first header data and the second header data can be used to generate corresponding first header data columns and second header data columns respectively, and then the first header data columns and the second header data columns can be used to generate a complete table, thereby improving the accuracy of the generated complete table.
[0104] Furthermore, step S902 may further include: acquiring second dimension data corresponding to each indicator data according to the data correspondence relationship; determining second header data corresponding to each indicator data based on the second dimension data corresponding to each indicator data and the indicator dimension corresponding to each indicator data.
[0105] Specifically, since the data correspondence relationship can store the correspondence relationship between all indicator data and the second dimension data, the second dimension data corresponding to each indicator data can be obtained according to the above correspondence relationship. For example, for the number of users A, the corresponding second dimension data is location A and person A, and for the number of users E, the corresponding second dimension data is location B and person C. In the above manner, the second dimension data corresponding to each indicator data can be obtained. At the same time, the second dimension data corresponding to each indicator data and the indicator dimension corresponding to each indicator data can be integrated to obtain the second header data of each indicator data. For example, for the number of users A, the corresponding indicator dimension is the user number dimension, so the corresponding second header data is the location A-person A-user number dimension, and for the number of users E, the corresponding indicator dimension is the user number dimension, so the corresponding second header data is the location B-person C-user number dimension.
[0106] In this embodiment, the terminal 101 may further determine corresponding second header data according to the second dimension data corresponding to each indicator data and the indicator dimension corresponding to each indicator data, thereby improving the efficiency of obtaining the second header data.
[0107] In an exemplary embodiment, a method for generating a cross table is also provided. The method first obtains dimension aggregate query data through a data query service, then generates a cross table header from the dimension aggregate data based on a merge tree structure, and finally combines the cross table header with the table header to form a complete cross table. Fig.10 As shown, it can include the following 5 main steps:
[0108] 1. Data query: Through SQL aggregate query, the original detailed data is aggregated according to the granularity to be used, the data processing scope is narrowed, and the dimension aggregate query data (referred to as aggregate data) is obtained;
[0109] 2. Data preprocessing: Aggregate data is classified into "normal dimension", "cross dimension" and "indicator column", and ValueMap is generated to record the correspondence between indicators and dimensions;
[0110] 3. Parallel cross-table header processing: Using the characteristics of the merge tree, cross-dimensions and indicators are aggregated into a complete cross-table header. This process supports parallel processing;
[0111] 4. Table data integration: Integrate common dimensions, cross table headers, and ValueMap data to form a complete cross table structure;
[0112] 5. Generate auxiliary index: associate the left and right leaf nodes (i.e., index columns) of MergeTree through a linked list to form an auxiliary index, so as to facilitate traversal of any aggregation dimension of the cross table for chart intercommunication scenarios.
[0113] The specific process of each step is as follows:
[0114] (1) Data query
[0115] In this embodiment, the data used to produce the cross table is not based on the original detailed data, but firstly aggregates the original detailed data according to the granularity to be used through SQL aggregation query. This can narrow the scope of data processing. For example, the detailed data may be hundreds of thousands or millions, but after the dimension set, the order of magnitude of the aggregated data result often drops by several orders of magnitude. On the other hand, this can give full play to the query capability of the database. Common databases have special performance optimization for dimension set calculations, so handing it over to the database for processing can make the best use of its strengths and avoid its weaknesses.
[0116] (2) Data preprocessing
[0117] After obtaining the aggregated data, data preprocessing is required. This step will classify the aggregated data and generate a ValueMap to record the correspondence between indicators and dimensions. The classification is based on the following:
[0118] "Ordinary dimensions", that is, columns that do not require dimension crossing;
[0119] "Cross dimension", that is, the value possibility needs to be placed in the column of the table header for cross;
[0120] The "indicator column", i.e. the numerical column, is the main part of the crosstab;
[0121] First, adjust the order of the aggregated data columns to ensure that they are stored in the order of common dimensions, cross dimensions, and indicator columns. Then, use the union of the common dimension and cross dimension values of each row of data as the key, and the value of each indicator column as the value to build a "ValueMap" and save it in memory. ValueMap is used to generate the body of the cross table.
[0122] (3) Parallel header processing
[0123] This step uses the characteristics of the merge tree to aggregate the cross dimensions and indicators into a complete cross table header. This process supports parallel processing. For ease of description, the following process will first be described as row-by-row serial processing.
[0124] There are two main merge tree features that are used:
[0125] 1. Same item merging: nodes with the same content will be automatically merged and share child nodes;
[0126] 2. Heterogeneous arrangement: For nodes with different contents, parallel brother nodes will be created, and the arrangement order of the brother nodes can be customized.
[0127] Taking the aggregated data in Table 1 as an example, we traverse each row of data and take the cross dimension as the middle path node of the aggregation tree, and take the dimension column as the leaf node: the cross dimension of the first row of data is location A-person A, which is inserted layer by layer with depth priority, and then the two dimension columns of "number of users" and "active time" are inserted in parallel as leaf nodes; the cross dimension of the second row of data is location A-person B, the same location A is merged and shares the child nodes person A and person B, and the leaf nodes are all the same, so no operation is required; the cross dimension of the third row of data is location A-person A, all of which are the same nodes, and the content of the merged tree has not changed; the cross dimension of the fourth row of data is location A-person B, all of which are existing nodes, and the content of the merged tree has not changed. The cross dimension of the fifth row of data is location B-person C, all of which are new content, and new brother nodes are created in sequence. In the sorting rule, the location B order is higher than the location A, so the location B node is on the left. If no sorting rule is specified, it is arranged in the order of content appearance; at this point, the cross header based on the merged tree is produced.
[0128] It should be noted that the merge tree supports merging multiple subtrees into one tree. Therefore, in the scenario of big data, the above processing can be processed concurrently to form multiple sub-merged trees, and then finally aggregated to form a full merged tree. This feature makes this solution easily expandable to clustered processing methods.
[0129] (4) Table data integration
[0130] After generating the cross-table header, it is necessary to integrate the common dimensions, cross-table header, and ValueMap to form a complete cross-table. The specific method is to obtain the common dimensions of the aggregated data row by row, and perform a depth-first traversal on the merged tree of the cross-table header. Combine the common dimensions obtained and the joint key generated by the leaf node path of the merged tree to find the corresponding indicator value in the ValueMap. For example, for the first row of aggregated data, the common dimension is date A, and the first leaf node path of the merged tree is location A-person A-number of users. The joint dimension key is date A-location A-person A, and the indicator value corresponding to the number of users dimension in valueMap is number of users A. Repeating this process will get the numerical content in each cell of the cross-table header.
[0131] (5) Generate auxiliary index
[0132] In order to better adapt to the interactive scene of charts, the cross table needs to support efficient retrieval of value-related dimension information so as to interact with other charts. For example, if you select the value of active duration A in Table 2 (the second to last row, the fifth column), you need to extract its associated dimension information, that is, the date is date A, the location is location A, the organizer is person A, etc. This requires quickly finding the tree path of any leaf node in the merged tree, but it is too costly to trigger a deep traversal of the leaf nodes from the root node of the merged tree each time, so it is necessary to build an auxiliary index to solve this problem.
[0133] First, when constructing a merged tree, the upper and lower nodes are linked by a bidirectional linked list, so it is easy to query from the leaf node to the root node; secondly, the left and right leaf nodes (i.e., index columns) of the merged tree are associated through an array to form an auxiliary index, so that the leaf nodes of any column can be quickly located on the merged tree. With the assistance of the above two indexes, the merged tree in this embodiment is more efficient and flexible in the graph intercommunication scenario.
[0134] Through this embodiment, when generating a cross-table, data aggregation query can be performed, making full use of the computing power of big data technology and supporting massive calculation aggregation; utilizing the merged table feature, the framework supports concurrent processing and is easy to expand in clusters; the merged tree header supports custom sorting rules, and the generated cross-table header is more flexible; at the same time, the cross-table is combined with the auxiliary index, and the dimension traversal is more flexible, supporting multi-chart interactive scenarios.
[0135] It should be understood that, although the various steps in the flowchart of the present disclosure are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the figure may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the steps or stages in other steps.
[0136] It can be understood that the same / similar parts between the various embodiments of the above method in this specification can refer to each other, and each embodiment focuses on the differences from other embodiments. For related points, please refer to the description of other method embodiments.
[0137] Fig.11 is a block diagram of a table generating device according to an exemplary embodiment. Fig.11 The device includes an aggregate data acquisition unit 1101, a second header generation unit 1102 and a complete table generation unit 1103.
[0138] The aggregate data acquisition unit 1101 is configured to execute acquisition of aggregate data of a table to be generated; the aggregate data is obtained by aggregation based on a preset aggregate dimension, including dimension data corresponding to the aggregate dimension and indicator data corresponding to the indicator dimension; the dimension data includes first dimension data corresponding to a first aggregate dimension and second dimension data corresponding to a second aggregate dimension; the first aggregate dimension is used to represent first header data of the table to be generated;
[0139] The second header generating unit 1102 is configured to generate a data correspondence relationship between the first dimension data, the second dimension data and the indicator data according to the aggregated data, and aggregate the second dimension data and the indicator dimension to generate second header data of the table to be generated;
[0140] The complete table generating unit 1103 is configured to generate a complete table corresponding to the table to be generated according to the first header data, the second header data and the data correspondence relationship.
[0141] In an exemplary embodiment, the second header generation unit 1102 is further configured to determine the intermediate nodes of the aggregation tree according to the second dimension data, and determine the leaf nodes of the aggregation tree according to the indicator dimension; obtain the tree structure of the aggregation tree according to the intermediate nodes and the leaf nodes; and generate the second header data based on the tree structure.
[0142] In an exemplary embodiment, the number of second aggregation dimensions is multiple; the second header generation unit 1102 is further configured to execute the acquisition of the intermediate node hierarchy order corresponding to each second aggregation dimension; arrange and combine the corresponding second dimension data of each second aggregation dimension according to the intermediate node hierarchy order to obtain multiple second dimension data combinations; generate intermediate nodes based on the multiple second dimension data combinations.
[0143] In an exemplary embodiment, the second header generation unit 1102 is further configured to merge the second dimensional data with the same content in the plurality of second dimensional data combinations, and arrange the second dimensional data with different contents in a preset order to generate intermediate nodes.
[0144] In an exemplary embodiment, the table generation device also includes: a dimensional data query unit, configured to execute in response to a data query request, obtain table location information matching the data query request; based on the table location information, obtain target leaf node sorting information matching the data query request; based on a pre-established association relationship between each indicator data and the leaf node sorting information, determine the target indicator data associated with the target leaf node sorting information; and according to the data correspondence relationship, obtain first dimensional data and second dimensional data corresponding to the target indicator data.
[0145] In an exemplary embodiment, the complete table generation unit 1103 is further configured to generate a first header data column of the complete table using the first header data and the first dimension data corresponding to the first aggregation dimension; determine the second header data corresponding to each indicator data according to the data correspondence; generate a second header data column of the complete table using each indicator data and the second header data corresponding to each indicator data; wherein the number of rows of each indicator data in the second header data column is the same as the number of rows of the first dimension data corresponding to each indicator data in the first header data column; and obtain a complete table based on the first header data column and the second header data column.
[0146] In an exemplary embodiment, the complete table generation unit 1103 is further configured to execute, according to the data correspondence relationship, obtaining the second dimension data corresponding to each indicator data; based on the second dimension data corresponding to each indicator data and the indicator dimension corresponding to each indicator data, determining the second header data corresponding to each indicator data.
[0147] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0148] Fig.12 1 is a block diagram of an electronic device 1200 for table generation according to an exemplary embodiment. For example, the electronic device 1200 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0149] Reference Fig.12 , the electronic device 1200 may include one or more of the following components: a processing component 1202 , a memory 1204 , a power component 1206 , a multimedia component 1208 , an audio component 1210 , an input / output (I / O) interface 1212 , a sensor component 1214 , and a communication component 1216 .
[0150] The processing component 1202 generally controls the overall operation of the electronic device 1200, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 1202 may include one or more processors 1220 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 1202 may include one or more modules to facilitate the interaction between the processing component 1202 and other components. For example, the processing component 1202 may include a multimedia module to facilitate the interaction between the multimedia component 1208 and the processing component 1202.
[0151] The memory 1204 is configured to store various types of data to support operations on the electronic device 1200. Examples of such data include instructions for any application or method operating on the electronic device 1200, contact data, phone book data, messages, pictures, videos, etc. The memory 1204 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a magnetic disk, an optical disk, or a graphene memory.
[0152] The power supply component 1206 provides power to the various components of the electronic device 1200. The power supply component 1206 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 1200.
[0153] The multimedia component 1208 includes a screen that provides an output interface between the electronic device 1200 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1208 includes a front camera and / or a rear camera. When the electronic device 1200 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0154] The audio component 1210 is configured to output and / or input audio signals. For example, the audio component 1210 includes a microphone (MIC), and when the electronic device 1200 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal may be further stored in the memory 1204 or sent via the communication component 1216. In some embodiments, the audio component 1210 also includes a speaker for outputting an audio signal.
[0155] I / O interface 1212 provides an interface between processing component 1202 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0156] The sensor assembly 1214 includes one or more sensors for providing various aspects of status assessment for the electronic device 1200. For example, the sensor assembly 1214 can detect the open / closed state of the electronic device 1200, the relative positioning of components, such as the display and keypad of the electronic device 1200, and the sensor assembly 1214 can also detect changes in the position of the electronic device 1200 or components of the electronic device 1200, the presence or absence of user contact with the electronic device 1200, the orientation or acceleration / deceleration of the device 1200, and the temperature change of the electronic device 1200. The sensor assembly 1214 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 1214 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1214 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0157] The communication component 1216 is configured to facilitate wired or wireless communication between the electronic device 1200 and other devices. The electronic device 1200 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 1216 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1216 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0158] In an exemplary embodiment, the electronic device 1200 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0159] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 1204 including instructions, and the above instructions can be executed by the processor 1220 of the electronic device 1200 to perform the above method. For example, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0160] In an exemplary embodiment, a computer program product is further provided. The computer program product includes instructions. The instructions can be executed by the processor 1220 of the electronic device 1200 to complete the above method.
[0161] It should be noted that the above-mentioned devices, electronic devices, computer-readable storage media, computer program products, etc. may also include other implementation methods according to the description of the method embodiments. The specific implementation methods can refer to the description of the relevant method embodiments, which will not be described one by one here.
[0162] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0163] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A table generation method, characterized in that: include: Obtaining aggregated data of a table to be generated; the aggregated data is obtained by aggregation based on a preset aggregation dimension, including dimension data corresponding to the aggregation dimension and indicator data corresponding to the indicator dimension; the dimension data includes first dimension data corresponding to a first aggregation dimension and second dimension data corresponding to a second aggregation dimension; the first aggregation dimension is used to characterize first header data of the table to be generated; the aggregated data is pre-aggregated data and is used to generate data of the table to be generated; According to the aggregated data, a data correspondence relationship between the first dimension data, the second dimension data and the indicator data is generated, and the second dimension data and the indicator dimension are aggregated to generate second header data of the table to be generated; including: determining the intermediate node of the aggregation tree according to the second dimension data, and determining the leaf node of the aggregation tree according to the indicator dimension; obtaining the tree structure of the aggregation tree according to the intermediate node and the leaf node; and generating the second header data based on the tree structure; A complete table corresponding to the table to be generated is generated according to the first header data, the second header data and the data correspondence.
2. The method according to claim 1, characterized in that The number of the second aggregation dimensions is multiple; The determining the intermediate node of the aggregation tree according to the second dimension data includes: Obtaining the hierarchical order of the intermediate nodes corresponding to each of the second aggregation dimensions; Arranging and combining the second dimension data corresponding to each second aggregation dimension according to the intermediate node hierarchy order to obtain a plurality of second dimension data combinations; The intermediate node is generated according to the plurality of second dimension data combinations.
3. The method according to claim 2, characterized in that The step of generating the intermediate node according to the plurality of second dimension data combinations includes: The second dimensional data with the same content in the plurality of second dimensional data combinations are merged, and the second dimensional data with different contents are arranged in a preset order to generate the intermediate node.
4. The method according to claim 1, characterized in that: After generating the complete table corresponding to the table to be generated, the method further includes: In response to a data query request, obtaining table location information matching the data query request; Based on the table location information, obtaining the target leaf node sorting information that matches the data query request; Based on the pre-established association relationship between each indicator data and the leaf node sorting information, determine the target indicator data associated with the target leaf node sorting information; According to the data correspondence, the first dimension data and the second dimension data corresponding to the target indicator data are obtained.
5. The method according to claim 1, characterized in that The generating a complete table corresponding to the table to be generated according to the first table header data, the second table header data and the data correspondence relationship includes: Generate a first header data column of the complete table by using the first header data and the first dimension data corresponding to the first aggregation dimension; According to the data correspondence, determine the second header data corresponding to each indicator data; Generate a second header data column of the complete table using the indicator data and the second header data corresponding to the indicator data; wherein the number of rows of the indicator data in the second header data column is the same as the number of rows of the first dimension data corresponding to the indicator data in the first header data column; The complete table is obtained according to the first header data column and the second header data column.
6. The method according to claim 5, characterized in that Determining the second header data corresponding to each indicator data according to the data correspondence relationship includes: According to the data correspondence, obtain the second dimension data corresponding to each indicator data; Based on the second dimension data corresponding to each indicator data and the indicator dimension corresponding to each indicator data, the second header data corresponding to each indicator data is determined.
7. A table generating device, characterized in that: include: An aggregated data acquisition unit is configured to execute acquisition of aggregated data of a table to be generated; the aggregated data is aggregated based on a preset aggregate dimension, and includes dimension data corresponding to the aggregate dimension and indicator data corresponding to the indicator dimension; the dimension data includes first dimension data corresponding to a first aggregate dimension and second dimension data corresponding to a second aggregate dimension; the first aggregate dimension is used to characterize first header data of the table to be generated; the aggregated data is pre-aggregated data, and is used to generate data of the table to be generated; The second header generating unit is configured to generate a data correspondence relationship between the first dimension data, the second dimension data and the indicator data according to the aggregated data, and aggregate the second dimension data and the indicator dimension to generate the second header data of the table to be generated; further configured to determine the intermediate nodes of the aggregation tree according to the second dimension data, and determine the leaf nodes of the aggregation tree according to the indicator dimension; and obtain the tree structure of the aggregation tree according to the intermediate nodes and the leaf nodes; Based on the tree structure, generating the second header data; The complete table generating unit is configured to generate a complete table corresponding to the table to be generated according to the first header data, the second header data and the data correspondence relationship.
8. The device according to claim 7, characterized in that The number of the second aggregation dimensions is multiple; the second header generation unit is further configured to execute acquisition of the intermediate node hierarchy order corresponding to each second aggregation dimension; arrange and combine the second dimension data corresponding to each second aggregation dimension according to the intermediate node hierarchy order to obtain multiple second dimension data combinations; generate the intermediate node according to the multiple second dimension data combinations.
9. The device according to claim 8, characterized in that The second header generation unit is further configured to merge the second dimensional data with the same content in the plurality of second dimensional data combinations, and arrange the second dimensional data with different contents in a preset order to generate the intermediate node.
10. The device according to claim 7, characterized in that Also includes: A dimension data query unit, configured to execute in response to a data query request and obtain table location information matching the data query request; Based on the table location information, the target leaf node sorting information that matches the data query request is obtained; based on the pre-established association relationship between each indicator data and the leaf node sorting information, the target indicator data associated with the target leaf node sorting information is determined; according to the data correspondence relationship, the first dimension data and the second dimension data corresponding to the target indicator data are obtained.
11. The device according to claim 7, characterized in that The complete table generation unit is further configured to generate a first header data column of the complete table using the first header data and the first dimension data corresponding to the first aggregation dimension; determine the second header data corresponding to each indicator data according to the data correspondence; generate a second header data column of the complete table using the indicator data and the second header data corresponding to each indicator data; wherein the number of rows of each indicator data in the second header data column is the same as the number of rows of the first dimension data corresponding to each indicator data in the first header data column; and obtain the complete table according to the first header data column and the second header data column.
12. The device according to claim 11, characterized in that The complete table generation unit is further configured to execute, according to the data correspondence, obtaining the second dimension data corresponding to each indicator data; based on the second dimension data corresponding to each indicator data and the indicator dimension corresponding to each indicator data, determining the second header data corresponding to each indicator data.
13. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the table generation method according to any one of claims 1 to 6.
14. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the table generating method according to any one of claims 1 to 6.
15. A computer program product, comprising instructions, characterized in that: When the instructions are executed by a processor of an electronic device, the electronic device is enabled to execute the table generating method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Report generation method and system, computer equipment and storage medium
CN112765159A