CN111782658A - Cross table processing method, cross table processing device, electronic equipment and storage medium - Google Patents
Cross table processing method, cross table processing device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN111782658A CN111782658A CN202010651178.8A CN202010651178A CN111782658A CN 111782658 A CN111782658 A CN 111782658A CN 202010651178 A CN202010651178 A CN 202010651178A CN 111782658 A CN111782658 A CN 111782658A
- Authority
- CN
- China
- Prior art keywords
- target
- node
- dimension
- leaf node
- tree structure
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000003860 storage Methods 0.000 title claims abstract description 8
- 238000003672 processing method Methods 0.000 title description 9
- 238000000034 method Methods 0.000 claims abstract description 35
- 230000001737 promoting effect Effects 0.000 claims abstract description 12
- 238000004590 computer program Methods 0.000 claims description 11
- 238000004458 analytical method Methods 0.000 claims description 2
- 238000001514 detection method Methods 0.000 claims description 2
- 238000010586 diagram Methods 0.000 description 15
- 230000008569 process Effects 0.000 description 8
- 238000012986 modification Methods 0.000 description 5
- 230000004048 modification Effects 0.000 description 5
- 230000006870 function Effects 0.000 description 4
- 238000009877 rendering Methods 0.000 description 3
- 230000002776 aggregation Effects 0.000 description 2
- 238000004220 aggregation Methods 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 238000007405 data analysis Methods 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 230000002708 enhancing effect Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2228—Indexing structures
- G06F16/2246—Trees, e.g. B+trees
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2228—Indexing structures
- G06F16/2264—Multidimensional index structures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/166—Editing, e.g. inserting or deleting
- G06F40/177—Editing, e.g. inserting or deleting of tables; using ruled lines
- G06F40/18—Editing, e.g. inserting or deleting of tables; using ruled lines of spreadsheets
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Computational Linguistics (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- General Health & Medical Sciences (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the specification provides a method, a device, electronic equipment and a storage medium for processing a cross table, the method comprises the steps of analyzing header information of a target cross table, determining a tree structure corresponding to a target dimension in a header of the target cross table, and then promoting an original data value mounted at a leaf node with an empty dimension value in the tree structure to a target node, wherein the target node is a node which is closest to the leaf node in a node branch where the leaf node is located and has a non-empty dimension value, so that the original data value is mounted at a mesomorphic dimension of the cross table.
Description
Technical Field
The embodiment of the specification relates to the technical field of internet, in particular to a method and a device for processing a cross table, electronic equipment and a storage medium.
Background
The data statistics is an important link of data analysis, the comprehensive data statistics can effectively improve the efficiency of data analysis, the statistical result is simply and clearly shown, and the time cost is reduced. A Cross table (Cross tables) is a common classification and summary table, and is a report presentation form in which multiple dimensions are used as headers and distributed in the horizontal/vertical directions according to preset rules, and corresponding data is filled into cells of Cross points of the headers. The data query by using the cross table is very visual and clear, and is widely applied to data statistics.
Disclosure of Invention
The embodiment of the specification provides a method and a device for processing a cross table, an electronic device and a storage medium, which can effectively enrich the data presentation form of the cross table.
In a first aspect, an embodiment of the present specification provides a method for processing a cross table, including: acquiring source data of a target cross table, wherein the source data comprises header information and an original data value of the target cross table; analyzing a target dimension in the header information, and determining a tree structure corresponding to the target dimension in the header of the target cross table, wherein the target dimension is a row dimension and/or a column dimension of the target cross table; and promoting an original data value corresponding to a target leaf node in the tree structure to the target node in a node branch where the target leaf node is located, wherein the target leaf node is a leaf node with an empty dimensional value, and the target node is a node which is closest to the target leaf node in the node branch and has a non-empty dimensional value.
In a second aspect, an embodiment of the present specification provides a cross table processing apparatus, including: the device comprises an acquisition module, a data processing module and a data processing module, wherein the acquisition module is used for acquiring source data of a target cross table, and the source data comprises header information and an original data value of the target cross table; the analysis module is used for analyzing a target dimension in the header information and determining a tree structure corresponding to the target dimension in the header of the target cross table, wherein the target dimension is a row dimension and/or a column dimension of the target cross table; and the lifting module is used for lifting an original data value corresponding to a target leaf node in the tree structure to the target node in the node branch where the target leaf node is located, wherein the target leaf node is a leaf node with an empty dimensional value, and the target node is a node which is closest to the target leaf node in the node branch and has a non-empty dimensional value.
In a third aspect, an embodiment of the present specification provides an electronic device, including: a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method of cross table processing as provided by the first aspect above when executing the program.
In a fourth aspect, an embodiment of the present specification provides a computer-readable storage medium, on which a computer program is stored, and the program, when executed by a processor, implements the steps of the cross table processing method provided in the first aspect.
In the method for processing the cross table provided in one embodiment of the present specification, the header information of the target cross table is analyzed to determine a tree structure corresponding to a target dimension in the header of the target cross table, and then, an original data value mounted at a leaf node whose dimension value is null in the tree structure is promoted to a target node, where the target node is a node whose dimension value is not null and is closest to the leaf node in a node branch where the leaf node is located, so that the original data value is mounted at a mesomorphic dimension, and a data presentation form of the cross table is effectively enriched. Therefore, when a user independently queries the dimension value of the corresponding target node in the target cross table, the source data value mounted at the dimension value can be conveniently found, and the user experience is improved.
Drawings
FIG. 1 is a flow chart of a method for processing a cross table provided in a first aspect of an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of an exemplary target crossbar provided in a first aspect of an embodiment of the present description;
FIG. 3 is a diagram of an exemplary tree structure provided in a first aspect of an embodiment of the present specification;
fig. 4 is an exemplary lifting diagram provided in the first aspect of the embodiments of the present disclosure;
FIG. 5 is a diagram of an exemplary assignment provided in a first aspect of an embodiment of the present disclosure;
fig. 6 is a schematic diagram of an exemplary enhancing effect provided by the first aspect of the embodiment of the present disclosure;
FIG. 7 is a block diagram of a crossbar processing apparatus provided in a second aspect of embodiments of the present specification;
fig. 8 is a schematic structural diagram of an electronic device provided in the third aspect of the embodiments of the present description.
Detailed Description
In the header structure of the existing cross table, the intermediate nodes (non-leaf nodes) are all summary nodes, that is, subtotal/total meaning, and have no original data value. The data acquisition of the subtotal/total data in the tree mode is normally carried out by configuring whether a subtotal switch is turned on or not to carry out dynamic calculation; if the switch is not turned on, the default is data [ ], i.e., nothing is displayed.
For example, in an application scenario, a cross table is required to be used to count the transaction amount, profit, ring rate of rise of each city in each province in China, and the like, wherein a first-level row dimension in row dimensions of the cross table is a province, a second-level row dimension is a city, a certain dimension value of the first-level row dimension is a guangdong, and a dimension value of the second-level row dimension corresponding to the guangdong includes: guangzhou, Shenzhen, Zhuhai, etc., dimension values of the column dimensions of the cross table include trading volume, profit, ring growth rate over the previous year, etc. In this way, the query condition is input in Guangdong-Zhuhai, the value queried by the user is unique, but only the value of the transaction amount, the profit, the ring rate increase of the previous year and the like of all cities under Guangdong province is input, and the value cannot be represented by a single data source. Alternatively, the subtotal/total switch is configured in advance to obtain a total value, however, in some scenarios, the rate of increase of the above-mentioned ring for some values over the previous year cannot be obtained by simple summation.
Therefore, in order to further enrich the presentation form of the cross table and facilitate the query of a user, the embodiment of the present specification provides a cross table processing method, which includes firstly analyzing header information of a target cross table, and determining a tree structure corresponding to a target dimension in the header of the target cross table, where the target dimension is a row dimension and/or a column dimension of the target cross table; and then, promoting an original data value corresponding to a target leaf node in the tree structure to the target node in a node branch where the target leaf node is located, wherein the target leaf node is a leaf node with an empty dimension value, and the target node is a node which is closest to the target leaf node in the node branch and has a non-empty dimension value. Therefore, the improvement of the table head structure can be completed, the original data value is mounted at the mesomorphic dimension of the cross table, and the data display form of the cross table is effectively enriched. After the table head structure is lifted to be completed, the lifted target cross table can be further rendered. After that, when a user independently queries the dimension value of the corresponding target node in the target cross table, the original data value mounted at the dimension value can be conveniently found, and the original data value of the corresponding leaf node does not need to be found first and then the resource is occupied for calculation, so that the resource occupation is reduced, the user time is saved, and the user experience is improved.
For example, in an application scenario, the cross table processing method provided by the embodiment of the present specification may be applied to a client installed on a user terminal, for example, the client may be a browser or third-party application software. After receiving the source data of the target cross table sent by the server, the client may first perform the above cross table processing method to promote the table header structure, and then render the promoted target cross table.
In order to better understand the technical solutions provided by the embodiments of the present specification, the technical solutions of the embodiments of the present specification are described in detail below with reference to the drawings and specific embodiments, and it should be understood that the specific features in the embodiments and examples of the present specification are detailed descriptions of the technical solutions of the embodiments of the present specification, and are not limitations on the technical solutions of the embodiments of the present specification, and the technical features in the embodiments and examples of the present specification may be combined with each other without conflict. In the embodiments of the present specification, the term "plurality" means "two or more", that is, includes two or more cases; the term "and/or" is merely an associative relationship that describes an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone.
In a first aspect, fig. 1 shows a flowchart of a method for processing a cross table provided in an embodiment of the present specification. Referring to fig. 1, the method may include at least the following steps S100 to S104.
Step S100, obtaining source data of the target cross table, where the source data includes header information and original data value of the target cross table.
In the embodiments of the present specification, the target cross table is a cross table having a multi-layer header. The source data refers to data in cells intersected by rows and columns in the target cross table.
The header information includes row header information and list header information. The row header information includes dimension values of each hierarchy in the row header and an index relationship between the dimension values of each hierarchy. The list header information includes dimension values of each hierarchy in the list header and an index relationship between the dimension values of each hierarchy. The original data value is the data value to be filled into the cell crossed by the row and the column.
It should be noted that the source data of the target cross table may be configured according to the design rule of the cross table and the original data value when the original data value to be shown in the form of the cross table is acquired by the back end, i.e., the server. According to the design rule of the cross table, the middle dimension in the header information cannot be used for mounting the original data value, and the level height of each node branch in the tree structure corresponding to the header information is equal, so that if the original data value has a value to be mounted at the middle dimension, the header information needs to be configured, a leaf node with a dimensional value being empty is configured in the node branch to which the middle dimension belongs, the original data value to be mounted at the middle dimension is firstly mounted at the leaf node, the configured source data is sent to a front end, namely a client side for rendering, and after the client side receives the source data of the target cross table, the corresponding original data value is mounted to the middle dimension through the promotion of the header structure through the processing flow from the step S100 to the step S104 provided by the embodiment of the present specification.
For example, in an application scenario, when a back end obtains an original data value to be presented in a cross table form, a target cross table structure shown in fig. 2 is configured, and source data of the target cross table is sent to a front end for rendering, where the source data includes one segment of data as follows, and each segment of data is composed of key-values:
{
"MENU _ LVL _1": focus attention ",
"MENU_LVL_2":"",
"CATEGORY": consumption credit ",
"INDICATOR_LVL_1":"",
"INDICATOR_LVL_2":"",
"INDICATOR_LVL_3":"",
"TIME _ graph": year ",
"TIME _ graph _ detach": 2017 ",
"INDICATOR_VALUE":7897,
"INDICATOR_VALUE_TONGBI":null,
"INDICATOR_VALUE_HUANBI":null
}
wherein (A) and (B)
"MENU _ LVL _1": focus attention ",
"MENU_LVL_2":"",
"CATEGORY": consumption credit ",
"INDICATOR_LVL_1":"",
"INDICATOR_LVL_2":"",
"INDICATOR_LVL_3":"",
)
these data represent the row dimension and the dimension values in the row dimension. Wherein, the key of the first level row dimension is: MENU _ LVL _1, the dimension value is: focusing on the key, the key of the next level row dimension is: MENU _ LVL _2, the dimension value is null, and the key of the next level of row dimension is as follows: CATEGORY, dimension values are: the consumption credits are sequentially the following keys of the three-level row dimension: INDICATOR _ LVL _1, INDICATOR _ LVL _1 and INDICATOR _ LVL _3, the dimension values are all null. The report structure presented in this way is as shown in fig. 2, the dimension values of some row dimensions are empty, and the dimension values of column dimensions in the table are not shown, and can be respectively equal to profit and profit in turn; sales volume in the first quarter, sales volume ring ratio; and second quarter sales, sales ring ratio. Wherein, the line of raw data values of '7897' is mounted in the dimension of the line with key of INDICATOR _ LVL _3 and empty dimension value.
Step S102, analyzing the target dimension in the header information, and determining a tree structure corresponding to the target dimension in the header of the target cross table.
As an embodiment, the table header information may be used to obtain the dimensional values included in each hierarchy under the target dimension and the index relationship between the dimensional values of adjacent hierarchies; and then, according to the dimension value included by each hierarchy and the index relationship of the dimension values between adjacent hierarchies, determining a tree structure corresponding to the target dimension.
Wherein the target dimension may be a row dimension and/or a column dimension of the target cross table. In the embodiments of the present specification, a target dimension is taken as an example of a row dimension. Of course, in other embodiments of the present specification, the target dimension may also be a column dimension, or may include both row and column dimensions. It will be appreciated that the process of header structure lifting for the column dimension is similar to the row dimension, and reference may be made to the header structure lifting process for the row dimension.
And analyzing the line dimension in the header information, and obtaining a tree structure corresponding to the line dimension according to the dimensional values included in each level in the header of the line and the index relationship of the dimensional values between adjacent levels. Each dimension value in the header information is a node in the tree structure, and the number of layers of each branch in the tree structure is the same.
Taking the target cross table structure shown in fig. 2 as an example, the tree structure corresponding to the row dimension is shown in fig. 3, the hierarchy height of the tree structure is 6, wherein a blank rectangular box indicates that the dimension value of the node is blank.
And step S104, promoting an original data value corresponding to a target leaf node in the tree structure to the target node in a node branch where the target leaf node is located, wherein the target leaf node is a leaf node with an empty dimension value, and the target node is a node which is closest to the target leaf node in the node branch and has a non-empty dimension value.
The leaf nodes of the cross table are all loaded with original data values, such as "7897" in fig. 2, and if the dimension value of a leaf node is empty, the original data values loaded by the leaf nodes can be lifted up along the node branch where the leaf node is located until a node with a dimension value that is not empty is encountered. It is understood that the node branch where the leaf node is located refers to a branch in the tree structure having an index relationship with the leaf node. For example, as shown in fig. 3, the node branch in which the leaf node F1 is located is a → B → C → D1 → E1 → F1, and the node branch in which the leaf node F2 is located is a → B → C → D2 → E2 → F2. In the same node branch, the distance between two nodes is further the more the spacing level number between the two nodes is, for example, the distance between the node F2 and the node A is greater than the distance between the node F2 and the node C.
For example, in the tree structure shown in fig. 3, the dimension values of the leaf nodes F1, F2, and F3 are all null, and these three leaf nodes are all target leaf nodes. In the node branch where the leaf node F1 is located, the node closest to the leaf node F1 and whose dimensional value is not empty is "credit consumed", in the node branch where the leaf node F2 is located, the node closest to the leaf node F2 and whose dimensional value is not empty is "first index", and in the node branch where the leaf node F3 is located, the node closest to the leaf node F1 and whose dimensional value is not empty is "second index". Thus, the original data VALUE mounted at the leaf node F1 may be promoted to the node "spending credit", i.e., the original data VALUE "index _ VALUE":7897 originally belonging to "index _ LVL _3" is promoted to "CATEGORY": spending credit "; lifting the original data value mounted at the leaf node F2 to the node 'first index'; the original data value mounted at leaf node F3 is lifted to node "second index", as shown in fig. 4. That is, the original data value mounted at the leaf node F1 is assigned to the row corresponding to the node "consume credit", the original data value mounted at the leaf node F2 is assigned to the row corresponding to the node "first index", and the original data value mounted at the leaf node F3 is assigned to the row corresponding to the node "second index", as shown in fig. 5.
Therefore, the original data values corresponding to the dimension values of the intermediate nodes can be mounted in the consumption credit dimension, the first index dimension and the second index dimension which are used as the intermediate nodes and exist in the cross table, the original data values are not limited to being obtained by statistics in a summary mode of subtotal aggregation or total aggregation, or only the original data values mounted at the corresponding leaf nodes can be inquired when the consumption credit, the first index dimension and the second index are inquired, and resources are required to be occupied to obtain the required data values through recalculation. The method and the device effectively facilitate the user to inquire the data values of similar intermediate nodes such as 'consumption credit', 'first index' and 'second index', and improve the user experience.
It can be understood that, before the step S104 is executed, it may be detected whether a leaf node whose dimension value is empty exists in the tree structure determined in the step S102, if so, it indicates that a leaf node that can be promoted exists in the target cross table, so as to execute the step of promoting the original data value corresponding to the target leaf node in the tree structure to the target node in the node branch where the target leaf node is located, and if not, the processing flow of this time is ended, and the target cross table may be further rendered.
As an embodiment, the process of raising the original data value corresponding to the target leaf node in the tree structure to the target node in the node branch where the target leaf node is located may include: sequentially traversing nodes in a first layer to an N-1 layer from top to bottom in a tree structure, wherein aiming at the nodes in the first layer to the N-2 layer, whether the dimension values of lower nodes of a current node are all null is detected, if yes, leaf nodes in the lower nodes are used as target leaf nodes, the original data values of the target leaf nodes are assigned to corresponding target nodes, and traversal of the lower nodes of the current node is skipped; if not, detecting whether the dimension value of the current node is empty, if so, sequentially lifting the lower-layer node of the current node by one level, if not, continuously traversing the next node, detecting whether a leaf node with an empty dimension value exists in the current node aiming at the node in the layer N-1, if so, taking the leaf node as a target leaf node, and assigning the original data value of the target leaf node to the corresponding target node.
Where N is a positive integer greater than or equal to 3, such as 4, 5, or 6, and represents the level height of the tree structure determined in step S102, and the lower node of the current node refers to all nodes located at a level below the current node in the tree structure. Taking the tree structure shown in fig. 3 as an example, if the current node is the node C "consume credit" located at the third level, the lower level nodes of the current node include all nodes included in the fourth level, the fifth level and the sixth level; if the current node is the node D1 located at the fourth level, the lower level nodes of the current node include a node E1 and a node F1.
According to the implementation process, the tree structure shown in fig. 3 is traversed from top to bottom in sequence, firstly, the node a is focused as the current node, the lower-layer node does not meet the condition that the dimension values are all null, and the dimension value of the node a is not null, the node a continues to traverse to the node B; if the lower-layer node of the node B does not meet the condition that the dimensional values are all null, but the dimensional value of the node B is null, the lower-layer node is sequentially lifted upwards by one level, namely the node B is hidden; then, traversing to the node C, if the lower-layer node of the node C does not meet the condition that the dimensional values are all null, and the dimensional value of the node C is not null, continuously traversing to the node D1; if the lower node of the node D1 meets the condition that the dimension values are all null, the original data value of the leaf node F1 is assigned to the node C 'consume credit' which is closest to the leaf node F1 and the dimension value is not null, and the node E1 under the branch of the node is not traversed; then, traversing to a node D2, wherein the lower-layer nodes of the node D2 do not meet the condition that the dimensional values are all null, and the dimensional value of the node D2 is not null, continuing traversing to a node E2 positioned at the second layer from the last, if a leaf node F2 with a null dimensional value exists in the node E2, assigning the original data value of the leaf node F2 to a first index of the node D2 which is closest to the leaf node F2 and has a non-null dimensional value; and traversing to a node E3 which is also positioned at the second last layer, wherein a leaf node F3 with an empty dimension value also exists in the node E2, and the original data value of the leaf node F3 is assigned to a second index position of a node E3 which is closest to the leaf node F3 and has a non-empty dimension value, so that the traversal is completed, and the table head structure of the target cross table is improved.
Further, after step S104 is executed, the original data value at the target leaf node is mounted to the corresponding target node, and the dimension value of the target leaf node is also empty, so that the cell data corresponding to the target leaf node can be hidden, so as to render a clear cross table. For example, in the above example, the cell data corresponding to the leaf nodes F1, F2, and F3, that is, the row where the dashed line box shown in fig. 5 is located, is hidden, and the report form shown in fig. 6 is obtained (the dimension values of the column dimensions in the table are not shown).
In summary, in the method for processing a crossbar table provided in the embodiment of the present description, the original data value corresponding to the target leaf node is promoted to the node with the closest distance and a non-empty dimension value in the node branch where the target leaf node is located, so that the intermediate node in the crossbar table can also mount the original data value, and the data presentation form of the crossbar table is effectively enriched. Therefore, a user can inquire the original data value corresponding to the target node in the promoted target cross table, and does not need to firstly inquire the original data values of all the child nodes of the target node and then occupy resources to calculate the data value of the target node according to the original data values, so that the user can conveniently inquire, the resource occupation is reduced, the user time is saved, and the user experience is improved. For example, in the foregoing application scenario, after the header structure is improved by the cross table processing method provided in the embodiment of the present specification, the user only needs to input "guangdong" to query the values of the transaction amount, the profit, the rate of increase of the ring in comparison with the previous year, and the like of the guangdong province, without first querying the values of the transaction amount, the profit, the rate of increase of the ring in comparison with the previous year, and the like of all cities below the guangdong province, and then additionally occupying resources to count the transaction amount, the profit, the rate of increase of the ring in comparison with the previous year, and the like of the guangdong province.
In addition, the method for processing the cross table provided by the embodiment of the present specification can be applied to a front end, that is, a client, and compared with a method in which a back end returns a complete table structure, the front end only performs a rendering mode, the back end returns source data of the cross table, and the front end processes the source data, so that the data structure of the table can be controlled, the controllability of the front end can be improved, the data presentation form of the cross table can be enriched, and the data presentation of the cross table is more flexible.
In a second aspect, based on the same inventive concept as the method for processing a cross table provided in the foregoing first aspect, an embodiment of the present specification further provides a cross table processing apparatus. As shown in fig. 7, the cross table processing apparatus 70 includes:
an obtaining module 71, configured to obtain source data of a target cross table, where the source data includes header information and an original data value of the target cross table;
the analyzing module 72 is configured to analyze a target dimension in the header information, and determine a tree structure corresponding to the target dimension in the header of the target cross table, where the target dimension is a row dimension and/or a column dimension of the target cross table;
a lifting module 73, configured to lift an original data value corresponding to a target leaf node in the tree structure to the target node in a node branch where the target leaf node is located, where the target leaf node is a leaf node whose dimensional value is null, and the target node is a node in the node branch that is closest to the target leaf node and whose dimensional value is not null.
In an alternative embodiment, the above-mentioned cross table processing apparatus 70 further includes: and the detection module is used for detecting whether a leaf node with an empty dimension value exists in the tree structure, and if so, executing the step of promoting an original data value corresponding to a target leaf node in the tree structure to the target node in the node branch where the target leaf node is located.
In an alternative embodiment, the lifting module 73 comprises: the first lifting submodule 731 is used for sequentially traversing nodes in a first layer to an N-1 layer in a tree structure from top to bottom, detecting whether the dimension values of lower nodes of a current node are all null or not for the nodes in the first layer to the N-2 layer, assigning original data values of leaf nodes in the lower nodes to corresponding target nodes if the dimension values of the lower nodes are all null, and skipping the traversal of the lower nodes of the current node; if not, detecting whether the dimension value of the current node is empty, and if so, sequentially lifting the lower-layer nodes of the current node by one level upwards; the second lifting sub-module 732 is configured to detect, for a node in the N-1 th layer, whether a leaf node with a null dimensional value exists in a current node, and if so, assign an original data value of the leaf node to a corresponding target node, where N is a level height of the tree structure.
In an alternative embodiment, the above-mentioned cross table processing apparatus 70 further includes:
and a hiding module 74, configured to hide cell data corresponding to the target leaf node.
In an alternative embodiment, the parsing module 72 is configured to: acquiring the dimensional values included by each level under the target dimension and the index relation of the dimensional values between adjacent levels from the header information; and determining a tree structure corresponding to the target dimension according to the dimensional values included in each hierarchy and the index relationship of the dimensional values between adjacent hierarchies.
It should be noted that, in the cross table processing apparatus 70 provided in the embodiment of the present specification, specific ways in which the respective modules perform operations have been described in detail in the method embodiment provided in the first aspect, and specific implementation processes may refer to the method embodiment provided in the first aspect, and will not be described in detail here.
In a third aspect, based on the same inventive concept as the method for processing a cross table provided in the foregoing embodiment, an embodiment of the present specification further provides an electronic device. As shown in fig. 8, the electronic device comprises a memory 804, one or more processors 802 and a computer program stored on the memory 804 and executable on the processors 802, the processor 802 implementing the steps of any of the embodiments of the method for cross table processing as provided in the first aspect when executing the program.
Where in fig. 8 a bus architecture (represented by bus 800), bus 800 may include any number of interconnected buses and bridges, bus 800 linking together various circuits including one or more processors, represented by processor 802, and memory, represented by memory 804. The bus 800 may also link together various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. A bus interface 805 provides an interface between the bus 800 and the receiver 801 and transmitter 803. The receiver 801 and the transmitter 803 may be the same element, i.e., a transceiver, providing a means for communicating with various other apparatus over a transmission medium. The processor 802 is responsible for managing the bus 800 and general processing, and the memory 804 may be used for storing data used by the processor 802 in performing operations.
It is to be understood that the structure shown in fig. 8 is merely an illustration, and that the electronic device provided by the embodiments of the present description may further include more or less components than those shown in fig. 8, or have a different configuration than that shown in fig. 8. The components shown in fig. 8 may be implemented in hardware, software, or a combination thereof.
In a fourth aspect, based on the same inventive concept as the cross table processing method provided in the foregoing embodiments, the present specification embodiment further provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements the steps of any one of the embodiments of the cross table processing method provided in the foregoing first aspect.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The description has been presented with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the description. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present specification have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all changes and modifications that fall within the scope of the specification.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present specification without departing from the spirit and scope of the specification. Thus, if such modifications and variations of the present specification fall within the scope of the claims of the present specification and their equivalents, the specification is intended to include such modifications and variations.
Claims (12)
1. A method of cross-table processing, comprising:
acquiring source data of a target cross table, wherein the source data comprises header information and an original data value of the target cross table;
analyzing a target dimension in the header information, and determining a tree structure corresponding to the target dimension in the header of the target cross table, wherein the target dimension is a row dimension and/or a column dimension of the target cross table;
and promoting an original data value corresponding to a target leaf node in the tree structure to the target node in a node branch where the target leaf node is located, wherein the target leaf node is a leaf node with an empty dimensional value, and the target node is a node which is closest to the target leaf node in the node branch and has a non-empty dimensional value.
2. The method of claim 1, wherein the promoting the original data value corresponding to the target leaf node in the tree structure to the target node in the node branch where the target leaf node is located further comprises:
and detecting whether a leaf node with an empty dimension value exists in the tree structure, if so, executing the step of promoting an original data value corresponding to a target leaf node in the tree structure to the target node in the node branch where the target leaf node is located.
3. The method of claim 1, wherein promoting the original data value corresponding to the target leaf node in the tree structure to the target node in the node branch in which the target leaf node is located comprises:
sequentially traversing nodes in a first layer to an N-1 layer in a tree structure from top to bottom, detecting whether the dimension values of lower nodes of a current node are all null or not aiming at the nodes in the first layer to the N-2 layer, if so, assigning original data values of leaf nodes in the lower nodes to corresponding target nodes, and skipping the traversal of the lower nodes of the current node; if not, detecting whether the dimension value of the current node is empty, and if so, sequentially lifting the lower-layer nodes of the current node by one level upwards;
and aiming at the nodes in the N-1 layer, detecting whether a leaf node with an empty dimension value exists in the current node, and if so, assigning the original data value of the leaf node to a corresponding target node, wherein N is the level height of the tree structure.
4. The method of claim 1, after promoting the original data value corresponding to the target leaf node in the tree structure to the target node in the node branch where the target leaf node is located, further comprising:
and hiding the cell data corresponding to the target leaf node.
5. The method of claim 1, wherein the parsing the target dimension in the header information and determining the tree structure corresponding to the target dimension in the target cross table header comprises:
acquiring the dimensional values included by each level under the target dimension and the index relation of the dimensional values between adjacent levels from the header information;
and determining a tree structure corresponding to the target dimension according to the dimensional values included in each hierarchy and the index relationship of the dimensional values between adjacent hierarchies.
6. A crosstable processing apparatus comprising:
the device comprises an acquisition module, a data processing module and a data processing module, wherein the acquisition module is used for acquiring source data of a target cross table, and the source data comprises header information and an original data value of the target cross table;
the analysis module is used for analyzing a target dimension in the header information and determining a tree structure corresponding to the target dimension in the header of the target cross table, wherein the target dimension is a row dimension and/or a column dimension of the target cross table;
and the lifting module is used for lifting an original data value corresponding to a target leaf node in the tree structure to the target node in the node branch where the target leaf node is located, wherein the target leaf node is a leaf node with an empty dimensional value, and the target node is a node which is closest to the target leaf node in the node branch and has a non-empty dimensional value.
7. The apparatus of claim 6, further comprising:
and the detection module is used for detecting whether a leaf node with an empty dimension value exists in the tree structure, and if so, executing the step of promoting an original data value corresponding to a target leaf node in the tree structure to the target node in the node branch where the target leaf node is located.
8. The apparatus of claim 6, the lifting module comprising:
the first lifting sub-module is used for sequentially traversing nodes from the first layer to the (N-1) th layer in the tree structure from top to bottom, detecting whether the dimension values of lower nodes of the current node are all null or not aiming at the nodes from the first layer to the (N-2) th layer, if so, assigning the original data values of leaf nodes in the lower nodes to corresponding target nodes, and skipping the traversal of the lower nodes of the current node; if not, detecting whether the dimension value of the current node is empty, and if so, sequentially lifting the lower-layer nodes of the current node by one level upwards;
and the second promotion submodule is used for detecting whether a leaf node with an empty dimension value exists in the current node or not aiming at the node in the N-1 th layer, and if so, assigning the original data value of the leaf node to a corresponding target node, wherein N is the level height of the tree structure.
9. The apparatus of claim 6, further comprising:
and the hiding module is used for hiding the cell data corresponding to the target leaf node.
10. The apparatus of claim 6, the parsing module to:
acquiring the dimensional values included by each level under the target dimension and the index relation of the dimensional values between adjacent levels from the header information;
and determining a tree structure corresponding to the target dimension according to the dimensional values included in each hierarchy and the index relationship of the dimensional values between adjacent hierarchies.
11. An electronic device, comprising: memory, processor and computer program stored on the memory and executable on the processor, the processor implementing the steps of the method of any one of claims 1-5 when executing the program.
12. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010651178.8A CN111782658B (en) | 2020-07-08 | 2020-07-08 | Cross table processing method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010651178.8A CN111782658B (en) | 2020-07-08 | 2020-07-08 | Cross table processing method and device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111782658A true CN111782658A (en) | 2020-10-16 |
CN111782658B CN111782658B (en) | 2024-06-18 |
Family
ID=72758406
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010651178.8A Active CN111782658B (en) | 2020-07-08 | 2020-07-08 | Cross table processing method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111782658B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113704259A (en) * | 2021-08-24 | 2021-11-26 | 北京仁科互动网络技术有限公司 | Data summarization method, device, electronic equipment, storage medium and program product |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080288529A1 (en) * | 2006-10-10 | 2008-11-20 | International Business Machines Corporation | System to organize data for visualizing performance characteristics in dynamic perspectives using relational database |
US8381095B1 (en) * | 2011-11-07 | 2013-02-19 | International Business Machines Corporation | Automated document revision markup and change control |
CN103561019A (en) * | 2013-10-30 | 2014-02-05 | 上海斐讯数据通信技术有限公司 | Method for TR069 data access |
CN108009193A (en) * | 2017-10-19 | 2018-05-08 | 东软集团股份有限公司 | Data analysing method and device, storage medium, electronic equipment |
CN108647340A (en) * | 2018-05-14 | 2018-10-12 | 浪潮通用软件有限公司 | A kind of multidimensional data real-time analysis method based on dynamic crosstab |
CN108874894A (en) * | 2018-05-21 | 2018-11-23 | 平安科技(深圳)有限公司 | Crosstab deriving method, device, computer equipment and storage medium |
CN109635011A (en) * | 2018-10-31 | 2019-04-16 | 北京辰森世纪科技股份有限公司 | Multistage gauge outfit report processing method, device and equipment based on data service metadata |
CN110019224A (en) * | 2017-12-21 | 2019-07-16 | 天津数观科技有限公司 | A kind of crosstab head generation method based on tree search |
CN110427604A (en) * | 2019-08-15 | 2019-11-08 | 北京明略软件***有限公司 | Table integration method and device |
-
2020
- 2020-07-08 CN CN202010651178.8A patent/CN111782658B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080288529A1 (en) * | 2006-10-10 | 2008-11-20 | International Business Machines Corporation | System to organize data for visualizing performance characteristics in dynamic perspectives using relational database |
US8381095B1 (en) * | 2011-11-07 | 2013-02-19 | International Business Machines Corporation | Automated document revision markup and change control |
CN103561019A (en) * | 2013-10-30 | 2014-02-05 | 上海斐讯数据通信技术有限公司 | Method for TR069 data access |
CN108009193A (en) * | 2017-10-19 | 2018-05-08 | 东软集团股份有限公司 | Data analysing method and device, storage medium, electronic equipment |
CN110019224A (en) * | 2017-12-21 | 2019-07-16 | 天津数观科技有限公司 | A kind of crosstab head generation method based on tree search |
CN108647340A (en) * | 2018-05-14 | 2018-10-12 | 浪潮通用软件有限公司 | A kind of multidimensional data real-time analysis method based on dynamic crosstab |
CN108874894A (en) * | 2018-05-21 | 2018-11-23 | 平安科技(深圳)有限公司 | Crosstab deriving method, device, computer equipment and storage medium |
CN109635011A (en) * | 2018-10-31 | 2019-04-16 | 北京辰森世纪科技股份有限公司 | Multistage gauge outfit report processing method, device and equipment based on data service metadata |
CN110427604A (en) * | 2019-08-15 | 2019-11-08 | 北京明略软件***有限公司 | Table integration method and device |
Non-Patent Citations (1)
Title |
---|
程玉柱;王伟平;王建新;: "一种基于单元空间划分的快速防火墙包分类算法", 工程科学与技术, no. 04, 11 July 2018 (2018-07-11) * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113704259A (en) * | 2021-08-24 | 2021-11-26 | 北京仁科互动网络技术有限公司 | Data summarization method, device, electronic equipment, storage medium and program product |
Also Published As
Publication number | Publication date |
---|---|
CN111782658B (en) | 2024-06-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11977541B2 (en) | Systems and methods for rapid data analysis | |
CN104281701B (en) | Multiscale Distributed Spatial data query method and system | |
CN103577440B (en) | A kind of data processing method and device in non-relational database | |
CN107193967A (en) | A kind of multi-source heterogeneous industry field big data handles full link solution | |
CN109508420B (en) | Method and device for cleaning attributes of knowledge graph | |
US20160328445A1 (en) | Data Query Method and Apparatus | |
US20120078940A1 (en) | Analysis of object structures such as benefits and provider contracts | |
US10650559B2 (en) | Methods and systems for simplified graphical depictions of bipartite graphs | |
CN110825733B (en) | Multi-sampling-stream-oriented time series data management method and system | |
CN112818013A (en) | Time sequence database query optimization method, device, equipment and storage medium | |
CN110874366B (en) | Data processing and inquiring method and device | |
CN111782658A (en) | Cross table processing method, cross table processing device, electronic equipment and storage medium | |
CN102231158B (en) | Data set recommendation method and system | |
CN116662528B (en) | Map self-adaptive recommendation method based on knowledge graph and related equipment | |
CN110765100B (en) | Label generation method and device, computer readable storage medium and server | |
CN110032574B (en) | SQL statement processing method and device | |
CN113094444A (en) | Data processing method, data processing apparatus, computer device, and medium | |
CN115080607A (en) | Method, device, equipment and storage medium for optimizing structured query statement | |
CN114511174A (en) | Service index map construction method and device | |
CN113468383A (en) | Family relation map searching method and device, electronic equipment and storage medium | |
CN108537654B (en) | Rendering method and device of customer relationship network graph, terminal equipment and medium | |
Lloyd et al. | Surface models and the spatial structure of population variables: Exploring smoothing effects using Northern Ireland grid square data | |
CN115827930B (en) | Data query optimization method, system and device for graph database | |
CN116562377A (en) | Factor mining method, device, apparatus, storage medium, and program product | |
CN114722264A (en) | Data query method and device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |