A data analysis method and device
By acquiring and summarizing incremental source data and historical source data in the data warehouse, generating wide table data and conducting real-time analysis, it solves the problem of poor timeliness caused by the long data update cycle of traditional data warehouses and achieves high timeliness and accuracy. Data analysis results.
Patent Information
- Application Number
- CN202111497269.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-09
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-12-09
AI Technical Summary
The data update cycle of traditional data warehouses is long, resulting in poor timeliness of data analysis results and the inability to accurately reflect the current product resources held by the client.
Through the summary processing of incremental source data and historical source data obtained in the data warehouse, wide table data is generated, and real-time data analysis is performed when the trigger conditions are met to generate highly timely query results.
It improves the timeliness of query results, ensures the accuracy and real-timeness of data analysis results, can timely reflect the product resources held by the client, and supports better decision support.
Smart Images

Figure CN114168595B
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and in particular to a data analysis method and device. Background Art
[0002] The purpose of a data warehouse is to build an integrated data environment for analysis and provide decision support for enterprises or individuals. Since the data update cycle of a traditional data warehouse is usually one day, one week, or even one month, under existing technologies, data analysis of the data in the above data warehouse is also carried out according to the data update cycle. As a result, the data analysis results are also periodic and have a problem of poor timeliness.
[0003] Usually, an enterprise or an individual uses the query function of a client to query the resources of the products they own. Since the data analysis of the data in the data warehouse is periodic, the data analysis results obtained are also periodic. As a result, the query results obtained by the enterprise or the individual through the client cannot accurately reflect the resource status of the products currently held. Therefore, the query results obtained by the enterprise or the individual through the client also have the problem of poor timeliness.
[0004] In summary, a new method needs to be designed to solve the above problems. Summary of the invention
[0005] The embodiments of the present application provide a data analysis method and device to solve the problem of poor timeliness of query results obtained through a client under the existing technology.
[0006] The specific technical solutions provided by the embodiments of this application are as follows:
[0007] In a first aspect, a data analysis method comprises:
[0008] After receiving a query request sent by a client, obtaining wide table data associated with the client from a big data warehouse associated with the client, wherein the query request includes a user ID of the client and information to be queried, the wide table data is obtained by performing data analysis on a target data set, the target data set is obtained by summarizing an incremental source data set and a historical source data set, the incremental source data set is obtained when it is determined that a trigger condition is met, and the wide table data includes a user ID of each client and product description information of each product held by each client;
[0009] Based on the user identification of the client, product description information of the product held by the client that matches the information to be queried is obtained from the wide table data, and based on the obtained product description information, a query result of the client is generated.
[0010] In the above method, since the wide table data is obtained after data analysis of the incremental source data set obtained each time the trigger condition is determined to be met during the settlement cycle, and the target data set obtained by summarizing the historical source data set, the wide table data contains query results with high timeliness that match the client's queried information, and can reflect the product description information of the products held by the client in real time, thereby improving the timeliness of the query results.
[0011] In some embodiments, the wide table data is obtained by performing the following operations:
[0012] Within the settlement cycle, if it is determined that the trigger condition is met, the incremental source data set is obtained from a database of the transaction system, and the acquired incremental source data set is stored in a big data warehouse, wherein the incremental source data set includes a user identifier of at least one client and incremental transaction data of the at least one client;
[0013] Aggregating the incremental source data set and the historical source data set in the big data warehouse to obtain a target data set, wherein the historical source data set includes historical transaction data associated with at least one client before the incremental source data set is obtained this time;
[0014] The target data set is analyzed by using a pre-built wide table to obtain the wide table data.
[0015] The above method, during the settlement cycle, each time it is determined that the trigger condition is met, obtains the corresponding incremental source data set from the database of the transaction system, and then aggregates the historical source data set and the incremental source data set to obtain the corresponding target data set, so that the data analysis of the target data set and the obtained data analysis results (i.e., wide table data) can reflect the product description information of the products held by the client in real time, greatly improving the timeliness of the query results.
[0016] In some embodiments, the trigger condition includes some or all of the following conditions:
[0017] The current moment is any preset moment in a preset moment set, wherein the preset moment set includes at least one preset moment, and the preset moment is set based on a product associated with the transaction data;
[0018] The transaction data has been stored in a database of the transaction system, wherein the transaction data is obtained based on click operations performed by the user on the associated client.
[0019] The above method, by setting trigger conditions, ensures that the incremental source data set can be obtained in time during the settlement cycle, thereby ensuring that the subsequent data analysis can reflect the product description information held by each client in real time, improving the timeliness of the data analysis results, and further improving the timeliness of the query results.
[0020] In some embodiments, before the current settlement cycle ends, after determining to obtain the final wide table data of the current settlement cycle, the method further includes:
[0021] Obtain a target data set of the current settlement period stored in the big data warehouse for each client;
[0022] Performing data analysis on the target data set of the current settlement period respectively to obtain the first resource of each product held by each client;
[0023] Based on the final wide table data, obtain product description information of each product held by each client, and obtain the second resource of each product held by each client based on the obtained product description information;
[0024] The first resource is compared with the corresponding second resource respectively; after determining that the comparison result is correct, the final wide table data is stored in the big data warehouse.
[0025] The above method uses a secondary reconciliation method before the end of the current settlement cycle, after obtaining the final wide table data, to ensure that the final wide table data is the same as the full data corresponding to the current settlement cycle, thereby ensuring the accuracy of the data analysis results of each client obtained based on the final wide table data.
[0026] In some embodiments, the step of aggregating the incremental source data set and the historical source data set in the big data warehouse to obtain a target data set includes:
[0027] Based on the incremental transaction data contained in the incremental source data set, updating the historical transaction data contained in the historical source data set;
[0028] The updated historical source data set is taken as the target data set.
[0029] The above method updates the historical source data set in the big data warehouse in real time based on the incremental source data set during the settlement cycle, so as to facilitate the subsequent data analysis of the real-time transaction data (i.e., the target data set), thereby obtaining more timely and accurate data analysis results (i.e., wide table data).
[0030] In some embodiments, each product description information includes a product identifier and at least one corresponding product resource information, and each product resource information includes the consumed resources and added resources associated with the client, and the quantity of the corresponding products;
[0031] Generating the query result of the client based on the acquired product description information includes:
[0032] Based on the consumed resources, increased resources, and the corresponding product quantity of each product, the resources of each product held by the client are determined according to each settlement period, and the query results of the client are generated based on the determined resources of each product.
[0033] The above method obtains product resource information of each product of each client through data analysis, and then, when receiving the query request sent by the client, the product description information of the products held by the client that matches the information to be queried can be obtained from the wide table data based on the user identifier of the client contained in the query request, thereby determining the resources held by the client based on the product resource information contained in each product description information, and then accurately feeding back the real-time revenue situation to the client to provide the client with better decision support.
[0034] In a second aspect, a data analysis device includes:
[0035] An acquisition module is used to acquire the wide table data associated with the client from the big data warehouse associated with the client after receiving a query request sent by the client, wherein the query request includes the user identification of the client and the information to be queried, the wide table data is obtained by performing data analysis on a target data set, the target data set is obtained by summarizing an incremental source data set and a historical source data set, the incremental source data set is obtained when it is determined that a trigger condition is met, and the wide table data includes the user identification of each client and product description information of each product held by each client;
[0036] A generation module is used to obtain product description information of products held by the client that matches the information to be queried from the wide table data based on the user identification of the client, and generate a query result of the client based on the obtained product description information.
[0037] In some embodiments, the wide table data is obtained by performing the following operations:
[0038] Within the settlement cycle, if it is determined that the trigger condition is met, the incremental source data set is obtained from a database of the transaction system, and the acquired incremental source data set is stored in a big data warehouse, wherein the incremental source data set includes a user identifier of at least one client and incremental transaction data of the at least one client;
[0039] Aggregating the incremental source data set and the historical source data set in the big data warehouse to obtain a target data set, wherein the historical source data set includes historical transaction data associated with at least one client before the incremental source data set is obtained this time;
[0040] The target data set is analyzed by using a pre-built wide table to obtain the wide table data.
[0041] In some embodiments, the trigger condition includes some or all of the following conditions:
[0042] The current moment is any preset moment in a preset moment set, wherein the preset moment set includes at least one preset moment, and the preset moment is set based on a product associated with the transaction data;
[0043] The transaction data has been stored in a database of the transaction system, wherein the transaction data is obtained based on click operations performed by the user on the associated client.
[0044] In some embodiments, before the end of the current settlement period, after determining to obtain the final wide table data of the current settlement period, the acquisition module is further used to:
[0045] Obtain a target data set of the current settlement period stored in the big data warehouse for each client;
[0046] Performing data analysis on the target data set of the current settlement period respectively to obtain the first resource of each product held by each client;
[0047] Based on the final wide table data, obtain product description information of each product held by each client, and obtain the second resource of each product held by each client based on the obtained product description information;
[0048] The first resource is compared with the corresponding second resource respectively; after determining that the comparison result is correct, the final wide table data is stored in the big data warehouse.
[0049] In some embodiments, the incremental source data set and the historical source data set in the big data warehouse are aggregated to obtain a target data set, and the acquisition module is used to:
[0050] Based on the incremental transaction data contained in the incremental source data set, updating the historical transaction data contained in the historical source data set;
[0051] The updated historical source data set is taken as the target data set.
[0052] In some embodiments, each product description information includes a product identifier and at least one corresponding product resource information, and each product resource information includes the consumed resources and added resources associated with the client, and the quantity of the corresponding products;
[0053] Based on the acquired product description information, the query result of the client is generated, and the generating module is used to:
[0054] Based on the consumed resources, increased resources, and the corresponding product quantity of each product, the resources of each product held by the client are determined according to each settlement period, and the query results of the client are generated based on the determined resources of each product.
[0055] In a third aspect, an embodiment of the present application provides an electronic device, comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein:
[0056] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any method as described in the first aspect.
[0057] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute any method described in the first aspect.
[0058] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is called and executed by an electronic device, the electronic device executes any method described in the first aspect.
[0059] In addition, the technical effects brought about by any one of the implementation methods in the second to fifth aspects can refer to the technical effects brought about by different implementation methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 A schematic diagram of an application scenario of a data analysis method in an embodiment of the present application;
[0061] Figure 2 This is a schematic diagram of the data warehouse hierarchical architecture of the big data warehouse in the embodiment of the present application;
[0062] Figure 3 A schematic diagram of a data analysis method in an embodiment of the present application;
[0063] Figure 4 A schematic diagram of a process for determining final wide table data in an embodiment of the present application;
[0064] Figure 5 A schematic diagram of a data analysis method in an embodiment of the present application;
[0065] Figure 6 This is a schematic diagram of the logical architecture of a data analysis device in an embodiment of the present application;
[0066] Figure 7 It is a schematic diagram of the physical structure of the electronic device in the embodiment of the present application. DETAILED DESCRIPTION
[0067] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0068] It should be noted that the terms "first", "second", "third", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein.
[0069] In order to solve the problem of poor timeliness of query results obtained through the client under the existing technology, in the embodiment of the present application, after receiving the query request sent by the client, the wide table data associated with the client is obtained from the data warehouse associated with the client, wherein the query request includes the user identification of the client and the information to be queried, the wide table data is obtained by performing data analysis on the target data set, the target data set is obtained by summarizing the incremental source data set and the historical source data set, the incremental source data set is obtained when it is determined that the trigger condition is met, and the wide table data includes the user identification of each client and the product description information of each product held by each client. information; then, based on the user identifier of the client, obtain the product description information of the products held by the client that matches the information to be queried from the wide table data, so as to generate the client's query results based on the obtained product description information. In this way, since the wide table data is obtained after data analysis of the incremental source data set obtained each time the trigger condition is determined to be met during the settlement cycle, and the target data set obtained by aggregating the historical source data set, the wide table data contains query results that match the information to be queried by the client and have high timeliness, which can reflect the product description information of the products held by the client in real time, thereby improving the timeliness of the query results.
[0070] The preferred implementation modes of the present application are further described in detail below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application, and the embodiments of the present application and the features in the embodiments may be combined with each other if there is no conflict.
[0071] See also Figure 1 As shown, it is a schematic diagram of an application scenario of a data analysis method in an embodiment of the present application. The application scenario schematic diagram includes a client 100, a trading system 200 and a data analysis system 300. The client 100, the trading system 200 and the data analysis system 300 can be connected to each other through a communication network. Optionally, the communication network can be a wired network or a wireless network. The trading system 200 and the data analysis system 300 can be directly or indirectly connected through wired or wireless communication, and the present application does not limit this.
[0072] In the embodiment of the present application, the client 100 is an electronic device used by the user, which may be a personal computer, a mobile phone, a tablet computer, a notebook, a vehicle-mounted terminal, etc. The transaction system 200 and the data analysis system 300 may be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0073] In the embodiment of the present application, after the user performs a transaction operation through the client 100, the transaction system 200 generates corresponding incremental transaction data according to the transaction operation performed by the client 100, and stores the incremental transaction data in the database of the transaction system 200. During the settlement period, when the data analysis system 300 determines that the trigger condition is met, it obtains the incremental source data set from the database of the transaction system 200, and stores the obtained incremental source data set in the big data warehouse of the data analysis system 300.
[0074] Figure 2 The following figure shows the hierarchical architecture of a big data warehouse. Figure 2 As shown, in the embodiment of the present application, the big data warehouse includes an operational data storage layer (Operational Data Store, ODS), a data detail layer (DataWarehouse Detail, DWD), a data service layer (Data WareHouse Servce, DWS) and an application data service layer (Application Data Store, ADS), wherein:
[0075] The operation storage data layer is used to obtain an incremental source data set from the database of the trading system through data loading (Extract-Transform-Load, ETL), wherein the incremental source data set is obtained from the database of the trading system every time the trigger condition is determined to be met during the settlement cycle, and the incremental source data set includes a user identifier of at least one client and incremental transaction data of the at least one client; then, after receiving the incremental source data set, the operation storage data layer performs data cleaning and data filtering on each data contained in the incremental source data set, and cleans and filters out data with missing key information and damaged data; after completing the data cleaning and data filtering on each data, the incremental source data set is stored;
[0076] The data detail layer is used to aggregate the incremental source data set and the historical source data set to obtain the target data set, wherein the historical source data set includes the historical transaction data associated with the at least one client stored in the big data warehouse before the incremental source data set is obtained this time;
[0077] The data service layer is used to perform data analysis on the target data set through pre-built wide tables to obtain wide table data, where the wide table data includes the user ID of each client associated with the big data warehouse and the product description information of each product held by each client.
[0078] The application data service layer is used to obtain the products and product description information held by the client that match the information to be queried contained in the query request from the wide table data obtained from the data service layer according to different query requests from different clients, and generate query results corresponding to the query request based on the obtained product description information.
[0079] In the embodiment of the present application, the big data warehouse is based on big data technology and uses a data warehouse tool (Hive) to build a distributed big data warehouse. The big data warehouse implements high-throughput data access through a distributed file system (Hadoop Distributed FileSystem, HDFS), and provides unified resource management and scheduling for upper-level applications through another resource coordinator (Yarn). At the same time, the big data warehouse introduces a data analysis tool based on Scala language development, encapsulating Spark SQL, Universal Disc Format (UDF), and user-defined aggregate functions (UDAF), which is used to perform data analysis on the acquired transaction data, thereby improving the data analysis efficiency of the data analysis system.
[0080] In the embodiment of the present application, after introducing the schematic diagram of the hierarchical architecture of the data warehouse of the big data warehouse, refer to Figure 3 As shown, a data analysis method is provided, and the specific process is as follows:
[0081] Step 300: During the settlement cycle, if it is determined that the trigger condition is met, an incremental source data set is obtained from the database of the transaction system, and the obtained incremental source data set is stored in a big data warehouse, wherein the incremental source data set includes a user identifier of at least one client and incremental transaction data of at least one client.
[0082] In the embodiment of the present application, the settlement cycle is usually one day. Then, in each settlement cycle, when it is determined that the trigger condition is met, the incremental source data set is obtained from the database of the transaction system through ETL to reduce the complexity of data extraction; wherein the above trigger condition includes some or all of the following conditions:
[0083] Condition 1: the current moment is any preset moment in a preset moment set, wherein the preset moment set includes at least one preset moment, and the preset moment is set based on a product associated with the transaction data.
[0084] For example, take XX product as an example.
[0085] Assume that the transaction of this XX product ends at 3:00 p.m. every day and completes the statistics and storage of incremental transaction data.
[0086] Then three o'clock in the afternoon is taken as a preset time in the preset time set.
[0087] Then, when the data analysis system determines that the current time is "three o'clock in the afternoon" and determines that the current time ("three o'clock in the afternoon") is a preset time in the preset time set, that is, within the current settlement result, it determines that the trigger condition is met, then the incremental source data set is obtained from the database of the trading system, where the incremental source data set includes the incremental transaction data that exists in the database of the trading system when the transaction of the XX product ends at three o'clock in the afternoon.
[0088] Condition 2: The transaction data has been stored in the database of the transaction system, wherein the transaction data is obtained based on a click operation performed by the user on the associated client.
[0089] For example, let’s take product XX as an example.
[0090] Assume that the user performs a click operation through the client at 10 am, such as buying XX product. Then, the incremental transaction data obtained by the click operation performed by the user on the associated client is stored in the database of the trading system.
[0091] Then, the data analysis system determines that the transaction data of the click operation (i.e., buy operation) performed by the above-mentioned user through the client has been stored in the database of the transaction system, that is, within the current settlement cycle, it is determined that the trigger condition is met, and then an incremental source data set is obtained from the database of the transaction system, where the incremental source data set contains the incremental transaction data obtained by the user through the click operation performed on the associated client.
[0092] In an embodiment of the present application, after obtaining an incremental source data set from a database of a transaction system, data cleaning and data filtering are performed on each data contained in the incremental source data set, and the data that has passed data cleaning and data filtering are stored in an operation storage data layer, wherein the data stored in the operation storage data layer is stored in a time-sharing and partitioned manner.
[0093] It should be noted that, in the embodiment of the present application, the complexity of data extraction is reduced through ETL processing, and the data structure of the data stored in the operation storage data layer is basically consistent with the data structure of the source data stored in the database of the transaction system.
[0094] For example, assume that the database of a trading system includes user information, associated product information, held product information, contract information, transaction information, flow data, and data information of different dimensions.
[0095] Then, in the operation storage data layer, the data structure of the incremental source data set extracted from the transaction system's database is consistent with the data structure in the transaction system's database, and also includes user information, related product information, held product information, contract information, transaction information, flow data, and data information of different dimensions.
[0096] Step 310: Aggregate the incremental source data set and the historical source data set in the big data warehouse to obtain a target data set, wherein the historical source data set includes historical transaction data associated with at least one client before the incremental source data set is obtained this time.
[0097] In the embodiment of the present application, when executing step 310, the target data set is obtained by performing the following operations:
[0098] Operation one: updating the historical transaction data contained in the historical source data set based on the incremental transaction data contained in the incremental source data set.
[0099] In an embodiment of the present application, a data analysis tool that encapsulates Spark SQL, UDF, and UDAF is used to update the historical transaction data contained in the historical source data set based on the incremental transaction data contained in the incremental source data set to form a full slice table, a zipper table, a historical data summary table, etc., so as to facilitate the subsequent extraction of the product description information required for the wide table through the above tables.
[0100] Operation 2: Collect the updated historical source data set as the target data set.
[0101] In the embodiment of the present application, the updated historical data summary table, full slice table, zipper table, etc. are combined into a target data set, which is convenient for subsequent further data analysis based on the target data set and efficiently obtains wide table data.
[0102] In the specific implementation, through the above operations one and two, a data analysis tool that encapsulates Spark SQL, UDF, and UDAF is used to summarize and process the incremental source data set and the historical source data set, and associate the corresponding attribute fields (such as product price) and dimension fields (such as product holding status), thereby abstracting the product adjustment resource data model and the client product holding data model.
[0103] Step 320: Perform data analysis on the target data set using the pre-built wide table to obtain wide table data.
[0104] In an embodiment of the present application, a data analysis tool encapsulating Spark SQL, UDF, and UDAF is used to perform further data analysis on the target data set stored in the data detail layer through a pre-built wide table, thereby extracting the product description information of each product held by each client contained in the target data set, wherein each product description information includes a product identifier and at least one corresponding product resource information, and each product resource information includes the consumed resources, increased resources, and the corresponding product quantity associated with the corresponding client.
[0105] It should be noted that in the embodiment of the present application, during the settlement period, whenever it is determined that the trigger condition is met, the corresponding wide table data is obtained by executing steps 300-320. Therefore, during the settlement period, the query results obtained by the user through the client are all obtained after data analysis based on the current latest data. Therefore, the data analysis results can accurately reflect the current resource situation and can provide users with better decision-making support.
[0106] In an embodiment of the present application, after determining that the trigger conditions are met and obtaining an incremental source data set from the database of the transaction system, it can be determined whether the next acquisition operation needs to be performed after the current acquisition operation is completed within the current settlement cycle.
[0107] Specifically, it is possible to determine whether there is a next preset time after the time corresponding to the current acquisition operation through a preset time set; it is also possible to determine whether there is a next acquisition operation after the current acquisition operation is completed through the transaction rules of the transaction system connected to the data analysis system. In the embodiment of the present application, there is no specific limitation on how to determine whether the current acquisition operation is the last acquisition operation in the current settlement cycle, and it can be specifically limited based on actual conditions in actual applications.
[0108] In an embodiment of the present application, when it is determined that there will be no next acquisition operation to acquire an incremental source data set after the current acquisition operation is completed, the wide table data obtained after executing the above-mentioned data analysis process will be used as the final wide table data based on the incremental source data set acquired this time.
[0109] In the present application, see Figure 4 As shown, before the end of the current settlement period, after determining to obtain the final wide table data of the current settlement period, another data analysis method is provided, and the specific process is as follows:
[0110] Step 400: Obtain the target data set of the current settlement period stored in the big data warehouse for each client.
[0111] Step 410: Perform data analysis on the target data set of the current settlement period respectively to obtain the first resource of each product held by each client.
[0112] Step 420: Based on the final wide table data, obtain the product description information of each product held by each client, and obtain the second resource of each product held by each client based on the obtained product description information.
[0113] Step 430: respectively compare the first resource with the corresponding second resource; after determining that the comparison result is correct, store the final wide table data in the big data warehouse.
[0114] In an embodiment of the present application, by executing steps 400 to 430, before the end of the settlement cycle, after obtaining the final wide table data (i.e., determining that the trigger conditions corresponding to the incremental source data set have occurred within the current settlement cycle and that the incremental transaction data has stopped updating), data analysis can be performed on the current settlement cycle's stored historical source data set to obtain the first resource of each product held by each client associated with the current settlement cycle's historical source data set, and compare the first resource with the second resource of the corresponding product determined based on the final wide table data, thereby ensuring the accuracy of the product resource information of each product held by each client in the final wide table data through secondary reconciliation.
[0115] In some embodiments, the final wide table data obtained may be persistently stored in Hive, HBase, or HDFS.
[0116] See also Figure 5 As shown, the embodiment of the present application provides a data analysis method, the query result obtained by the data analysis method is obtained based on the data analysis performed on the above-mentioned big data warehouse, and the specific process of the method is as follows:
[0117] Step 500: After receiving the query request sent by the client, obtain the wide table data associated with the client from the data warehouse associated with the client, wherein the query request includes the user ID of the client and the information to be queried, and the wide table data is obtained by performing data analysis on the target data set, and the target data set is obtained by aggregating the incremental source data set and the historical source data set, and each incremental source data set is obtained each time it is determined that a trigger condition is met, and the wide table data includes the user ID of each client and the product description information of each product held by each client.
[0118] Step 510: Based on the user identifier of the client, product description information of the product held by the client that matches the information to be queried is obtained from the wide table data, and the query result of the client is generated based on the obtained product description information.
[0119] In an embodiment of the present application, each product description information includes a product identification and at least one corresponding product resource information, and each product resource information includes the consumable resources, added resources, and the corresponding product quantity associated with the client; then, based on the user identification of the client, the product description information of the product held by the client that matches the information to be queried is found from the wide table data, and then based on the consumable resources, added resources, and the corresponding product quantity of each product, the resources of each product held by the client are determined according to each settlement cycle, and based on the determined resources of each product, the client's query results are generated.
[0120] Optionally, in an embodiment of the present application, after the query results of the client are generated, the generated query results are sent to the client, so that the user can view the resources of the products currently owned by the user through the client.
[0121] In some possible embodiments, based on the above-mentioned wide table data, corresponding query results can be customized according to different query requests. For example, the above-mentioned information to be queried can include resource summary results, resource detail results, resource trend analysis results, resource revenue ranking results, resource distribution results, etc.
[0122] In this way, since the above product description information is obtained based on data analysis of the target data set, and the target data set is obtained by summarizing the incremental source data set and the historical source data set obtained by satisfying the trigger conditions, that is, the data analysis is time-sensitive, the generated query results are also highly time-sensitive, which solves the problem of poor timeliness of query results obtained through the client under the existing technology. At the same time, due to the use of a secondary reconciliation method, the accuracy of the data analysis results is ensured, so that based on the above query results obtained, the resource allocation strategy can be adjusted in time to obtain a better resource allocation strategy.
[0123] In the technical solution of this application, the collection, dissemination, and use of data are in compliance with the requirements of relevant national laws and regulations.
[0124] Based on the same inventive concept, see Figure 6 As shown, an embodiment of the present application provides a data analysis device, comprising:
[0125] The acquisition module 610 is used to acquire the wide table data associated with the client from the big data warehouse associated with the client after receiving the query request sent by the client, wherein the query request includes the user identification of the client and the information to be queried, the wide table data is obtained by performing data analysis on the target data set, the target data set is obtained by summarizing the incremental source data set and the historical source data set, the incremental source data set is obtained when it is determined that the trigger condition is met, and the wide table data includes the user identification of each client and the product description information of each product held by each client;
[0126] The generating module 620 is used to obtain product description information of the product held by the client that matches the information to be queried from the wide table data based on the user identification of the client, and generate the query result of the client based on the obtained product description information.
[0127] In some embodiments, the wide table data is obtained by performing the following operations:
[0128] Within the settlement cycle, if it is determined that the trigger condition is met, the incremental source data set is obtained from a database of the transaction system, and the acquired incremental source data set is stored in a big data warehouse, wherein the incremental source data set includes a user identifier of at least one client and incremental transaction data of the at least one client;
[0129] Aggregating the incremental source data set and the historical source data set in the big data warehouse to obtain a target data set, wherein the historical source data set includes historical transaction data associated with at least one client before the incremental source data set is obtained this time;
[0130] The target data set is analyzed by using a pre-built wide table to obtain the wide table data.
[0131] In some embodiments, the trigger condition includes some or all of the following conditions:
[0132] The current moment is any preset moment in a preset moment set, wherein the preset moment set includes at least one preset moment, and the preset moment is set based on a product associated with the transaction data;
[0133] The transaction data has been stored in a database of the transaction system, wherein the transaction data is obtained based on click operations performed by the user on the associated client.
[0134] In some embodiments, before the current settlement period ends, after determining to obtain the final wide table data of the current settlement period, the acquisition module 610 is further used to:
[0135] Obtain a target data set of the current settlement period stored in the big data warehouse for each client;
[0136] Performing data analysis on the target data set of the current settlement period respectively to obtain the first resource of each product held by each client;
[0137] Based on the final wide table data, obtain product description information of each product held by each client, and obtain the second resource of each product held by each client based on the obtained product description information;
[0138] The first resource is compared with the corresponding second resource respectively; after determining that the comparison result is correct, the final wide table data is stored in the big data warehouse.
[0139] In some embodiments, the incremental source data set and the historical source data set in the big data warehouse are aggregated to obtain a target data set, and the acquisition module 610 is used to:
[0140] Based on the incremental transaction data contained in the incremental source data set, updating the historical transaction data contained in the historical source data set;
[0141] The updated historical source data set is taken as the target data set.
[0142] In some embodiments, each product description information includes a product identifier and at least one corresponding product resource information, and each product resource information includes the consumed resources and added resources associated with the client, and the quantity of the corresponding products;
[0143] The generating module 620 generates the query result of the client based on the product resource information included in the acquired product description information, and is used for:
[0144] Based on the consumed resources, increased resources, and the corresponding product quantity of each product, the resources of each product held by the client are determined according to each settlement period, and the query results of the client are generated based on the determined resources of each product.
[0145] See also Figure 7As shown, an electronic device is provided in an embodiment of the present application, and the electronic device may be a desktop computer, a portable computer, a smart phone, a tablet computer, a personal digital assistant (PDA), a server, etc. Figure 7 As shown, the electronic device may include a processor 701 and a memory 702 .
[0146] Processor 701 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor (DigitalSignal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, and can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as a hardware processor to be executed, or a combination of hardware and software modules in the processor can be executed.
[0147] The memory 702 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 702 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0148] A person of ordinary skill in the art can understand that: all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiments; the above computer storage medium can be any available medium or data storage device that can be accessed by a computer, including but not limited to: mobile storage devices, random access memory (RAM, Random Access Memory), magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO)), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid-state drive (SSD)) and other media that can store program codes.
[0149] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: a mobile storage device, a random access memory (RAM, Random Access Memory), a magnetic storage device (such as a floppy disk, a hard disk, a magnetic tape, a magneto-optical disk (MO), etc.), an optical storage device (such as CD, DVD, BD, HVD, etc.), and a semiconductor memory (such as ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), a solid-state drive (SSD)) and other various media that can store program codes.
[0150] In some possible implementations, various aspects of the method provided by the present disclosure may also be implemented in the form of a program product, which includes a program code. When the program product is run on a computer device, the program code is used to enable the computer device to perform the steps of the method according to various exemplary embodiments of the present disclosure described above in this specification. For example, the computer device may perform the method described in the embodiment of the present disclosure. The program product may adopt any combination of one or more readable media.
[0151] In summary, in an embodiment of the present application, after receiving a query request sent by a client, the wide table data associated with the client is obtained from a data warehouse associated with the client, wherein the query request includes a user identifier of the client and information to be queried, the wide table data is obtained by performing data analysis on a target data set, the target data set is obtained by aggregating and processing an incremental source data set and a historical source data set, the incremental source data set is obtained when it is determined that a trigger condition is satisfied, and the wide table data includes a user identifier of each client, and product description information of each product held by each client; then, based on the user identifier of the client, product description information of the product held by the client that matches the information to be queried is obtained from the wide table data, thereby generating a query result of the client based on the obtained product description information. In this way, since the wide table data is obtained by performing data analysis on the incremental source data set obtained each time the trigger condition is determined to be satisfied within the settlement period, and the target data set obtained by aggregating and processing the historical source data set, the wide table data contains a query result that matches the information to be queried of the client and has a high timeliness, and can reflect the product description information of the product held by the client in real time, thereby improving the timeliness of the query result.
[0152] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0153] The present application is described with reference to the flowchart and / or block diagram of the method, device (system), and computer program product according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the process and / or box in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.
[0154] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0155] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0156] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A data analysis method, characterized in that: include: After receiving a query request sent by a client, the wide table data associated with the client is obtained from a big data warehouse associated with the client, wherein the query request includes a user identifier of the client and information to be queried, the wide table data is obtained by performing data analysis on a target data set, the target data set is obtained by summarizing an incremental source data set and a historical source data set, the incremental source data set is obtained from a database of a trading system whenever a trigger condition is met during a current settlement cycle, the database is used to store incremental transaction data generated after each client performs a transaction operation, and the wide table data includes a user identifier of each client, and product description information of each product held by each client; Based on the user identifier of the client, product description information of the product held by the client that matches the information to be queried is obtained from the wide table data, and based on the obtained product description information, a query result of the client is generated; Before the current settlement period ends, after determining to obtain the final wide table data of the current settlement period, the method further includes: Obtain a target data set of the current settlement period stored in the big data warehouse for each client; Perform data analysis on the target data set of the current settlement period respectively to obtain the first resource of each product held by each client; Based on the final wide table data, obtain product description information of each product held by each client, and obtain the second resource of each product held by each client based on the obtained product description information; The first resource is compared with the corresponding second resource respectively, and after determining that the comparison result is correct, the final wide table data is persistently stored in the big data warehouse.
2. The method according to claim 1, characterized in that The wide table data is obtained by performing the following operations: In the current settlement cycle, if it is determined that any trigger condition is met, the incremental source data set is obtained from the database of the transaction system, and the acquired incremental source data set is stored in the big data warehouse, wherein the incremental source data set includes a user identifier of at least one client and incremental transaction data of the at least one client; Aggregating the incremental source data set and the historical source data set in the big data warehouse to obtain a target data set, wherein the historical source data set includes historical transaction data associated with at least one client before the incremental source data set is obtained this time; The target data set is analyzed by using a pre-built wide table to obtain the wide table data.
3. The method according to claim 2, characterized in that The trigger conditions include some or all of the following conditions: The current moment is any preset moment in a preset moment set, wherein the preset moment set includes at least one preset moment, and the preset moment is set based on a product associated with the transaction data; The transaction data has been stored in a database of the transaction system, wherein the transaction data is obtained based on click operations performed by the user on the associated client.
4. The method according to claim 2, characterized in that The step of aggregating the incremental source data set and the historical source data set in the big data warehouse to obtain a target data set includes: Based on the incremental transaction data contained in the incremental source data set, updating the historical transaction data contained in the historical source data set; The updated historical source data set is taken as the target data set.
5. The method according to any one of claims 1 to 4, characterized in that: Each product description information includes a product identifier and at least one corresponding product resource information, and each product resource information includes the consumed resources and added resources associated with the client, and the quantity of the corresponding products; Generating the query result of the client based on the acquired product description information includes: Based on the consumed resources, increased resources, and the corresponding product quantity of each product, the resources of each product held by the client are determined according to each settlement period, and the query results of the client are generated based on the determined resources of each product.
6. A data analysis device, characterized in that: include: An acquisition module is used to acquire the wide table data associated with the client from the big data warehouse associated with the client after receiving a query request sent by the client, wherein the query request includes the user identification of the client and the information to be queried, the wide table data is obtained by performing data analysis on the target data set, the target data set is obtained by summarizing the incremental source data set and the historical source data set, the incremental source data set is obtained from the database of the transaction system whenever the trigger condition is met during the current settlement cycle, the database is used to store the incremental transaction data generated after each client performs a transaction operation, and the wide table data includes the user identification of each client and the product description information of each product held by each client; A generating module, configured to obtain, from the wide table data, product description information of products held by the client that matches the information to be queried based on the user identifier of the client, and generate a query result of the client based on the obtained product description information; The acquisition module is also used to obtain the target data set of the current settlement cycle stored in the big data warehouse for each client before the end of the current settlement cycle, after determining that the final wide table data of the current settlement cycle is obtained; perform data analysis on the target data set of the current settlement cycle to obtain the first resource of each product held by each client; obtain product description information of each product held by each client based on the final wide table data, and obtain the second resource of each product held by each client based on the obtained product description information; compare the first resource with the corresponding second resource respectively; and after determining that the comparison result is correct, persistently store the final wide table data in the big data warehouse.
7. The device according to claim 6, characterized in that The wide table data is obtained by performing the following operations: In the current settlement cycle, if it is determined that any trigger condition is met, the incremental source data set is obtained from the database of the transaction system, and the acquired incremental source data set is stored in the big data warehouse, wherein the incremental source data set includes a user identifier of at least one client and incremental transaction data of the at least one client; Aggregating the incremental source data set and the historical source data set in the big data warehouse to obtain a target data set, wherein the historical source data set includes historical transaction data associated with at least one client before the incremental source data set is obtained this time; The target data set is analyzed by using a pre-built wide table to obtain the wide table data.
8. The device according to claim 7, characterized in that The trigger conditions include some or all of the following conditions: The current moment is any preset moment in a preset moment set, wherein the preset moment set includes at least one preset moment, and the preset moment is set based on a product associated with the transaction data; The transaction data has been stored in a database of the transaction system, wherein the transaction data is obtained based on click operations performed by the user on the associated client.
9. The device according to claim 7, characterized in that The incremental source data set and the historical source data set in the big data warehouse are aggregated to obtain a target data set, and the acquisition module is used to: Based on the incremental transaction data contained in the incremental source data set, updating the historical transaction data contained in the historical source data set; The updated historical source data set is taken as the target data set.
10. The device according to any one of claims 6 to 9, characterized in that: Each product description information includes a product identifier and at least one corresponding product resource information, and each product resource information includes the consumed resources and added resources associated with the client, and the quantity of the corresponding products; Based on the acquired product description information, the query result of the client is generated, and the generating module is used to: Based on the consumed resources, increased resources, and the corresponding product quantity of each product, the resources of each product held by the client are determined according to each settlement period, and the query results of the client are generated based on the determined resources of each product.
11. An electronic device, characterized in that: include: at least one processor, and a memory communicatively connected to the at least one processor, wherein: The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the method according to any one of claims 1 to 5.
12. A storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the method as claimed in any one of claims 1 to 5.
13. A computer program product, characterized in that When the computer program product is called and executed by an electronic device, the electronic device executes the method according to any one of claims 1 to 5.
