Memory-based multidimensional model roll-up calculation method, system, medium and device
Through the memory-based multi-dimensional model volume-up calculation method, the performance problems of ClickHouse distributed architecture in high data volume and low latency scenarios are solved, and more efficient data aggregation and system expansion are achieved, improving system availability and maintainability sex.
Patent Information
- Application Number
- CN202410656428.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-24
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-05-24
AI Technical Summary
ClickHouse's classic distributed architecture is in real-time analysis scenarios of more than 100 million data volume and low latency. There are large consumption of network IO, disk IO and CPU threads, complex coordination among nodes, the slowest node affects cluster performance, and the increase in data transmission volume. System slowdown and other problems.
The memory-based multi-dimensional model volume-up calculation method is adopted. By obtaining dimension information and filling in data, the number of loops between the summary nodes and leaf nodes is calculated to obtain the summary order, and dynamic thread traversal is performed on the data one by one based on this order to reduce data transmission and Node coordination.
It reduces the network IO, disk IO and CPU thread consumption of the database server, improves the availability and maintainability of the system, simplifies the horizontal expansion process, and reduces the operation and maintenance costs.
Smart Images

Figure CN118535592B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of data processing, and in particular relates to a memory-based multidimensional model roll-up calculation method, system, medium and device. Background Art
[0002] With the widespread application of Internet technology and the increasing prominence of the core value of data, more and more companies use ClickHouse to handle large-scale real-time data queries and multi-dimensional analysis needs, including obtaining intuitive and high-value summary data. Although the ClickHouse database itself provides column storage and powerful grouping functions, under the demand for real-time analysis scenarios with a growth scale of more than 100 million and low latency, we will inevitably pay attention to its distributed cluster function and its efficiency.
[0003] ClickHouse's classic distributed architecture uses the "distributed table + local table" strategy, which consumes a lot of network IO, disk IO, and database threads. In addition, there are "barrel principle" restrictions on the performance configuration of each local table, and there are the following problems:
[0004] (1) A large amount of data will be exchanged between the shard database servers, consuming network IO and disk IO;
[0005] (2) The distributed node that receives the request will coordinate and distribute the read and write data commands to other nodes, consuming database CPU threads;
[0006] (3) The slowest node will affect the entire cluster summary process, causing the distributed nodes that issue commands to always remain in the task state until all node tasks are processed;
[0007] (4) When the amount of data continues to grow rapidly, the amount of data transmitted from local tables to distributed tables increases rapidly, causing the system to slow down significantly. Horizontal expansion of the cluster requires data redistribution, which increases manual intervention and affects the system's availability. Summary of the invention
[0008] In view of the above-mentioned shortcomings of the prior art, the object of the present invention is to provide a memory-based multi-dimensional model roll-up calculation method, system, medium and device for solving the above-mentioned problems.
[0009] In a first aspect, the present invention provides a memory-based multidimensional model rollup calculation method, the method comprising the following steps:
[0010] Acquire dimension information and fill in data, wherein the dimension information at least includes subject dimension and period dimension;
[0011] Calculate the number of cycles of summary nodes and leaf nodes in the dimension information to obtain a summary order;
[0012] The reported data are summarized based on the summary order, wherein the reported data are traversed dimension by dimension according to a dynamic thread during the summary.
[0013] In a possible implementation of the present application, the obtaining of dimension information specifically includes:
[0014] The dimension information is obtained based on different dimensions of the tree structure, wherein:
[0015] The subject dimension is obtained based on the tree structure of the income and expenditure items;
[0016] The period dimension is obtained based on the tree structure of the month;
[0017] The dimensions include at least a parent node dimension, a leaf node dimension, a member name dimension, a summary weight dimension, and a description dimension.
[0018] In a possible implementation of the present application, the dimensional information further includes an entity dimension, wherein the entity dimension is obtained based on a tree structure of team composition.
[0019] In a possible implementation of the present application, the reported data is obtained by acquiring the measurement value of the dimension member on each leaf node in the dimension information, wherein the reported data includes input data and / or retrieved data.
[0020] In a possible implementation of the present application, the calculating the number of cycles of the summary nodes and the leaf nodes in the dimension information to obtain the summary order specifically includes:
[0021] Extracting the number of summary nodes and the number of leaf nodes based on the parent node dimension and the leaf node dimension in the dimension information;
[0022] Calculate the number of cycles in order of different dimensions based on the number of summary nodes and the number of leaf nodes;
[0023] The calculation results of the number of cycles are arranged in ascending order, and the order corresponding to the first position of the arrangement is extracted to obtain the summary order.
[0024] In a possible implementation of the present application, aggregating the reported data based on the aggregation order specifically includes:
[0025] The dynamic thread is allocated by calculating based on the quantity value of the reported data combined with a preset number of single groups, wherein the number of single groups includes five;
[0026] The reported data is traversed in each thread, and the data having the same summary node and the leaf node are summed up according to the weight in the summary weight dimension for aggregation.
[0027] In a possible implementation of the present application, the method further includes visually displaying the summary result of summarizing the reported data based on the summary order in a preset display mode, wherein the preset display mode includes a spreadsheet.
[0028] In a second aspect, the present invention provides a memory-based multi-dimensional model roll-up calculation system, the system comprising: an acquisition module, a calculation module and a summary module, wherein:
[0029] The acquisition module is used to acquire dimension information and fill in data, wherein the dimension information at least includes subject dimension and period dimension;
[0030] The calculation module is used to calculate the number of cycles of the summary nodes and leaf nodes in the dimension information to obtain a summary order;
[0031] The summarizing module is used to summarize the reported data based on the summarizing order, wherein the dimension information is traversed during the summarization and summarized dimension by dimension according to the dynamic thread.
[0032] In a third aspect, the present invention provides an electronic device, the electronic device comprising: a processor and a memory;
[0033] The memory is used to store computer programs;
[0034] The processor is used to execute the computer program stored in the memory so that the electronic device executes the above-mentioned memory-based multi-dimensional model roll-up calculation method.
[0035] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by an electronic device, implements the above-mentioned memory-based multidimensional model roll-up calculation method.
[0036] As described above, the memory-based multidimensional model roll-up calculation method, system, medium and device described in the present invention have the following beneficial effects: replacing the traditional distributed table, directly interacting with the local table for data, eliminating the data transmission between the distributed table and the local table, saving the network IO, disk IO and CPU threads of the database server; each component node in the server cluster is stateless, horizontal expansion is convenient and fast, the operation and maintenance cost is low, and the availability and maintainability of the system are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 Shown is a schematic diagram of a scene of an electronic device of the present invention in an embodiment;
[0038] Figure 2 It is a schematic diagram showing the method steps of a memory-based multi-dimensional model roll-up calculation method in one embodiment of the present invention;
[0039] Figure 3 It is a schematic diagram showing the method steps of a memory-based multi-dimensional model roll-up calculation method in one embodiment of the present invention;
[0040] Figure 4A It is a schematic diagram of subject dimensions in an embodiment of the memory-based multi-dimensional model roll-up calculation method of the present invention;
[0041] Figure 4B It is a schematic diagram of the period dimension of a memory-based multi-dimensional model roll-up calculation method in one embodiment of the present invention;
[0042] Figure 4C It is a schematic diagram showing the filling data of the memory-based multi-dimensional model roll-up calculation method in one embodiment of the present invention;
[0043] Figure 4D It is a schematic diagram of an electronic table of a memory-based multi-dimensional model roll-up calculation method in one embodiment of the present invention;
[0044] Figure 5A It is a schematic diagram of entity dimensions of a memory-based multi-dimensional model roll-up calculation method in one embodiment of the present invention;
[0045] Figure 5B It is a schematic diagram showing the filling data of the memory-based multi-dimensional model roll-up calculation method in one embodiment of the present invention;
[0046] Figure 5C It is a schematic diagram of an electronic table of a memory-based multi-dimensional model roll-up calculation method in one embodiment of the present invention;
[0047] Figure 6 It is a schematic diagram showing the structure of a memory-based multi-dimensional model roll-up computing system in one embodiment of the present invention;
[0048] Figure 7 It is a schematic structural diagram of an electronic device of the present invention in one embodiment. DETAILED DESCRIPTION
[0049] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0050] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0051] The following embodiments of the present invention provide a memory-based multidimensional model rollup calculation method, which can be applied to Figure 1 The electronic device shown. The electronic device described in the present invention may include a mobile phone 11 with a wireless charging function, a tablet computer 12, a laptop computer 13, a wearable device, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc. The embodiment of the present invention does not impose any restrictions on the specific type of the electronic device.
[0052] For example, the electronic device may be a station (STAION, ST) in a WLAN with a wireless charging function, a cellular phone, a cordless phone, a Session Initiation Protocol (SIP) phone, a Wireless Local Loop (WLL) station, a Personal Digital Assistant (PDA) device, a handheld device with a wireless charging function, a computing device or other processing device, a computer, a laptop computer, a handheld communication device, a handheld computing device, and / or other devices for communicating on a wireless system and a next generation communication system, such as a mobile terminal in a 5G network, a mobile terminal in a future evolved Public Land Mobile Network (PLMN), or a mobile terminal in a future evolved Non-terrestrial Network (NTN).
[0053] For example, the electronic device can communicate with the network and other devices through wireless communication. The above wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobilecommunication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS can include Global Positioning System (GPS), Global Navigation Satellite System (GLONASS), BeiDou navigation Satellite System (BDS), Quasi-Zenith Satellite System (QZSS) and / or Satellite Based Augmentation Systems (SBAS).
[0054] The technical solutions in the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0055] Specifically, see Figure 2 In one embodiment of the invention, the memory-based multi-dimensional model roll-up calculation method of the present invention includes the following steps:
[0056] Step S202, obtaining dimension information and reporting data, wherein the dimension information at least includes the subject dimension and the period dimension;
[0057] Step S204, calculating the number of cycles of the summary nodes and leaf nodes in the dimension information to obtain a summary order;
[0058] Step S206, summarizing the reported data based on the summarization order, wherein the reported data is traversed dimension by dimension according to a dynamic thread during summarization.
[0059] It should be noted that the present application provides a new solution to address the relevant shortcomings of the prior art. Specifically, the application continues to make full use of ClickHouse's efficient query during query analysis, and no longer uses its distributed table with central node coordination and aggregation functions, but instead uses server memory for aggregation. When aggregating, it is necessary to obtain dimension information and reported data, wherein the measurement values of dimension members on each leaf node in the dimension information are obtained to obtain the reported data, wherein the reported data includes input data and / or retrieved data, and the dimension information includes at least subject dimension, period dimension, and entity dimension, wherein the specific expressions of subject dimension, period dimension, and entity dimension are all structure trees. When aggregating, there are different aggregation orders, and accordingly, different aggregation orders correspond to The number of loops is different, so it is necessary to calculate the number of loops in different orders, so as to select the optimal order for aggregation. Furthermore, after the aggregation order is obtained, the reported data can be aggregated based on the aggregation order, wherein the reported data is traversed dimension by dimension according to the dynamic thread during aggregation, and the reported data is processed in groups of five into one thread, and the reported data is traversed in each thread, and the data with the same aggregation node and the leaf node are summed according to the weight in the aggregation weight dimension for aggregation. After obtaining the aggregation result, the method also includes visually displaying the aggregation result of the reported data based on the aggregation order in a preset display mode, wherein the preset display mode includes a spreadsheet.
[0060] Furthermore, in one embodiment of the invention, the obtaining of dimensional information specifically includes: obtaining the dimensional information based on different dimensions of a tree structure, wherein the account dimension is obtained based on a tree structure of income and expenditure items; the period dimension is obtained based on a tree structure of months; the dimensions include at least a parent node dimension, a leaf node dimension, a member name dimension, a summary weight dimension, and a description dimension, and further include a shared member dimension.
[0061] It should be noted that, in this embodiment, it is specifically explained how to obtain dimensional information, and the obtained dimensional information specifically includes account dimension and period dimension, wherein the account dimension is obtained based on the tree structure of income and expenditure items; the period dimension is obtained based on the tree structure of months, and further, the dimensional information also includes entity dimension, wherein the entity dimension is obtained based on the tree structure of team composition, and the dimension includes at least parent node dimension, leaf node dimension, member name dimension, summary weight dimension and description dimension.
[0062] Further, in one embodiment of the invention, if Figure 3 As shown, the calculation of the number of cycles of the summary nodes and leaf nodes in the dimension information to obtain the summary order specifically includes the following steps:
[0063] Step S302, extracting the number of summary nodes and the number of leaf nodes based on the parent node dimension and the leaf node dimension in the dimension information;
[0064] Step S304, calculating the number of cycles in order of different dimensions based on the number of summary nodes and the number of leaf nodes;
[0065] Step S306, performing ascending order based on the calculation result of the number of cycles, extracting the order corresponding to the first position of the arrangement to obtain the summary order.
[0066] It should be noted that, in this embodiment, in order to improve the aggregation efficiency, the aggregation dimensions should be sorted according to the ratio of the number of aggregation nodes to the number of leaf nodes, and the ones with smaller ratios should be aggregated first. This is specifically reflected in the calculation of the number of loops. Different calculation results of different number of loops correspond to different efficiencies. Therefore, the calculation results of the number of loops are arranged in ascending order, and the order corresponding to the first position in the arrangement is extracted to obtain the aggregation order. Accordingly, it is necessary to extract the number of aggregation nodes and the number of leaf nodes based on the parent node dimension and the leaf node dimension in the dimensional information.
[0067] Further, in one embodiment of the invention, the aggregating the reported data based on the aggregation order specifically includes: calculating based on the quantity value of the reported data combined with a preset single group number to allocate the dynamic thread, wherein the single group number includes five; traversing the reported data in each thread, and summing the data with the same aggregation node and the leaf node according to the weight in the aggregation weight dimension for aggregation.
[0068] It should be noted that in this embodiment, the preset number of single groups can be set to five, so that when processing the reported data, the reported data is first grouped into groups of five and enters one thread, and then the corresponding reported data is traversed in each thread, and the data with the same summary node and the leaf node are summed according to the weight in the summary weight dimension to obtain the summary result.
[0069] Specifically, in this embodiment, the income and expenditure of Company A in each month of the first quarter are taken as an example. Figure 4A As shown, it shows the account dimension (Account) corresponding to the tree structure of Company A's income and expenditure items, and Figure 4B The tree structure of the months of Company A is displayed as the period dimension (Period). Accordingly, the basic information of different dimensions mainly includes the name, weight, parent node, whether it is a leaf node (the lowest member), and whether it is a shared member (i.e., a copy. A shared member can be a member or a group with a summary node as the root. Its structure is the same as the original member, which is manifested as: the member name, whether it is a leaf node and the original member are the same. The parent node of the root node must be different, and the weight and description can be different. It is mainly used to simplify the dimension construction of the same member group. Furthermore, after the dimension is established, multi-dimensional data analysis begins. According to the basic reported data of Company A, the various income and expenditure situations of each month in the first quarter are obtained. The goal is to calculate the summary data of each account summary member on the period summary member. In addition, the weight relationship between the summary node and all the leaf nodes under it is specifically used for summary calculation.
[0070] Further, obtain the reported data, such as Figure 4CAs shown, it is a schematic diagram of the reported data of Company A, and then it is necessary to calculate the number of cycles of the summary nodes and leaf nodes in the dimension information to obtain the summary order. In order to improve the summary efficiency, the summary dimensions should be sorted according to the ratio of the number of summary nodes to the number of leaf nodes, and the smaller ratio should be summarized first. In this embodiment, it is necessary to calculate the summary data of total profit, income and expenditure in the first quarter, and dimensional analysis should be performed first: the account dimension (Account) contains "3" summary nodes, namely "TotalProfit", "Income", "Expenditure" (TotalProfit is the project root node in this embodiment, ignoring #root); and "3" leaf nodes, namely "SellProduct", "Material", "Salary", that is, the ratio of the number of summary nodes to the number of leaf nodes is "1"; and the period dimension (Period) contains "1" summary node "Q1" ("Q1" is the root node, ignoring the "Hy1" node); "3" child nodes "1", "2", "3", that is, the ratio of the number of summary nodes to the number of leaf nodes is "1 / 3".
[0071] Correspondingly, there are two orders, one is to summarize in the order of account dimension (Account) first and then period dimension (Period): first perform account dimension (Account) summary, traverse the "9" basic reported data, and according to the relationship between account dimension (Account) summary nodes and leaf nodes, traverse the "3" leaf nodes for the first round of summary: generate a Cartesian product combination of "9" account dimension (Account) summary members and period dimension (Period) leaf node members, and at this time, it loops "9*3=27 times", then perform period dimension (Period) summary, traverse the "9" data that have been summarized once above, and according to the relationship between summary nodes and leaf nodes, traverse the "3" child nodes to generate a Cartesian product combination of "3" account dimension (Account) summary members and period dimension (Period) summary members, and at this time, it loops "9*3=27 times".
[0072] The second is to summarize in the order of first period dimension (Period) and then account dimension (Account): first, summarize the period dimension (Period), traverse the "9" basic reporting data, and then traverse the "3" child nodes according to the relationship between the summary node and the leaf node, and generate the Cartesian product combination of the "3" period dimension (Period) summary members and the Account leaf node members. At this time, the cycle is "9*3=27" times. Then, summarize the account dimension (Account), traverse the "3" data that have been summarized once above, and then traverse the "3" child nodes according to the relationship between the summary node and the leaf node, and generate the Cartesian product combination of the "3" period dimension (Period) summary members and the Account summary members. At this time, the cycle is "3*3=9" times. It can be seen that: summarizing the period dimension (Period) first and then summarizing the account dimension (Account) can reduce "18" cycles in this implementation, which can be seen that it has a high efficiency value in practice.
[0073] Further, enter the aggregation process: First, traverse the dimensions and aggregate the data dimension by dimension. First, aggregate the period dimension (Period) to generate the measurement data of the period dimension (Period) aggregation node + Account leaf node, and then aggregate the account dimension (Account) to generate the measurement data of the period dimension (Period) aggregation node and the account dimension (Account) aggregation node. Secondly, in each dimension traversal process, the data is processed in batches by multiple threads to improve the aggregation efficiency. For example, when traversing the period dimension (Period), the "9" basic reported data are grouped into "5" groups to form two groups, each of which is processed by one thread. Further, in each thread, the reported data is traversed, and the data rows with the same aggregation node and the Cartesian product combination of other dimension leaf members are summed up according to the corresponding weights for aggregation. The final aggregation result is as follows: Figure 4D Shown is a spreadsheet diagram summarizing the results.
[0074] Specifically, in this embodiment, the income and expenditure of Company A and its two teams in each month of the first quarter are taken as an example for explanation. The subject dimension and period dimension in this embodiment are as described above. Figure 4A as well as Figure 4B As shown, in this embodiment Figure 5AAs shown, it shows a schematic diagram of the entity dimension corresponding to the tree structure of the team composition of Company A. The entity dimension (Entity) is different from the period dimension (Period) and the account dimension (Account) in that it contains a group of shared nodes with the Sales-person member as the root. The advantage of shared members is that it is convenient for the creation and expansion of dimensions. When the area is expanded later, it is only necessary to mount Sales-person on the new area node. At the same time, if there are adjustments to factors such as weights, it can also be supported. The shared members are the same as other members in summary logic. Then start the multi-dimensional analysis of the data. In this embodiment, it is necessary to obtain the income and expenditure of each team in each month of the first quarter based on the basic reported data of Company A. The goal is to calculate the summary data of each account summary member on the period summary member and the entity summary member, such as Figure 5B As shown, it is a schematic diagram of the reported data corresponding to two teams of Company A, and then it is necessary to calculate the number of cycles of the summary nodes and leaf nodes in the dimension information to obtain the summary order. Among them, in order to improve the summary efficiency, the summary dimensions should be sorted according to the ratio of the number of summary nodes / the number of leaf nodes, and the smaller ratio should be summarized first. In this embodiment, the account dimension (Account) includes 3 summary nodes, namely "Total Profit", "Income", and "Expenditure"; 3 leaf nodes, namely "Sell Product", "Material", and "Salary", and the ratio of the number of summary nodes / the number of leaf nodes is "1", and the period dimension (Period) includes "1" summary node "Q1"; "3" child nodes "1", "2", and "3", that is, the ratio of the number of summary nodes / the number of leaf nodes is "1 / 3". The entity dimension (Entity) contains "4" summary nodes "Beijing", "Shanghai", and "2" "Sales-person"; among the "4" leaf nodes, there are "2" "GroupOne" and "2" "GroupTwo", that is, the ratio of the number of summary nodes to the number of leaf nodes is "1". Since the ratios of the account dimension (Account) and the entity dimension (Entity) are both "1", the order of these two dimensions can be ignored. Reason: If the order of period dimension (Period), then account dimension (Account), and then entity dimension (Entity) is followed, the number of loops is "18*3=54+12*3=90+12*4=138" times; or if the order of period dimension (Period), then entity dimension (Entity), and then account dimension (Account) is followed, the number of loops is "18*3=54+12*4=102+12*3=138" times. The calculated number of loops is equal twice, so the order of traversal of the two dimensions can be irrelevant. In actual projects, they are loaded in the configuration order. Here, we take the summary of the account dimension "Account" as an example.
[0075] Further, enter the aggregation process: first, traverse the dimensions and aggregate the data dimension by dimension. First, aggregate the period dimension (Period) to generate the measurement data of the period dimension aggregation node, the account dimension leaf node, and the entity dimension leaf node; then aggregate the account dimension (Account) to generate the measurement data of the period dimension aggregation node, the account dimension aggregation node, and the entity dimension leaf node; finally, aggregate the entity dimension (Entity) to generate the measurement data of the period dimension aggregation node, the account dimension aggregation node, and the entity dimension aggregation node. Among them, in each dimension traversal process, the data is processed in batches by multiple threads to improve the aggregation efficiency. For example, when traversing the period dimension (Period), the "18" basic reporting data are grouped into "5" groups to form four groups, each of which is processed by one thread. Furthermore, in each thread, the reported data is traversed, and the data rows with the same summary node and the Cartesian product combination of other dimension leaf members are summed according to the corresponding weights. At this time, the shared members will be generated in the dimension relationship table. Specifically, for example, the income (Sell-Product) of the "Shanghai Team" in January is calculated, where the Sell-Product of the "Shanghai Team" in January = the Sell-Product*1 of Group-One in January + the Sell-Product*1 of Group-Two in January, that is, "10000+11000=21000". Finally, since the leaf members with the same summary node may be distributed in different threads, the data result sets of each thread need to be summarized again, and finally the summary result corresponding to Company A with two teams is obtained, where, for example, Figure 5C Shown is a spreadsheet diagram summarizing the results.
[0076] An embodiment of the present application also provides a memory-based multidimensional model roll-up calculation system, which can implement the memory-based multidimensional model roll-up calculation method described in the present application. However, the implementation device of the memory-based multidimensional model roll-up calculation method described in the present application includes but is not limited to the structure of the memory-based multidimensional model roll-up calculation system listed in the present embodiment. All structural deformations and replacements of the prior art made according to the principles of the present application are included in the protection scope of the present application.
[0077] See also Figure 6 In one embodiment, this embodiment provides a memory-based multi-dimensional model rollup calculation system 60, the system includes an acquisition module 61, a calculation module 62 and a summary module 63, wherein:
[0078] The acquisition module 61 is used to acquire dimension information and fill in data, wherein the dimension information at least includes subject dimension and period dimension;
[0079] The calculation module 62 is used to calculate the number of cycles of the summary nodes and leaf nodes in the dimension information to obtain a summary order;
[0080] The summarizing module 63 is used to summarize the reported data based on the summarizing order, wherein the dimension information is traversed during the summarization and summarized dimension by dimension according to the dynamic thread.
[0081] Since the specific implementation of this embodiment corresponds to the aforementioned method embodiment, the same details will not be repeated here, and those skilled in the art should also understand that Figure 6 The division of the modules in the embodiment is merely a division of logical functions, and in actual implementation, all or part of them can be integrated into one or more physical entities, and these modules can be implemented entirely in the form of software called by processing elements, or entirely in the form of hardware, or some modules can be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware.
[0082] In the several embodiments provided by the present invention, it should be understood that the disclosed system, device or method can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules / units is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules or units, which can be electrical, mechanical or other forms.
[0083] The modules / units described as separate components may or may not be physically separated, and the components displayed as modules / units may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules / units may be selected according to actual needs to achieve the purpose of the embodiments of the present invention. For example, the functional modules / units in the various embodiments of the present invention may be integrated into one processing module, or each module / unit may exist physically separately, or two or more modules / units may be integrated into one module / unit.
[0084] Those of ordinary skill in the art should further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0085] The embodiment of the present invention also provides a computer-readable storage medium. A person of ordinary skill in the art can understand that all or part of the steps in the method for implementing the above embodiment can be completed by instructing the processor through a program, and the program can be stored in a computer-readable storage medium, and the storage medium is a non-transitory medium, such as a random access memory, a read-only memory, a flash memory, a hard disk, a solid-state hard disk, a magnetic tape, a floppy disk, an optical disc, and any combination thereof. The above storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (DVD)), or a semiconductor medium (e.g., a solid-state disk (SSD)), etc.
[0086] An embodiment of the present invention further provides an electronic device, which includes a processor and a memory.
[0087] The memory is used to store computer programs.
[0088] The memory includes: ROM, RAM, disk, USB flash drive, memory card or CD and other media that can store program codes.
[0089] The processor is connected to the memory and is used to execute the computer program stored in the memory so that the electronic device executes the above-mentioned memory-based multi-dimensional model roll-up calculation method.
[0090] Preferably, the processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0091] like Figure 7 As shown, the electronic device of the present invention is in the form of a general computing device. The components of the electronic device may include but are not limited to: one or more processors or processing units 71, a memory 72, and a bus 73 connecting different system components (including the memory 72 and the processing unit 71).
[0092] Bus 73 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0093] Electronic devices typically include a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device, including volatile and non-volatile media, removable and non-removable media.
[0094] The memory 72 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 721 and / or cache memory 722. The electronic device may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 723 may be used to read and write non-removable, non-volatile magnetic media ( Figure 7 not shown, usually called a "hard drive"). Although Figure 7Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 73 via one or more data medium interfaces. The memory 72 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.
[0095] A program / utility 724 having a set (at least one) of program modules 7241 may be stored, for example, in the memory 72, such program modules 7241 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 7241 generally perform the functions and / or methods of the embodiments described herein.
[0096] The electronic device may also communicate with one or more external devices (e.g., keyboards, pointing devices, displays, etc.), one or more devices that enable a user to interact with the electronic device, and / or any device that enables the electronic device to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via input / output (I / O) interface 74. Furthermore, the electronic device may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via network adapter 75. Figure 7 As shown, the network adapter 75 communicates with other modules of the electronic device via the bus 73. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the electronic device, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0097] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.
Claims
1. A memory-based multidimensional model roll-up calculation method, characterized in that: include: Acquire dimension information and fill in data, wherein the dimension information at least includes a subject dimension, a period dimension, and an entity dimension, wherein the entity dimension is obtained based on a tree structure composed of teams; Calculate the number of cycles of summary nodes and leaf nodes in the dimension information to obtain a summary order; The reported data are summarized based on the summary order, wherein the reported data are traversed dimension by dimension according to a dynamic thread during the summary.
2. The memory-based multidimensional model roll-up calculation method according to claim 1, characterized in that: The obtaining of dimension information specifically includes: The dimension information is obtained based on different dimensions of the tree structure, wherein: The subject dimension is obtained based on the tree structure of the income and expenditure items; The period dimension is obtained based on the tree structure of the month; The dimensions include at least a parent node dimension, a leaf node dimension, a member name dimension, a summary weight dimension, and a description dimension.
3. The memory-based multidimensional model roll-up calculation method according to claim 2, characterized in that: The reported data is obtained by acquiring the measurement value of the dimension member on each leaf node in the dimension information, wherein the reported data includes input data and / or retrieved data.
4. The memory-based multidimensional model roll-up calculation method according to claim 3 is characterized in that: The calculating the number of cycles of the summary nodes and leaf nodes in the dimension information to obtain the summary order specifically includes: Extracting the number of summary nodes and the number of leaf nodes based on the parent node dimension and the leaf node dimension in the dimension information; Calculate the number of cycles in order of different dimensions based on the number of summary nodes and the number of leaf nodes; The calculation results of the number of cycles are arranged in ascending order, and the order corresponding to the first position of the arrangement is extracted to obtain the summary order.
5. The memory-based multi-dimensional model roll-up calculation method according to claim 4 is characterized in that: The aggregating the reported data based on the aggregation order specifically includes: The dynamic thread is allocated by calculating based on the quantity value of the reported data combined with a preset number of single groups, wherein the number of single groups includes five; The reported data is traversed in each thread, and the data having the same summary node and the leaf node are summed up according to the weight in the summary weight dimension for aggregation.
6. The memory-based multidimensional model roll-up calculation method according to claim 1, characterized in that: The method further includes visually displaying the summary result of summarizing the reported data based on the summary order in a preset display mode, wherein the preset display mode includes a spreadsheet.
7. A memory-based multidimensional model roll-up computing system, characterized in that: It includes acquisition module, calculation module and summary module, among which, The acquisition module is used to acquire dimension information and fill in data, wherein the dimension information at least includes a subject dimension, a period dimension, and an entity dimension, wherein the entity dimension is obtained based on a tree structure composed of teams; The calculation module is used to calculate the number of cycles of the summary nodes and leaf nodes in the dimension information to obtain a summary order; The summarizing module is used to summarize the reported data based on the summarizing order, wherein the dimension information is traversed during the summarization and summarized dimension by dimension according to the dynamic thread.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the memory-based multi-dimensional model roll-up calculation method described in any one of claims 1 to 6 is implemented.
9. An electronic device, characterized in that: The electronic device comprises: a processor and a memory; wherein the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the electronic device executes the memory-based multidimensional model roll-up calculation method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Data aggregation in a hierarchy for query execution
US20220414104A1