Data processing method, data processing device, computer equipment and medium
By aggregating data sources multiple times and filtering out aggregate tables that meet the query request, the problem in the existing technology that users need to select from multiple tables is solved, query efficiency is improved and costs are reduced.
Patent Information
- Application Number
- CN202010024591.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-01-09
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2040-01-09
AI Technical Summary
Existing data warehouses need to select tables that meet query requirements from multiple aggregate tables when users query, which increases user learning costs and server-side maintenance costs.
By aggregating the data source multiple times, multiple aggregation tables are generated, and the most suitable tables are selected and sent to the client according to the query request, reducing the number of user selection steps.
It reduces users' learning and usage costs, improves query efficiency, and enables users to quickly obtain interesting data.
Smart Images

Figure CN113094444B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and more specifically, to a data processing method, a data processing device, a computer equipment, and a medium. Background Art
[0002] In related technologies, when users send query requests to data warehouses, they need to specify data sources and aggregate tables. However, as business needs change, the dimensions of user analysis also change, which will result in multiple aggregate tables being aggregated from one data source. The data tables in existing data warehouses can be considered as materialized views or indexes in the database. Each time a user issues a query request, they need to select a table that meets the query requirements and has the best query performance from the large number of aggregate tables returned. Therefore, users need to have a clear understanding of the structure and model of the data tables. This not only increases the user's learning cost, but also increases the maintenance cost of the server. Summary of the invention
[0003] In view of this, the present disclosure provides a data processing method, a data processing apparatus, a computer device, and a medium.
[0004] One aspect of the present disclosure provides a data processing method, including: obtaining a data source. The data source includes at least one dimension item and at least one indicator item. The data source is aggregated multiple times to obtain multiple aggregate tables. A query request from a client is received, and an aggregate table that meets the query request is obtained from the multiple aggregate tables. The aggregate table that meets the query request is then sent to the client.
[0005] According to an embodiment of the present disclosure, the above-mentioned multiple aggregations of the data source to obtain multiple aggregation tables include: for any aggregation in the multiple aggregations, determining a dimension item for the any aggregation from at least one dimension item, determining an index item for the any aggregation from at least one index item, and determining an aggregation function for the any aggregation. Based on the dimension item for the any aggregation, the index item for the any aggregation, and the aggregation function for the any aggregation, the data source is aggregated to obtain an aggregation table for the any aggregation.
[0006] According to an embodiment of the present disclosure, the data source performs data update and version update every predetermined period. The version of any aggregate table among the plurality of aggregate tables is the same as the version of the data source for the any aggregate table.
[0007] According to an embodiment of the present disclosure, the query request includes a query version. The above-mentioned filtering from the multiple aggregate tables to obtain an aggregate table that meets the query request includes: filtering the multiple aggregate tables according to the query version to obtain an aggregate table that has undergone a first filtering.
[0008] According to an embodiment of the present disclosure, the query request also includes: specifying dimension items and specifying indicator items. The above-mentioned filtering from multiple aggregation tables to obtain an aggregation table that meets the query request also includes: filtering the aggregation table containing the specified dimension items and the specified indicator items from the aggregation tables that have undergone the first filtering to obtain the aggregation table that has undergone the second filtering.
[0009] According to an embodiment of the present disclosure, the query request also includes a filtering condition, and the filtering condition includes a specified dimension item and a value of the specified dimension item. The above-mentioned screening of the aggregated table that meets the query request from multiple aggregated tables also includes: for any aggregated table in the aggregated tables that have undergone the second screening, searching the dimension items in the any aggregated table in a predetermined order. Match each searched dimension item with the specified dimension item. If the match is successful, determine the weight of the dimension item, and continue to search for the next dimension item. If the match fails, end the search. Then, based on the determined weight of the dimension item, determine the score of any aggregated table. After determining the scores of each aggregated table that has undergone the second screening, screen the aggregated table with the highest score as the aggregated table that has undergone the third screening.
[0010] According to an embodiment of the present disclosure, the above-mentioned filtering out the aggregate table meeting the query request from the plurality of aggregate tables further includes: filtering out the aggregate table having the smallest number of dimension items and / or the smallest amount of data from the aggregate tables that have undergone the third filtering.
[0011] Another aspect of the present disclosure provides a data processing device, including: an acquisition module, an aggregation module, a receiving module, a screening module and a sending module. The acquisition module is used to acquire a data source. The data source includes at least one dimension item and at least one index item. The aggregation module is used to perform multiple aggregations on the data source to obtain multiple aggregation tables. The dimension items of each of the multiple aggregation tables are different, and / or the index items of each of the multiple aggregation tables are different. The receiving module is used to receive a query request from a client. The screening module is used to filter out an aggregation table that meets the query request from multiple aggregation tables. The sending module is used to send the aggregation table that meets the query request to the client.
[0012] Another aspect of the present disclosure provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above method when executing the program.
[0013] Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the above method when executed.
[0014] Another aspect of the present disclosure provides a computer program, which includes computer executable instructions, and the instructions are used to implement the method described above when executed.
[0015] According to the embodiments of the present disclosure, when a user needs to query an aggregate table about certain dimensions or certain indicators, an aggregate table that best meets the query request is screened out from multiple aggregate tables obtained in advance based on the query request, and the screened aggregate table is returned to the client. It is not necessary to return multiple aggregate tables to the client as in the related art, and thus the user does not need to select from the multiple aggregate tables returned, so that the user can obtain the data of interest as quickly as possible without paying a lot of learning and use costs, which meets the needs of users. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0017] Figure 1 The exemplary system architecture of the application data processing method and the data processing device according to the embodiment of the present disclosure is schematically shown;
[0018] Figure 2 A flowchart schematically shows a data processing method according to an embodiment of the present disclosure;
[0019] Figure 3 A flowchart schematically shows a data processing method according to another embodiment of the present disclosure;
[0020] Figure 4 A block diagram schematically shows a data processing device according to an embodiment of the present disclosure; and
[0021] Figure 5 The block diagram of a computer device according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0022] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0023] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0024] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.
[0025] In the case of using expressions such as "at least one of A, B, and C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.). In the case of using expressions such as "at least one of A, B, or C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, or C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0026] The embodiments of the present disclosure provide a data processing method and a data processing device. The method includes a preparation process, a receiving process and a routing process. The preparation process can be divided into an acquisition process and an aggregation process. In the acquisition process, a data source is acquired. The data source includes at least one dimension item and at least one index item. In the aggregation process, the acquired data sources are aggregated multiple times to obtain multiple aggregation tables. The dimension items of the multiple aggregation tables are different, and / or the index items of the multiple aggregation tables are different. After the preparation is completed, the receiving process can be performed. In the receiving process, a query request from a client is received. Then a routing process is performed, and the routing process can be divided into a screening process and a sending process. In the screening process, an aggregation table that meets the query request is screened from the above-mentioned multiple aggregation tables. In the sending process, the screened aggregation table that meets the query request is sent to the corresponding client.
[0027] Figure 1 The exemplary system architecture 100 to which the data processing method and the data processing device according to the embodiment of the present disclosure can be applied is schematically shown. It should be noted that: Figure 1What is shown is merely an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0028] like Figure 1 As shown, the system architecture 100 may include a terminal device 101, a network 102, a primary server 103, and secondary servers 104, 105, and 106. Servers at different levels or at the same level may provide data related to different businesses.
[0029] The network 102 is a medium for providing a communication link between the terminal device 101 and the primary server 103. The network 102 may include various connection types, such as wired or wireless communication links or optical fiber cables, etc. The primary server 103 may communicate with the secondary servers 104, 105, 106 through various wired or wireless communication links.
[0030] The terminal device 101 can be various electronic devices, including but not limited to smart phones, personal computers, tablet computers, smart watches, etc., which are not limited here.
[0031] Client applications (hereinafter referred to as "clients") with various functions can be installed in the terminal device 101. The functional support of each client in the terminal device 101 can be decomposed into servers at various levels. For example, a client in the terminal device 101 has an advertisement delivery function. The user sends an advertisement delivery request to the first-level server 103 through the terminal device 101. The first-level server 103 delivers advertisements for different services through different second-level servers. For users who have delivered advertisements, they will frequently check the delivery effect of the advertisements after the advertisements are delivered. The first-level server 103 needs to collect data that can characterize the effect of the advertisement delivery from each second-level server 104, 105, and 106, and push it to the terminal device 101 in the form of a report so as to display it to the user. This example takes the advertisement delivery business scenario as an example. In other examples, it can be applied to various business scenarios and is not limited here.
[0032] It should be understood that Figure 1 The number of terminal devices, networks, primary servers and secondary servers, and the number of server levels are only for illustration purposes and can be set to any number according to actual needs.
[0033] At present, Online Analytical Processing (OLAP) technology is widely used in data analysis and intelligent decision-making. The above process of collecting data and forming reports can apply the OLAP technology.
[0034] OLAP technology mainly uses data warehouses for data storage and query. Although various data warehouses have large differences in architecture design and implementation details due to different application scenarios, they all allow users to analyze multidimensional data from multiple perspectives. The most commonly used one is Roll-Up, which means aggregating data along a certain dimension according to certain rules. Along a certain dimension, that is, aggregating from the sub-class dimension to the parent-class dimension according to the hierarchical relationship. In actual engineering practice, in order to meet the needs of different analysis dimensions, it is usually necessary to establish multiple Roll-Up tables (also called "aggregation tables") based on the same data source. These Roll-Up tables have different table schemas and are distinguished by different names. When users want to analyze data from a new dimension, if the original Roll-Up table cannot meet the needs, it is necessary to establish a new Roll-Up table based on the dimension analyzed by the user, and construct a new request based on the new Roll-Up table name to obtain data.
[0035] When users send query requests to the data warehouse, they need to specify the data source and Roll-Up table. However, as business needs change, the dimensions of user analysis also change, which will result in multiple aggregate tables being aggregated from one data source. The Roll-Up table of the existing data warehouse can be considered as a materialized view or index in the database. Every time a user issues a query request, he needs to select a table that meets the query requirements and has the best query performance from the large number of returned Roll-Up tables. Therefore, users need to have a clear understanding of the schema and data model of the Roll-Up table, which not only increases the user's learning cost, but also increases the maintenance cost of the server.
[0036] When users make query requests, they do not actually care how many Roll-Up tables there are on the specified data source, or the schema of each Roll-Up table. Users only need to care about the data structure under the dimensions and indicators that meet the filtering conditions. Therefore, the data warehouse should have a strategy to automatically route requests to the optimal Roll-Up table to reduce the user's learning and usage costs.
[0037] According to an embodiment of the present disclosure, a data processing method for returning data results that best meet user needs in response to a user's query request is provided. The method is exemplarily described below through a legend. It should be noted that the sequence number of each operation in the following method is only used as a representation of the operation for the purpose of description, and should not be regarded as indicating the execution order of the various operations. Unless explicitly stated, the method does not need to be executed in the order shown.
[0038] Figure 2 The flowchart of the data processing method according to the embodiment of the present disclosure is schematically shown.
[0039] like Figure 2 As shown, the method may include operations S201 to S205.
[0040] In operation S201, a data source is acquired.
[0041] The data source includes at least one dimension (key) item and at least one indicator (value) item.
[0042] For example, in the business scenario of advertising, the data source is in the form of a table, which can be called a base table (BaseTable), and the data source contains all dimension items and indicator items supported by the query, as shown in Table 1.
[0043] Table 1
[0044] ID Date City Clicks Cost 1 2017 Beijing 100 10 1 2017 Shanghai 100 10 1 2018 Beijing 200 20 2 2017 Beijing 150 15 2 2017 Shanghai 200 20 2 2018 Beijing 200 20
[0045] In Table 1, it can be seen from the header that there are three dimension items: ID (identification information), Date (date) and City (city), as well as two indicator items: Clicks (number of clicks) and Cost (consumption amount). The body of the table lists 6 data, each of which includes the value of the dimension item "ID", the value of the dimension item "Date", the value of the dimension item "City", the value of the indicator item "Clicks", and the value of the indicator item "Cost". In this example, different dimension items can be used to represent different advertising effect data, such as the identification information of the user who places the advertisement, the delivery plan, the delivery unit, the advertising creativity, etc., which can be divided according to actual business needs and are not limited here. The indicator items are specific data presentations of the advertising delivery effect, such as clicks, displays and consumption, which can be divided according to actual business needs and are not limited here. Table 1 above is only for illustrative purposes. In other scenarios, the dimension items and indicator items in the data source can be flexibly changed. For example, in a business scenario for music recommendation, the dimension items can be divided into music type, musician, recommendation time, etc., and the indicator items can be divided into the number of plays, the number of likes, the number of favorites, etc.
[0046] Then, in operation S202, the data sources are aggregated multiple times to obtain multiple aggregate tables.
[0047] Among them, in order to facilitate user queries, the data source is aggregated into multiple aggregate tables according to different dimension items and / or indicator items. The dimension items of each of the multiple aggregate tables are different, and / or the indicator items of each of the multiple aggregate tables are different. The data source contains all the dimension items and indicator items supported by the query, and the aggregated aggregate table generally only contains some dimension items and / or some indicator items. Multiple aggregate tables are different from each other, and the difference between any two aggregate tables is reflected in at least one of the following: different dimension items, different indicator items and different aggregation methods.
[0048] Next, in operation S203, a query request from the client is received.
[0049] The query request from the client may include one or more parameters that can describe the user's query target.
[0050] Next, in operation S204, an aggregate table that meets the query request is obtained by screening from the plurality of aggregate tables.
[0051] Here, this operation S204 selects from the multiple aggregate tables an aggregate table that matches all parameters in the query request as a query result for the query request.
[0052] Next, in operation S205, the aggregated table obtained by screening and meeting the query request is sent to the client.
[0053] Those skilled in the art can understand that according to the data processing method of the embodiment of the present disclosure, when a user needs to query an aggregate table about certain dimensions or certain indicators, the aggregate table that best meets the query request is screened out from the multiple aggregate tables obtained in advance based on the query request, and then the screened aggregate table is returned to the client. There is no need to return multiple aggregate tables to the client as in the related art, so that the user does not need to select from the multiple aggregate tables returned, so that the user can obtain the data of interest as quickly as possible without paying a lot of learning and use costs, which meets the needs of users.
[0054] According to an embodiment of the present disclosure, taking an aggregation process as an example, the process of performing multiple aggregations on the data source to obtain multiple aggregation tables is exemplarily described. For any aggregation in the multiple aggregations, first, a dimension item for the aggregation is determined from at least one dimension item contained in the data source, an index item for the aggregation is determined from at least one index item contained in the data source, and an aggregation function for the aggregation is also determined. Then, based on the dimension item for the aggregation, the index item for the aggregation, and the aggregation function for the aggregation, the data source is aggregated to obtain an aggregation table for the aggregation.
[0055] Exemplarily, when data is imported into a data source, in order to facilitate data analysis, the data can be sorted in ascending or descending order according to the value of the dimension item. If there are multiple dimension items, they are sorted in a predefined order. As shown in Table 1 above, the order of the predefined dimension items is "ID" → "Date" → "City". The multiple data are preferentially sorted in ascending order according to the value of the dimension item "ID". For data with the same value of the dimension item "ID", they are sorted in ascending order according to the value of the dimension item "Date". For data with the same value of the dimension item "Date", they are sorted in ascending order according to the value of the dimension item "City". Among them, according to the different types of values of each dimension item, a sorting rule suitable for its type is used, such as sorting integers by size, sorting date types by time, etc.
[0056] When a data source is aggregated once, it is first determined that the dimension items for this aggregation operation include dimension items K1 and dimension items K2, the index items for this aggregation operation include index items V1, and the aggregation function f for this aggregation operation. In the data source, if there are N data with the same value of dimension item K1 and the same value of dimension item K1, then the values of index item V1 of the N data are aggregated based on the aggregation function f to aggregate the N data into one data corresponding to dimension item K1, dimension item K2 and index item V1, where N is a positive integer greater than 1. Among them, commonly used aggregation functions may include: sum (Sum), count (Count), minimum value (Min), maximum value (Max), etc. Exemplarily, the data source is shown in Table 2, including dimension item "Date", dimension item "City" and index item "Cost".
[0057] Table 2
[0058] Date City Cost 2017 Beijing 10 2017 Tianjin 20 2018 Beijing 10 2018 Tianjin 20
[0059] The data source is aggregated for the first time to obtain the aggregation table shown in Table 3. The dimension item for this aggregation is "Date", the indicator item for this aggregation is "Cost", and the aggregation function for this aggregation is the sum function.
[0060] Table 3
[0061] Date Cost 2017 30 2018 30
[0062] The data source is aggregated for the second time to obtain the aggregation table shown in Table 4. The dimension item for this aggregation is "City", the indicator item for this aggregation is "Cost", and the aggregation function for this aggregation is also a sum function.
[0063] Table 4
[0064] City Cost Beijing 20 Tianjin 40
[0065] In the embodiments of the present disclosure, since the data monitored by the data source will be continuously generated over time, the data source performs data updates and version updates every predetermined period. For example, the basic table of the data source formed by the first data injection is used as the data source of version 1, and the basic table of the data source formed by the second data injection is used as the data source of version 2, and so on. When performing an aggregation operation, the aggregated table obtained by the aggregation has the same version as the data source targeted by the aggregation operation. For example, if Table 3 above is obtained by aggregation of a data source of version 1, the version number of Table 3 is set to version 1.
[0066] According to an embodiment of the present disclosure, a query request from a client may include a query version. The above process of filtering from multiple aggregate tables to obtain an aggregate table that meets the query request may include: filtering multiple aggregate tables according to the query version to obtain an aggregate table that has undergone a first filter. For example, the latest version of the data source in the server is version 3, and the user wants to view the latest version of aggregate data, then the query request includes a parameter representing "version 3". For example, the server includes a distributed first server, a second server, and a third server, wherein the first server and the second server have been updated to version 3, and due to the delay between the machines, the third server is currently only updated to version 2. When a query request containing a parameter representing "version 3" is assigned to the first server or the second server, the first server or the second server filters out an aggregate table with a version number of "version 3" based on the query request, and returns the filtered aggregate table to the user. When a query request containing a parameter representing "version 3" is assigned to the third server, the third server finds that there is currently no aggregate table with a version number of "version 3" based on the query request, and returns a prompt message of "no query results found" to the user. By accurately filtering the query version, the problem of inconsistent data aggregation results caused by asynchronous data updates between different machines can be avoided. The first filtering can be called version rule-based filtering.
[0067] According to an embodiment of the present disclosure, a query request may further include: specified dimension items and specified indicator items. There may be one or more specified dimension items, and there may be one or more specified indicator items. The specified dimension items and the specified indicator items represent the dimension items and indicator items that the user who is making the query is concerned about. The above process of filtering from multiple aggregate tables to obtain an aggregate table that meets the query request may also include: filtering the aggregate table containing the specified dimension items and the specified indicator items from the aggregate tables that have undergone the first filtering to obtain an aggregate table that has undergone the second filtering. The second filtering may be referred to as filtering based on query item rules.
[0068] It can be understood that the aggregate table after the second screening contains the dimension items and indicator items that the user is concerned about, but it may also contain some dimension items and indicator items that the user is not concerned about. And if the sorting method is inappropriate, it will lead to low efficiency in users finding the dimension items and indicator items they are concerned about. For this reason, the aggregate table after the second screening can be further subjected to a third screening. According to an embodiment of the present disclosure, the query request can also include a filtering condition, and the filtering condition includes a specified dimension item and the value of the specified dimension item. There can be one or more specified dimension items.
[0069] The above process of filtering from multiple aggregation tables to obtain an aggregation table that meets the query request may also include: for any aggregation table among the aggregation tables that have undergone the second screening, searching the dimension items in the any aggregation table in a predetermined order. Match each dimension item searched with the specified dimension item. If the match is successful, determine the weight of the dimension item, and continue to search for the next dimension item. If the match fails, end the search. Then, based on the determined weight of the dimension item, determine the score of any aggregation table. After determining the scores of each aggregation table that has undergone the second screening, filter the aggregation table with the highest score as the aggregation table that has undergone the third screening. The higher the score of an aggregation table, the faster all specified dimension items and the values of all specified dimension items can be found in the aggregation table in a predetermined order. The third screening can be called screening based on filtering and sorting rules.
[0070] Further, according to an embodiment of the present disclosure, the above-mentioned screening from multiple aggregation tables to obtain an aggregation table that meets the query request may also include: screening out an aggregation table with the smallest number of dimension items and / or the smallest amount of data from the aggregation tables that have undergone the third screening. For example, if the dimension items are set by column, then an aggregation table with fewer columns corresponding to the dimension items is selected, because the aggregation table with fewer columns corresponding to the dimension items has a higher aggregation granularity, less data, and higher query efficiency. Similarly, the number of rows in the aggregation table represents the amount of data, so selecting an aggregation table with fewer rows has less data and higher query efficiency.
[0071] Reference below Figure 3 , each of the above embodiments is exemplarily described with reference to specific examples.
[0072] Figure 3 A flowchart of a data processing method according to another embodiment of the present disclosure is schematically shown. Figure 3 In the example shown, the data source is shown in Table 1, where different dimension items are distributed by column, different indicator items are also distributed by column, and different data are distributed by row. Hereinafter, the column corresponding to the dimension item is referred to as the dimension column, and the column corresponding to the indicator item is referred to as the indicator column. Multiple aggregation tables are obtained by aggregating the data sources shown in Table 1.
[0073] like Figure 3 As shown, the method may include operations S301 to S307.
[0074] In operation S301, a query request from a client is received.
[0075] In operation S302 , a first screening is performed on a plurality of aggregate tables based on a version rule according to a query version in the query request.
[0076] In order to achieve concurrent access to data, multi-version concurrency control (MVCC) is generally implemented in the data warehouse to prevent users from obtaining inconsistent data when making requests. Therefore, when making a request, the user will include a version number of the current request. According to the data processing method disclosed in the present invention, the aggregate table will be selected based on this version number. If the version number that an aggregate table can currently provide for query is not less than the requested version number, the rule is met and the next rule is determined. Otherwise, the aggregate table is excluded.
[0077] Then, in operation S303, according to the specified dimension item and the specified index item in the query request, a second screening is performed on the aggregate table that has undergone the first screening based on the query item rule.
[0078] Among them, it is determined whether the aggregate table contains all the specified dimension items and specified indicator items. If so, the next rule determination is entered; otherwise, the aggregate table is excluded.
[0079] Next, in operation S304, according to the filtering conditions in the query request, a third filtering is performed on the aggregate table that has undergone the second filtering based on filtering and sorting rules.
[0080] Among them, multiple aggregation tables of the same data source have different dimension columns or indicator columns, and are sorted according to the dimension columns and aggregated according to the indicator columns. Similar to the B-index of the database, the columns of the query filter conditions are matched to the left according to the order of the dimension columns of the aggregation table. When there are more matching columns, the query efficiency is more efficient.
[0081] For example, the aggregation tables after the second screening include two aggregation tables, as shown in Table 5 and Table 6 respectively.
[0082] Table 5
[0083] ID Date City Cost 1 2017 Beijing 10 1 2017 Shanghai 10 1 2018 Beijing 20 2 2017 Beijing 15 2 2017 Shanghai 20 2 2018 Beijing 20
[0084] Table 6
[0085] ID City Date Cost 1 Beijing 2017 10 1 Beijing 2018 20 1 Shanghai 2017 10 2 Beijing 2017 15 2 Beijing 2018 20 2 Shanghai 2017 20
[0086] For example, the filtering conditions in the query request include: "ID" = 1, "Date" = 2017. For the aggregate table shown in Table 5, search from left to right. For each searched column, determine whether the dimension item corresponding to the column matches each specified dimension item in the filtering condition, and determine the weight of the column based on the matching result. After the search is completed, the weight of each column is used to calculate the score of the aggregate table shown in Table 5. Similarly, for the aggregate table shown in Table 6, search from left to right. For each searched column, determine whether the dimension item corresponding to the column matches each specified dimension item in the filtering condition, and determine the weight of the column based on the matching result. After the search is completed, the weight of each column is used to calculate the score of the aggregate table shown in Table 6.
[0087] Exemplarily, the above method of calculating the score of each aggregate table is as follows:
[0088] For column: schema / / Traverse the table structure from left to right by column, and perform the following operations for each traversed column
[0089] Do:
[0090] If column in query_colunms:
[0091] weight=weight<<1+w(i) / / If a column is a dimension column included in the filter condition, the current score is equal to the previous score shifted left by 1 plus the weight of the column
[0092] else:
[0093] break / / If a column is not a dimension column included in the filter condition, then jump out of the loop
[0094] Done
[0095] Among them, weight represents the final score of the aggregate table, and its initial value is 0. coulmn represents each column in the aggregate table, and query_columns represents the dimension columns included in the filter conditions of the query request. w(i) represents the weight of the i-th column determined based on the filter match. i is a positive integer, and the value is set according to the selectivity (or the degree of match). The stronger the selectivity (or the higher the degree of match), the higher the weight. For example, the weight of a complete match can be set to 5, the weight of a contained but not complete match can be set to 4, and so on. There is no restriction here.
[0096] Corresponding to the aggregate table of Table 5, in order from left to right, the first column of Table 5 matches the "ID" in the filter condition, and determines w(1)=5, and weight=0+5=5 at this time. Continue searching to the second column, and the second column matches the "Date" in the filter condition, and determines w(2)=5, and weight=10+5=15 at this time. Continue searching to the third column, and the third column does not match the filter condition, and the search ends. The final score is 15. Corresponding to the aggregate table of Table 6, in order from left to right, the first column of Table 6 matches the "ID" in the filter condition, and determines w(1)=5, and weight=0+5=5 at this time. Continue searching to the second column, and the second column does not match the filter condition, and the search ends. The final score is 5. If the score of the aggregate table shown in Table 5 is greater than the score of the aggregate table shown in Table 6, the aggregate table shown in Table 5 is filtered as the aggregate table that meets the query request.
[0097] If there are multiple aggregate tables after the third filter, continue to refer to Figure 3 .
[0098] Next, in operation S305 , an aggregate table with fewer dimension columns is selected.
[0099] If a plurality of aggregation tables remain after operation S305 , operation S306 is performed.
[0100] Next, in operation S306, an aggregate table with fewer rows is selected, wherein fewer rows means less data.
[0101] Next, in operation S307, the aggregated table finally screened is sent to the client.
[0102] It can be understood that according to the data processing method disclosed in the present invention, an automatic routing strategy for data warehouses during queries is designed, which includes multiple rules. The strategy shields multiple aggregation tables from users, reducing the learning and usage costs of users. Through this strategy, the most efficient aggregation table that meets the query request can be found.
[0103] Figure 4 The block diagram schematically shows a data processing device according to an embodiment of the present disclosure.
[0104] like Figure 4 As shown, the data processing device 400 includes: an acquisition module 410, an aggregation module 420, a receiving module 430, a screening module 440 and a sending module 450.
[0105] The acquisition module 410 is used to acquire a data source.
[0106] The data source includes at least one dimension item and at least one indicator item.
[0107] The aggregation module 420 is used to perform multiple aggregations on the data sources to obtain multiple aggregation tables.
[0108] The receiving module 430 is used to receive a query request from a client.
[0109] The screening module 440 is used to screen the multiple aggregation tables to obtain the aggregation table that meets the query request.
[0110] The sending module 450 is used to send the aggregated table that meets the query request to the client.
[0111] It should be noted that the implementation methods, technical problems solved, functions realized, and technical effects achieved of each module / unit / sub-unit in the device part embodiment are the same or similar to the implementation methods, technical problems solved, functions realized, and technical effects achieved of each corresponding step in the method part embodiment, and will not be repeated here.
[0112] According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits, or at least part of the functions of any one of them can be implemented in one module. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be split into multiple modules for implementation. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be at least partially implemented as hardware circuits, such as field programmable gate arrays (FPGAs), programmable logic arrays (PLAs), systems on chips, systems on substrates, systems on packages, application specific integrated circuits (ASICs), or can be implemented by hardware or firmware in any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, according to the embodiments of the present invention, one or more of the modules, submodules, units, and subunits can be at least partially implemented as computer program modules, and when the computer program modules are run, the corresponding functions can be performed.
[0113] For example, any multiple of the acquisition module 410, the aggregation module 420, the receiving module 430, the screening module 440, and the sending module 450 can be combined in one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the acquisition module 410, the aggregation module 420, the receiving module 430, the screening module 440, and the sending module 450 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or by any one of the three implementation methods of software, hardware, and firmware, or by a suitable combination of any of them. Alternatively, at least one of the acquisition module 410 , the aggregation module 420 , the reception module 430 , the screening module 440 and the transmission module 450 may be at least partially implemented as a computer program module, and when the computer program module is executed, a corresponding function may be performed.
[0114] Figure 5 The block diagram schematically shows a computer device suitable for implementing the method described above according to an embodiment of the present disclosure. Figure 5 The computer device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0115] like Figure 5 As shown, the computer device 500 according to the embodiment of the present disclosure includes a processor 501, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 502 or the program loaded from the storage part 508 to the random access memory (RAM) 503. The processor 501 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 501 may also include an onboard memory for caching purposes. The processor 501 may include a single processing unit or multiple processing units for performing different actions of the method flow according to the embodiment of the present disclosure.
[0116] In RAM 503, various programs and data required for the operation of device 500 are stored. Processor 501, ROM 502 and RAM 503 are connected to each other via bus 504. Processor 501 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 502 and / or RAM 503. It should be noted that the program can also be stored in one or more memories other than ROM 502 and RAM 503. Processor 501 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0117] According to an embodiment of the present disclosure, the device 500 may further include an input / output (I / O) interface 505, which is also connected to the bus 504. The device 500 may further include one or more of the following components connected to the I / O interface 505: an input portion 506 including a keyboard, a mouse, etc.; an output portion 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 508 including a hard disk, etc.; and a communication portion 509 including a network interface card such as a LAN card, a modem, etc. The communication portion 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage portion 508 as needed.
[0118] According to an embodiment of the present disclosure, the method flow according to an embodiment of the present disclosure can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the processor 501, the above-mentioned functions defined in the system of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.
[0119] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0120] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present disclosure, a computer-readable storage medium may include the ROM 502 and / or RAM 503 described above and / or one or more memories other than ROM 502 and RAM 503.
[0121] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0122] It will be appreciated by those skilled in the art that the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations and / or combinations are not explicitly described in the present disclosure. In particular, the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways without departing from the spirit and teachings of the present disclosure. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0123] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. The scope of the present disclosure is defined by the attached claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A data processing method, comprising: Acquire a data source, wherein the data source includes at least one dimension item and at least one indicator item; Aggregating the data sources multiple times respectively to obtain multiple aggregation tables; Receiving a query request from a client, wherein the query request includes: a query version, a specified dimension item, a specified indicator item, and a filtering condition; Filtering the plurality of aggregate tables to obtain an aggregate table that meets the query request; and Sending the aggregated table that meets the query request to the client; The step of filtering the plurality of aggregate tables to obtain an aggregate table that meets the query request includes: Performing a first screening on the plurality of aggregate tables according to the query version; According to the specified dimension item and the specified index item, based on the query item rule, a second screening is performed on the aggregate table that has undergone the first screening; According to the filtering condition, a third filtering is performed on the aggregate table that has undergone the second filtering based on filtering and sorting rules.
2. The method according to claim 1, wherein: The step of aggregating the data sources multiple times to obtain multiple aggregate tables includes: For any one of the multiple polymerizations, Determining a dimension item for any aggregation from the at least one dimension item; Determine an indicator item for any aggregation from the at least one indicator item; Determining an aggregation function for any of the aggregations; and Based on the dimension items for any aggregation, the indicator items for any aggregation, and the aggregation function for any aggregation, the data source is aggregated to obtain an aggregation table for any aggregation.
3. The method according to claim 1, wherein: The data source performs data update and version update every predetermined period, and the version of any aggregate table among the plurality of aggregate tables is the same as the version of the data source for the any aggregate table.
4. The method according to claim 1, wherein: The first screening of the plurality of aggregate tables according to the query version includes: screening the plurality of aggregate tables based on a version rule according to the query version to obtain an aggregate table that has undergone the first screening.
5. The method according to claim 1, wherein: The second filtering of the aggregate table that has undergone the first filtering based on the query item rules according to the specified dimension items and the specified indicator items includes: filtering the aggregate table that has undergone the first filtering including the specified dimension items and the specified indicator items from the aggregate table that has undergone the first filtering to obtain the aggregate table that has undergone the second filtering.
6. The method according to claim 1, wherein: The filtering condition includes the specified dimension item and the value of the specified dimension item; The performing a third screening on the aggregate table after the second screening based on the filtering condition and filtering and sorting rules comprises: For any aggregate table among the aggregate tables that have undergone the second screening, Searching for dimension items in any of the aggregation tables in a predetermined order; Match each dimension item found by the search with the specified dimension item. If the match succeeds, determine the weight of the dimension item and continue searching for the next dimension item. If the match fails, end the search. Determining a score of any of the aggregation tables based on the determined weights of the dimension items; and The aggregated table with the highest score is selected as the aggregated table that has passed the third selection.
7. The method according to claim 6, wherein: The step of filtering the plurality of aggregate tables to obtain an aggregate table that meets the query request further includes: The aggregated tables that have undergone the third filtering are filtered out to obtain an aggregated table having the smallest number of dimension items and / or the smallest amount of data.
8. A data processing device, comprising: An acquisition module, used to acquire a data source, wherein the data source includes at least one dimension item and at least one indicator item; An aggregation module, used for performing multiple aggregations on the data sources to obtain multiple aggregation tables, wherein the multiple aggregation tables have different dimensional items and / or the multiple aggregation tables have different indicator items; A receiving module, configured to receive a query request from a client, wherein the query request includes: a query version, a specified dimension item, a specified indicator item, and a filtering condition; A screening module, used for screening the multiple aggregation tables to obtain an aggregation table that meets the query request; and A sending module, used for sending the aggregated table that meets the query request to the client; The step of filtering the plurality of aggregate tables to obtain an aggregate table that meets the query request includes: Performing a first screening on the plurality of aggregate tables according to the query version; According to the specified dimension item and the specified index item, based on the query item rule, a second screening is performed on the aggregate table that has undergone the first screening; According to the filtering condition, a third filtering is performed on the aggregate table that has undergone the second filtering based on filtering and sorting rules.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program: The method according to any one of claims 1 to 7.
10. A computer-readable storage medium having executable instructions stored thereon, which instructions, when executed by a processor, cause the processor to perform: The method according to any one of claims 1 to 7.
11. A computer program product, comprising a computer program, wherein the computer program comprises computer executable instructions, wherein the instructions are used to implement the method according to any one of claims 1 to 7 when executed.
Citation Information
Patent Citations
Data inquiry method and device
CN109213829A
