Cross table paging method and system

Through the Cartesian product calculation and SQL template generation of the cross-tab paging system, the rapid conversion from statistical tables to cross-tabs is realized, which solves the problems of memory overflow and service crash caused by large amounts of data, and improves system stability and query efficiency.

CN118535596APending Publication Date: 2024-08-23CHANJET INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410664747.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-27
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

When the existing technology processes cross-tabs, the large amount of data causes memory overflow and service crashes, and it is unable to implement effective paging queries, resulting in poor system stability.

Method used

By constructing a crosstab paging system, it receives user instructions and generates SQL templates, which are then substituted into the Cartesian product generation module to calculate the Cartesian product of column dimensions, and user instructions are generated to complete the conversion of statistical tables to crosstabs and achieve fast paging queries.

Benefits of technology

It solves the problems of memory overflow and service crash caused by excessive data volume, and improves the stability and query efficiency of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535596A
    Figure CN118535596A
Patent Text Reader

Abstract

The invention provides a cross table paging method and system. The method comprises the steps that (1) the cross table paging system constructs an SQL template and receives a user instruction; (2) the cross table paging system substitutes an instruction input by a user into a Cartesian product generation module; (3) the cross table paging system queries all values of the column dimension and calculates the Cartesian product of the column dimension; and (4) generating all column dimension strings to complete a user instruction. According to the method, a user query instruction is received, all column dimension strings are calculated from the user query instruction, a user instruction expression is generated for each input index and substituted into a cross table paging system, a complete query statement is generated, and conversion from a statistical table to a cross table is completed; through quick conversion from the statistical table to the crossover table, the problems of memory overflow and service collapse caused by overlarge data volume are solved, and the stability of the system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of statistical processing, and in particular relates to a cross table paging method and a system thereof. Background Art

[0002] The format of the statistical table is directly related to the query of the relational database. The user specifies what is the dimension and what is the indicator, and based on what filtering conditions and sorting rules, this requirement can be directly translated into SQL, queried in the database, and the statistical results can be obtained. For example, the user specifies three dimensions, product category, product, and time (quarter), where product category is a hierarchical dimension with a level of 3, and two indicators, the main quantity and amount. The result is as follows: Figure 1 As shown in the table, the dimensions and indicators specified in the query have a unique column corresponding to them (different levels are calculated according to different dimensions). For the same statistics, if quarter is selected as the cross dimension, that is, the statistical data of the quarter are in different columns, the above results will be displayed as Figure 2 As shown, through Figure 2 It can be seen that in the crosstab, even the first row requires data from all quarters. One row of the crosstab may actually contain data from four rows of the statistical table, but because the data for a certain quarter may be empty, there is no fixed correspondence between the rows of the statistical table and the crosstab. In this display method, the column dimension does not have only one column, but there are as many columns as there are groups on this dimension, and all indicators are under it. This is the characteristic of the crosstab. Generally, the dimension displayed on the row is called the row dimension, and the dimension displayed on the column is called the column dimension.

[0003] When processing crosstabs, most implementations load all the data, convert the statistical table results found by SQL into crosstabs in the program, and then return the results without paging. Figure 1 Data in the form of a cross table cannot be given, and naturally paging is impossible. However, in reality, we also encounter problems such as large amounts of data in a cross table, which makes it inconvenient to display or export, and even memory overflow and service crashes due to excessive data volume. Summary of the invention

[0004] The present invention provides a cross-table paging method, the improvement of which is that the method comprises

[0005] (1) The cross-table paging system builds SQL templates and receives user instructions;

[0006] (2) The cross-tab paging system substitutes the user input command into the Cartesian product generation module;

[0007] (3) The cross-tab paging system queries all values ​​of the column dimension and calculates the Cartesian product of the column dimension;

[0008] (4) Generate all column dimension strings to complete user instructions.

[0009] Furthermore, the step (1) includes constructing a SQL template in the cross-tab paging system including a field module, a data source module, a filter condition module, a result filter condition module, a grouping module, a sorting module and a paging module, and storing the instructions input by relevant users in the cross-tab paging system through a template generator in the cross-tab paging system.

[0010] Furthermore, the step (2) includes the cross-tab paging system substituting the query conditions, sorting, paging information and row dimension instructions input by the user into the Cartesian product generation module of the cross-tab paging system.

[0011] Furthermore, the step (3) includes querying all values ​​of each column dimension by the cross-table paging system, and calculating the Cartesian product of the column dimensions in order.

[0012] Furthermore, the step (4) includes the cross-table paging system generating a column dimension value string for each element of the Cartesian product of the column dimension values, thereby generating a user instruction.

[0013] Furthermore, the user instruction is a complete query statement, that is, the conversion from the statistical table to the cross table is completed.

[0014] Based on another purpose, the present invention also provides a cross-table paging system, the improvement of which is that the system includes a template generator, a query module, an SQL generator and a Cartesian product generation module;

[0015] The template generator is used to store the instructions input by the relevant users into the cross-table paging system;

[0016] The query module is used to query the query conditions, sorting, paging information and row dimensions input by the user; and is used to query all values ​​of each column dimension;

[0017] The Cartesian product generation module is used to generate all column dimension strings, and generate a column dimension value string for each element of the Cartesian product of the column dimension value;

[0018] The SQL generator is used to generate a complete user instruction for the user.

[0019] A cross-table paging system of the present application comprises a processor and a computer program stored in the memory and running on the processor, and the processor implements a cross-table paging method as described in any one of claims 1 to 6 when processing the computer program.

[0020] Beneficial effects:

[0021] The present invention receives user query instructions, calculates all column dimension strings therefrom, generates a user instruction expression for each input indicator, substitutes it into the cross-table paging system, generates a complete query statement, and completes the conversion from a statistical table to a cross-table; through the rapid conversion from the statistical table to the cross-table, the problem of memory overflow and service crash caused by excessive data volume is solved, and the stability of the system is improved.

[0022] It should be understood that the above general description and the following specific embodiments are only exemplary and illustrative and do not limit the scope of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 For the conventional statistical representation provided according to the present invention;

[0024] Figure 2 A cross-sectional view of a conventional structure provided according to the present invention;

[0025] Figure 3 A flow chart of a cross-table paging method according to the present invention;

[0026] Figure 4 A schematic diagram of a cross-table paging system according to the present invention;

[0027] Figure 5 A schematic diagram of an SQL template in a cross-table paging system according to the present invention;

[0028] Figure 6 The present invention is a schematic diagram of indicators under column dimensions in a cross-tab paging system.

[0029] It should be understood that the drawings are not necessarily drawn to scale, presenting somewhat simplified representations of various features illustrative of the basic principles of the present disclosure. The specific design features of the present invention as disclosed herein, including, for example, specific dimensions, orientations, locations, and shapes will be determined in part by the particular intended application and use environment.

[0030] In the drawings, reference numbers refer to the same or equivalent parts of the present invention throughout the several figures of the drawing. DETAILED DESCRIPTION

[0031] Reference will now be made in detail to various embodiments of the present invention, examples of which are illustrated in the accompanying drawings and described below. Although the present invention will be described in conjunction with exemplary embodiments of the present invention, it should be understood that this specification is not intended to limit the present invention to those exemplary embodiments. On the other hand, the present invention is intended to cover not only the exemplary embodiments of the present invention, but also various alternatives, modifiers, equivalents and other embodiments, which may be included in the spirit and scope of the present invention as defined by the appended claims.

[0032] Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings. The specific structures and functions described in the exemplary embodiments of the present invention are for illustrative purposes only. Embodiments according to the concepts of the present invention can be implemented in various forms, and it should be understood that they should not be interpreted as being limited to the exemplary embodiments described in the exemplary embodiments, but include all modifications, equivalents or substitutes included in the spirit and scope of the present invention.

[0033] Throughout the specification, the professional terms used herein are only for describing various exemplary embodiments and are not intended to be limiting. It will be further understood that the terms "include", "comprising", "having", etc., when used in the exemplary embodiments, specifically refer to the presence of the stated parts, steps, operations or elements, but do not exclude the presence or addition of one or more other parts, steps, operations or elements.

[0034] like Figure 3 As shown, the present invention provides a cross-table paging method, the method comprising

[0035] (1) The cross-table paging system builds SQL templates and receives user instructions;

[0036] like Figure 5 As shown, the SQL template for constructing the cross-tab paging system includes the field module, data source module, filter condition module, result filter condition module, grouping module, sorting module and paging module; among them, the row dimension, primary table, association, filter condition, result filter condition, sorting field, number of rows and starting row are passed in by the user in the query and need to be generated as expressions of indicators under the column dimension.

[0037] The core logic of the expression of the indicator under the column dimension is that, assuming that the column dimension has multiple possible values, the sum of the indicators of one of the values ​​is calculated through a conditional judgment. If the value of the current column dimension is equal to the specified value, the data of the indicator of the current row is added, otherwise, it is not added. This can be achieved by using statements such as IF or CASE WHEN.

[0038] and storing the instructions input by the relevant user into the cross-tab paging system through the template generator in the cross-tab paging system;

[0039] In order to solve the situation of any number of cross-dimensions, the components of the statistical query are processed as follows:

[0040] Row Dimension: Grouping based on data characteristics, data is displayed in two-dimensional table rows;

[0041] Column Dimension: The data is grouped according to its characteristics. The data is displayed in the columns of the two-dimensional table, at the table header position. Each column dimension group is a new table header group. Each table header group contains all the indicators.

[0042] Column dimension indicators: Statistics of the whole or part of the data based on the original data, displayed on the rows in the two-dimensional table.

[0043] The column dimension indicator includes an aggregation function unit, a column dimension expression unit, a column dimension value unit, an indicator expression unit and an indicator alias unit under the column dimension;

[0044] like Figure 6 As shown in the figure, the aggregation function unit, column dimension expression unit, and indicator expression unit are database column names with aliases passed in by the user. The column dimension value unit is used to calculate the Cartesian product of the subsequent column dimensions. The indicator alias unit under the column dimension consists of two parts: column dimension value combination and indicator name. The column dimension value combination is to express the Cartesian product of data of different column dimensions in a string, and use a suitable separator to concatenate the values ​​of each column dimension into a string. The indicator alias under the column dimension is obtained by user input.

[0045] (2) The cross-tab paging system substitutes the user input command into the Cartesian product generation module;

[0046] The cross-tab paging system substitutes the query conditions, sorting, paging information, row dimensions and other instructions input by the user into the Cartesian product generation module of the cross-tab paging system through the internal query module.

[0047] (3) The cross-tab paging system queries all values ​​of the column dimension and calculates the Cartesian product of the column dimension;

[0048] The crosstab paging system queries all values ​​of each column dimension and then calculates the Cartesian product of the column dimensions in order.

[0049] (4) Generate all column dimension strings to complete user instructions;

[0050] The cross-table paging system generates all column dimension strings through the Cartesian product generation module, generates a column dimension value string for each element of the Cartesian product of the column dimension values, and generates a complete user instruction (such as a query instruction) for the user through the internal SQL generator;

[0051] In the above technical solution, the column dimension string obtained above is used to generate a user instruction expression for each input indicator according to the above method, and is substituted into the cross-tab paging system to generate a complete query statement to complete the conversion from the statistical table to the cross-tab.

[0052] like Figure 4 As shown, the present invention further provides a cross-table paging system based on another purpose, the system includes a template generator, a query module, an SQL generator and a Cartesian product generation module;

[0053] The template generator is used to store the instructions input by the relevant users into the cross-table paging system;

[0054] The query module is used to query the query conditions, sorting, paging information and row dimensions input by the user; and is used to query all values ​​of each column dimension;

[0055] The Cartesian product generation module is used to generate all column dimension strings, and generate a column dimension value string for each element of the Cartesian product of the column dimension value;

[0056] The SQL generator is used to generate a complete user instruction for the user.

[0057] Example:

[0058] The cross-tab paging system builds SQL templates and receives user instructions;

[0059] Assume that there are n row dimensions in the statistical user instruction:

[0060] r1,r2,…rn

[0061] There are m column dimensions (generally limited to m <= 3):

[0062] c1,c2,…cm

[0063] There is 1 indicator (multiple indicators are similar to one indicator):

[0064] When calculating the value of a column dimension, a Cartesian product is performed. Here, the set of all values ​​of column dimension C is defined as C, and the Cartesian product of column dimensions C1, C2, and Cm is calculated:

[0065] C1 x C2 x C3 x…x Cm.

[0066] For example, if C1 is {"North China", "South China"}, C2 is {"Snacks", "Fruits", "Staple Food", "Meat"}, and C3 is {"January", "February", "March"}, then the Cartesian product C1x C2 x C3 is:

[0067] ("North China", "Snacks", "January"), ("North China", "Snacks", "February"), ("North China", "Snacks", "March"),

[0068] ("North China", "Fruits", "January"), ("North China", "Fruits", "February"), ("North China", "Fruits", "March"),

[0069] ("North China", "Staple Food", "January"), ("North China", "Staple Food", "February"), ("North China", "Staple Food", "March"),

[0070] ("North China", "Meat", "January"), ("North China", "Meat", "February"), ("North China", "Meat", "March"),

[0071] ("South China", "Snacks", "January"), ("South China", "Snacks", "February"), ("South China", "Snacks", "March"),

[0072] ("South China", "Fruits", "January"), ("South China", "Fruits", "February"), ("South China", "Fruits", "March"),

[0073] ("South China", "Staple Food", "January"), ("South China", "Staple Food", "February"), ("South China", "Staple Food", "March"),

[0074] ("South China", "Meat", "January"), ("South China", "Meat", "February"), ("South China", "Meat", "March")

[0075] A column dimension value list is generated for each element of the Cartesian product of the column dimension, and finally a complete query is assembled to complete the conversion from the statistical table to the cross table.

[0076] The above-mentioned embodiments of the present application can be implemented in various hardware, software coding or a combination of the two. For example, the embodiments of the present application can also represent the program code for executing the above-mentioned method in a data signal processor. The present application can also relate to the various functions performed by a computer processor, a digital signal processor, a microprocessor or a field programmable gate array. The above-mentioned processor can be configured according to the present application to perform specific tasks, which are completed by executing machine-readable software code or firmware code that defines the specific method disclosed by the present application. The software code or firmware code development can represent different programming languages ​​and different formats or forms. Different target platform compiled software codes can also be represented. However, the different code styles, types and languages ​​of the software code for performing tasks according to the present application and other types of configuration codes do not depart from the spirit and scope of the present application.

[0077] The foregoing description of specific exemplary embodiments of the present invention has been presented for the purpose of illustration and description. It is not intended to exclude or limit the present invention to the precise form disclosed, and it is obvious that many modifications and changes are feasible in view of the above teachings. Exemplary embodiments are selected and described to explain certain principles of the present invention and their practical application, so that other technicians in the field can make or use various exemplary embodiments of the present invention, and various alternatives and modifications thereof. It is intended that the scope of the present invention will be defined by the claims attached hereto and their equivalents.

[0078] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present invention, but the present invention is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and essence of the present invention, and these modifications and improvements are also considered to be within the scope of protection of the present invention.

Claims

1. A cross-table paging method, characterized in that: The method comprises (1) The cross-table paging system builds SQL templates and receives user instructions; (2) The cross-tab paging system substitutes the user input command into the Cartesian product generation module; (3) The cross-tab paging system queries all values ​​of the column dimension and calculates the Cartesian product of the column dimension; (4) Generate all column dimension strings to complete user instructions.

2. A cross-table paging method according to claim 1, characterized in that: The step (1) includes constructing a SQL template in a cross-tab paging system including a field module, a data source module, a filter condition module, a result filter condition module, a grouping module, a sorting module and a paging module, and storing the instructions input by relevant users in the cross-tab paging system through a template generator in the cross-tab paging system.

3. A cross-table paging method according to claim 1, characterized in that: The step (2) includes the cross-table paging system substituting the query conditions, sorting, paging information and row dimension instructions input by the user into the Cartesian product generation module of the cross-table paging system.

4. A cross-table paging method according to claim 1, characterized in that: The step (3) includes querying all values ​​of each column dimension by the cross-table paging system, and calculating the Cartesian product of the column dimensions in order.

5. A cross-table paging method according to claim 1, characterized in that: The step (4) includes the cross-table paging system generating a column dimension value string for each element of the Cartesian product of the column dimension values, thereby generating a user instruction.

6. A cross-table paging method according to claim 1, characterized in that: The user instruction is a complete query statement, that is, the conversion from the statistical table to the cross table is completed.

7. A cross-table paging system, characterized in that: The system includes a template generator, a query module, an SQL generator and a Cartesian product generation module; The template generator is used to store the instructions input by the relevant users into the cross-table paging system; The query module is used to query the query conditions, sorting, paging information and row dimensions input by the user; and is used to query all values ​​of each column dimension; The Cartesian product generation module is used to generate all column dimension strings, and generate a column dimension value string for each element of the Cartesian product of the column dimension value; The SQL generator is used to generate a complete user instruction for the user.