Analysis method and device based on data query and medium

By collecting data server log data, determining the operation tree and extracting public expressions for merging, public query information is generated, which solves unreasonable query problems caused by non-data professional users and achieves more efficient data query and resource utilization.

CN118779344APending Publication Date: 2024-10-15ZHEJIANG CAINIAO SUPPLY CHAIN MANAGEMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310360626.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-04-03
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

In big data analysis, non-data professional users do not understand the data processing process, which leads to increased data query complexity and resource consumption. In particular, unreasonable query operations due to lower usage thresholds lead to excessive data query consumption.

Method used

By collecting log data from the data server, the operation tree of the query operation is determined, public expressions are extracted and merged, and public query information is generated to provide more reasonable query services and reduce resource consumption.

Benefits of technology

This method can effectively reduce query resource consumption, improve user query efficiency, provide more reasonable query services, meet user needs, and reduce the complexity of data processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118779344A_ABST
    Figure CN118779344A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an analysis method and device based on data query and a medium. The method comprises the following steps: collecting log data of a data server; determining an operation tree of query operation based on the log data; traversing the operation tree, and extracting a plurality of public expressions based on a target node; merging the plurality of public expressions according to a merging rule to generate public query information; and performing feedback based on the public query information. A more reasonable query service can be provided for a user, and resource consumption is reduced while user requirements are met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an analysis method based on data query, an electronic device and a computer-readable storage medium. Background Art

[0002] In the context of big data analysis, all walks of life are paying more and more attention to data, hoping to tap into the potential value of data and provide development for their own industries. With the increasing maturity of big data platforms and the increasing richness of data processing components, the threshold for using data has been continuously lowered. From the earliest manual writing of complex data processing programs, to further streamlined scripting languages, to data processing based on the simple and easy-to-use Structured Query Language (SQL). There are even various application platforms that generate data processing flows by dragging and dropping, making the data processing process more convenient through the layer-by-layer encapsulation of the platform. The threshold for data calculation and processing is constantly lowered, allowing more and more people to enjoy the advantages of data processing. Each user only needs to learn some SQL data processing syntax to quickly query the desired data, so that more and more users can directly participate in the ranks of big data and explore and mine the value of data in real time.

[0003] While data processing provides convenience to users, it also creates some problems. Because the simplification of data processing through upper-level applications only allows users to not understand the complex process of data processing, such as the storage location and storage method of data, the actual storage format of data, and the flow and processing process of data processing. However, the complexity of data query processing will not disappear, and may become more complicated due to the lowering of the threshold for use.

[0004] Because non-data professionals do not understand the process of data processing, the random use of data will lead to a sharp increase in the complexity and consumption of data processing. For example, users only need to query the data of the most recent week, but often scan the entire historical data for brute force scanning and filtering. Or they frequently associate dozens of different large data tables, but the result is only to obtain a simple summary data. Or for an order table that will not have duplicate documents, in order to avoid duplicate counting, blindly increase the calculation of very high deduplication operations. Complex and unreasonable data queries will also lead to a huge increase in data query consumption. Summary of the invention

[0005] The embodiment of the present application provides an analysis method based on data query to reduce query resource consumption.

[0006] Correspondingly, the embodiments of the present application also provide an electronic device and a computer-readable storage medium to ensure the implementation and application of the above system.

[0007] In order to solve the above problems, the present application discloses an analysis method based on data query, which includes:

[0008] Collect log data from the data server;

[0009] Determine an operation tree of a query operation based on the log data;

[0010] Traversing the operation tree, and extracting a plurality of common expressions based on the target node;

[0011] Merging the multiple common expressions according to a merging rule to generate common query information;

[0012] Feedback is provided based on the public query information.

[0013] Optionally, determining an operation tree of a query operation based on the log data includes:

[0014] Query logic information of the query operation is obtained from the log data, and a corresponding operation tree is generated based on the query logic information.

[0015] Optionally, traversing the operation tree and extracting a common expression based on a target node includes:

[0016] Traverse the operation tree from the bottom layer to the upper layer to obtain the sub-operation tree corresponding to the target node;

[0017] Based on the sub-operation tree, a common expression corresponding to the target node is extracted.

[0018] Optionally, traversing the operation tree from the bottom layer to the upper layer to obtain a sub-operation tree corresponding to the target node includes:

[0019] The operation tree is traversed from the bottom layer to the upper layer, and if it is detected that the operator corresponding to the node is the target operator, the node corresponding to the target operator is used as the target node;

[0020] Extract a sub-operation tree from the operation tree with the target node as the root node.

[0021] Optionally, traversing the operation tree from the bottom layer to the upper layer to obtain a sub-operation tree corresponding to the target node includes:

[0022] Traversing the operation tree from the bottom layer to the upper layer;

[0023] When it is detected that the operator corresponding to the node is a first type of operator, obtaining a sub-operation tree corresponding to the first type of operator;

[0024] When it is detected that the operator corresponding to the node is a second type of operator, the sub-operation tree corresponding to the second type of operator is obtained, and the operators corresponding to other nodes are ignored until a leaf node is detected;

[0025] When it is detected that the operator corresponding to the node is a third-category operator, if the target-category operator has been detected before, the sub-operation tree corresponding to the third-category operator is obtained.

[0026] Optionally, determining the node corresponding to the common expression based on the sub-operation tree includes:

[0027] Obtain key information corresponding to the sub-operation tree and generate label data;

[0028] The sub-operation tree is read, and a common expression is generated according to the operators corresponding to each node.

[0029] Optionally, merging the multiple common expressions according to a merging rule to generate common query information includes:

[0030] Normalizing the common expression;

[0031] The two normalized common expressions are merged according to the merging rule to generate common query information.

[0032] Optionally, merging the normalized common expressions according to a merging rule to generate common query information includes at least one of the following steps:

[0033] Obtaining source table information of two common expressions, sorting and merging the source table information;

[0034] If the two common expressions include a third type of operator, the condition information of the third type of operator is merged;

[0035] Perform aggregation analysis on two common expressions and use the union obtained from the analysis to form an aggregate column.

[0036] Optionally, providing feedback based on the public query information includes at least one of the following steps:

[0037] Generate a query report based on the public query information, and feed back the query report;

[0038] Generate prompt information based on the public query information, and feed back the prompt information;

[0039] A query service corresponding to the query operation is generated based on the public query information, and interface information of the query service is fed back.

[0040] Optionally, it also includes: counting resource consumption information and query frequency corresponding to each common expression, and adding the information to the query information.

[0041] Optionally, the normalizing the common expression comprises at least one of the following steps:

[0042] Acquire the label data of the common expression, sort and merge the source table information in the label data according to the set sorting rules;

[0043] Encapsulate the conditions corresponding to the first and third type operators;

[0044] Adjust the specified operator traversed to the top of the expression.

[0045] An embodiment of the present application further discloses an electronic device, including: a processor; and a memory, on which executable code is stored. When the executable code is executed by the processor, the method described in the embodiment of the present application is executed.

[0046] The embodiment of the present application further discloses a computer-readable storage medium on which executable code is stored. When the executable code is executed by a processor, the method described in the embodiment of the present application is executed.

[0047] Compared with the prior art, the embodiments of the present application have the following advantages:

[0048] In an embodiment of the present application, log data of a data service end is collected, and various information of a query operation can be determined based on the log data. Then, an operation tree of the query operation can be determined based on the log data, and an execution logic corresponding to the query operation can be determined. The operation tree is then traversed, and multiple common expressions are extracted based on a target node. A common expression of the query operation is determined based on the execution logic, and the multiple common expressions are merged according to a merging rule to generate common query information. The query common information can reflect various situations of the user's query operation, and feedback can be provided based on the common query information, so as to provide a more reasonable query service to the user, thereby reducing resource consumption while meeting user needs. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 is a structural diagram of a data processing system according to an embodiment of the present application;

[0050] Figure 2 It is a flowchart of the steps of an embodiment of an analysis method based on data query of the present application;

[0051] Figure 3 It is a flowchart of the steps of data collection and processing in an embodiment of an analysis method based on data query of the present application;

[0052] Figure 4 is a flowchart of another analysis method embodiment based on data query of the present application;

[0053] Figure 5 It is a schematic diagram of the structure of an exemplary device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0054] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0055] The embodiments of the present application can be applied to data processing scenarios. While the platform encapsulates data processing to provide users with the convenience of data processing, some users may consume more resources for data query and other processing due to insufficient understanding of the data processing process. In view of this situation, the embodiments of the present application can analyze the common content of data processing by users based on log data, determine common expressions, and then obtain common query information. Based on the query information, the user's demand for data can be understood, and feedback can also be provided to facilitate subsequent queries. For example, it is encapsulated into a corresponding data processing interface for direct user use.

[0056] The present application embodiment provides a data processing system, such as Figure 1 As shown, the data processing system includes: a data acquisition unit 110 , a data storage unit 120 , a data analysis unit 130 and a data feedback unit 140 .

[0057] The data collection unit 110 may also be referred to as a metadata collection (Metadata Collect) unit, which is used to collect log data, and may collect log data of offline running tasks. The collected log data includes relevant data processed by the user.

[0058] The data storage unit 120 may also be referred to as a metadata cleaning and storage unit, which is used to clean the collected log data according to a preset metadata model, store it in the metadata model, and perform metadata storage and management.

[0059] The data analysis unit 130 may also be referred to as a user query statistics and analysis unit, which is used to perform query statistics and analysis based on metadata information. The statistical processing includes information such as subquery codes, query scenarios, and query times. The analysis processing includes analysis of common expressions and query information.

[0060] The data feedback unit 140 may also be referred to as an analysis result feedback unit, which is used to feed back the query results of the usage data collected and analyzed by the data analysis unit 130 to the user for query optimization management.

[0061] On the basis of the above-mentioned embodiments, the embodiments of the present application provide an analysis method based on data query, which can analyze the user's public query information and provide feedback, thereby reducing the consumption of resources and improving the user's query efficiency.

[0062] Reference Figure 2 , showing a step flow chart of an embodiment of an analysis method based on data query.

[0063] Step 202: Collect log data from the data server.

[0064] Among them, log data refers to the operation data related to the computing task performed by the computing device, which is actually the description data for the operation. Among them, the current data processing platform usually uses a computer cluster to process data. The computer cluster includes multiple computing devices, which can be called computing nodes. Each computing node can execute data computing tasks and can generate log data accordingly. The log data may include: node running time, running completion time, cluster environment identifier where the running instance is located, node creation user, storage resource consumption, computing resource consumption, query code, etc. Among them, the node running time refers to the running time of the computing node to perform the data computing task, such as the start time or the task execution duration. The running completion time refers to the time when the computing node completes the data computing task. The running instance refers to the instance where the computing node performs the data computing task, and the cluster environment identifier where the running instance is located refers to the identifier of the cluster environment where the computing node running the instance is located. The node creation user refers to the user who created the data computing task, which can be a user identifier. Storage resource consumption refers to the storage resources consumed by the data computing task. Computing resource consumption refers to the computing resources consumed by the data computing task. The query code refers to the query code corresponding to the data computing task, such as a query script.

[0065] As the computing nodes execute computing tasks, the above data will be generated, generating log data. The embodiment of the present application can continuously receive log data from each computing node in the cluster and aggregate the data originally scattered in the cluster. For example, log data is collected by a data collection unit.

[0066] Among them, the most common and universal way to process massive amounts of data is to divide and conquer, that is, to break down a large data processing task into small units that can be processed by a single computing node. While this model increases flexibility and scalability, it actually increases uncertainty. Since the resource hardware of each computing node is different, the cluster environment is different every day, and the potential problems that may exist are also different, it is very important to collect the complete log data available on each machine, including upstream and downstream nodes, running time, user creation, storage resource consumption, computing resource consumption and other information, for later analysis and use.

[0067] In the embodiment of the present application, since the resource hardware of each data computing node is different and the environment of the cluster is different every day, the collected log data may have various data problems, such as missing data, garbled data, data redundancy, etc. Therefore, before calculating and statistically analyzing the data, some data cleaning and processing are required to process the data into a specified format. The collected log data can be cleaned, including deleting specified columns, correcting erroneous data, deleting duplicates, correcting logic, supplementing null values, unifying data formats, etc., and the cleaned data is stored in a pre-set metadata model.

[0068] In an optional embodiment, at least one of the following cleaning processing steps is performed on the log data: analyzing the log data and deleting the field data corresponding to the target field; performing error correction processing on the log data and correcting the log data with storage errors; performing duplicate checking processing on the log data and deleting duplicate log data; performing logical analysis on the log data and correcting the log data with logical errors; analyzing the log data to determine the fields with empty values ​​and supplementing the field data of the fields.

[0069] Among them, some fields in the log data may have null values, that is, no data, and some fields may not be needed in subsequent data analysis. Therefore, the log data can be analyzed. If there is an unnecessary target field, the field data of the target field can be deleted. For example, time-related data such as running time is not very useful for subsequent analysis and processing, so it can be deleted. For example, if the field data of some fields is null, the corresponding field data can be supplemented. For example, if the cluster environment identifier where the running instance is located is null, the identifier of the cluster environment where the instance is located at that time can be determined based on information such as running time and supplemented. Some log data may contain errors, so error correction processing can be performed to determine the field data storing the erroneous data and correct it. Some log data may be repeated, so the log data can be checked for duplication and the duplicate log data can be deleted. Logical analysis can also be performed on the log data, that is, the processing logic of the log data is analyzed, and the log data with logical errors can be corrected.

[0070] In the embodiment of the present application, in order to facilitate subsequent analysis and processing, the target format of the log data can be set, the log data is formatted, and the log data of the target format is determined. Therefore, the format of the log data can be detected, and if it is not the target format, the log data is formatted, and if the log data of the target format is determined, it does not need to be converted and can be directly stored for subsequent use.

[0071] In some embodiments, the collection and storage of log data includes the following steps:

[0072] Step 302: pre-set the metadata model.

[0073] The embodiment of the present application can analyze and manage the data of repeated queries, so the metadata model can be pre-set to facilitate the storage of data for subsequent analysis. The metadata stored in the metadata model includes: the instance identity (Identity, ID) of the running instance on the computing node, the cluster environment identity where the running instance is located, the node creation user, storage resource consumption, computing resource consumption, query scripts such as SQL scripts, etc.

[0074] Step 304: read the collected log data.

[0075] The collected log data can be continuously read. In one example, the logs can be continuously sent to the data storage unit after being collected by the data collection unit. In another example, the data storage unit can monitor the data collection unit and pull the corresponding log data after monitoring new log records.

[0076] Step 306, determining whether the log data already exists.

[0077] If yes, execute step 308 , if no, execute step 310 .

[0078] Step 308: Update the stored log data based on the log data.

[0079] If it is detected that the log data is a stored log record, the corresponding record may be updated based on the log data.

[0080] Step 310: insert the log data.

[0081] If the log data is not a stored record, the log data may be inserted into the log record.

[0082] Step 312: clean the log data.

[0083] The log data can be cleaned through the above cleaning processing steps.

[0084] Step 314: convert the format of the cleaned log data.

[0085] Step 316: Store the log data in the target format into the metadata model.

[0086] The format of the log data can be detected, and if it is not in the target format, the log data is converted into a format, and if the log data is in the target format, no conversion is required. The log data in the target format is stored in the metadata model.

[0087] This enables the collection, cleaning, storage and other processing of log data, making it easier to analyze the log data later.

[0088] The embodiment of the present application analyzes the log data through the data analysis unit, and through massive data analysis, extracts all common expressions from the source expression set corresponding to the query information, as well as the machine resources that will be saved in the future after these common expressions are pre-calculated. Based on these data, the expression selection algorithm is used to determine which expressions should be materialized so that the machine resources can be saved when the source expression set is executed again. These selected expressions are then passed to the data feedback unit for user data governance suggestion push. This can be achieved through the following steps.

[0089] Step 204: Determine an operation tree of the query operation based on the log data.

[0090] In an embodiment of the present application, the log data includes a query script, and the query logic information can be determined based on the query script, that is, the data of the logical processing performed by the query operation of the query script, or the query logic information can be directly added to the log data, thereby directly obtaining the query logic information from the log data. Then the operation tree of the query operation can be determined based on the query logic information. The operation tree refers to the abstract operator data of the operator in the query logic of the query operation. Among them, the operator refers to the basic calculation element. Taking SQL as an example, the operator may include a join operator, a scan operator, a filter operator, an aggregate operator, etc. In the operation tree, each node corresponds to a corresponding operator, and the operator and the execution order of the operator are determined based on the query logic information of the query operation to generate a corresponding operation tree.

[0091] Step 206, traverse the operation tree and extract common expressions based on the target node.

[0092] In the embodiment of the present application, the public expression can be understood as the public logic information of the query operation, including information such as the operator or parameter corresponding to the calculation of the query operation.

[0093] After obtaining the operation tree, the operation tree can be traversed, the operator corresponding to each node can be determined by traversal, and the common expression corresponding to the corresponding operator can be extracted based on the operator. The traversing of the operation tree and extracting the common expression based on the target node include: traversing the operation tree from the bottom layer to the upper layer to obtain the sub-operation tree corresponding to the target node; extracting the common expression corresponding to the target node based on the sub-operation tree.

[0094] The traversal of the operation tree can be performed from the bottom to the top, that is, traversing from the bottom node to the upper node layer by layer. During the traversal process, the operator corresponding to the node is detected. If the operator is the target to be extracted, the corresponding node can be used as the target node, and the sub-operation tree of the operator corresponding to the target node is extracted. Based on the sub-operation tree, the public expression corresponding to the target node is extracted. That is, the operation tree is traversed from the bottom to the upper layer to obtain the sub-operation tree corresponding to the target node, including: traversing the operation tree from the bottom to the upper layer, if it is detected that the operator corresponding to the node is the target operator, the node corresponding to the target operator is used as the target node; extracting the sub-operation tree from the operation tree with the target node as the root node.

[0095] In some other optional embodiments, the traversing the operation tree from the bottom layer to the upper layer to obtain the sub-operation tree corresponding to the target node includes: traversing the operation tree from the bottom layer to the upper layer; when it is detected that the operator corresponding to the node is a first-category operator, obtaining the sub-operation tree corresponding to the first-category operator; when it is detected that the operator corresponding to the node is a second-category operator, obtaining the sub-operation tree corresponding to the second-category operator, and ignoring the operators corresponding to other nodes until a leaf node is detected; when it is detected that the operator corresponding to the node is a third-category operator, if the first-category operator has been detected before, obtaining the sub-operation tree corresponding to the third-category operator.

[0096] In the embodiment of the present application, since different operators correspond to different calculation and processing logics, during the traversal of the operation tree, the sub-operation tree can be extracted for the specified operator, and the range of the extracted operands can be determined based on the type of operator. For example, the first type of operator can be a Join operator, the second type of operator can be a Scan operator and an Aggregate operator, and the third type of operator can be a Filter operator. Among them, the JOIN operator is used to join the data of two tables according to specific conditions. The Filter operator is an operator for conditional filtering of data. The Scan operator is an operator used for scanning operations. The Aggregate operator is used to perform data aggregation processing, such as accumulating data.

[0097] Among them, the operation tree can be traversed. When the operator corresponding to the traversed node is a first-class operator, such as a Join operator, the node is determined to be the target node, and a sub-operation tree with the target node corresponding to the first-class operator as the root node can be extracted, that is, the lower-level nodes corresponding to the target node are extracted to obtain the corresponding sub-operation tree.

[0098] When the operator corresponding to a node is a second-class operator, such as a Scan operator or an Aggregate operator, the node corresponding to the operator can be used as the target node, and the corresponding sub-operation tree can be extracted with the target node as the root node. Among them, the second-class operator is a type that the expression supports one, so after extracting the sub-operation tree corresponding to the operator, the target operator detected later can be ignored until the node corresponding to the target operator is a leaf node, that is, traverse another branch. For example, when traversing to the node corresponding to the Aggregate operator, extract the sub-operation tree with the node as the root node, and ignore the operators encountered later for the Aggregate operator until the nodes corresponding to other operators are re-traversed and are leaf nodes. When traversing to the Scan operator, ignore any operators encountered later until the nodes corresponding to other operators are re-traversed and are leaf nodes.

[0099] When it is detected that the operator corresponding to the node is a third-category operator, such as the Filter operator, a forward query is performed on the operator corresponding to the previously traversed node. If the target-class operator has been detected, the target-class operator includes the first-class operators and may also include at least part of the second-class operators. For example, if the target-class operator is a Join operator and an Aggregate operator, the target node corresponding to the third-class operator can be used as the root node to extract the sub-operation tree.

[0100] Thus, the sub-operation tree corresponding to each target operator can be extracted. Then, the common expression corresponding to the node can be determined based on the sub-operation tree. Among them, the key information corresponding to the sub-operation tree can be obtained to generate label data; the sub-operation tree is read, and a common expression is generated according to the operator corresponding to each node. For each sub-operation tree, the information corresponding to each operator in the sub-operation tree can be obtained, such as the source table information involved in the query operation, including the source table name, project space (Project) and other data, and can also include the resource data consumed by the execution of the query operation, such as the resource data consumed when the operator is executed, including CPU consumption data, memory consumption data, etc. It can also be determined whether there is an aggregation (group by) operator corresponding to the node of the sub-operation tree, wherein the group by operator is used to perform group aggregation calculation operations in SQL. Therefore, the label data includes source table label data, resource label data and aggregate label data, wherein the source table label data includes source table information such as source table name and project space (Project), the resource label data includes resource data consumed by the common expression, and the aggregate label data is used to identify whether the group by operator is included. If the group by operator is included, it is set to 1 or true, and if the group by operator is not included, it is set to 0 or false. Then the sub-operation tree can be read, and the common expression can be generated according to the operator corresponding to each node, that is, the logical relationship of each operator is set according to the hierarchical relationship of the sub-operation tree, and the corresponding common expression is obtained, and the label data is used as the label data of the common expression.

[0101] Step 208: merge the multiple common expressions according to the merging rule to generate common query information.

[0102] Multiple common expressions can be obtained from the log data, and each common expression can be merged according to a merging rule to obtain a merged common expression as common query information, which is the content of repeated queries.

[0103] The step of merging the plurality of common expressions according to a merging rule to generate common query information includes: normalizing the common expressions; merging the normalized common expressions according to the merging rule to generate common query information. It can be determined whether the common expression supports normalization processing. If not, the common expression is deleted, and normalization processing is performed on common expressions that support normalization processing.

[0104] Among them, normalizing the common expression includes at least one of the following steps: obtaining label data of the common expression, sorting and merging source table information in the label data according to set sorting rules; encapsulating conditions corresponding to the first type of operators and the third type of operators; and adjusting the traversed specified operator to the top of the expression.

[0105] The sorting rule is set to be a pre-set sorting rule, such as in the order of dictionary order, operation time, etc. Obtain the label data corresponding to the common expression, obtain the information of each source table from the label data, sort the information of each source table according to the set sorting rule, and complete the normalization of the source table information. For the common expression, if it includes the first type of operator such as Join operator and the third type of operator such as Filter, obtain the condition information corresponding to the operator and uniformly encapsulate the condition information. If the common expression includes a specified operator such as Aggregate operator, the expression corresponding to the Aggregate operator can be transferred to the top of the common expression.

[0106] Then, the normalized common expressions can be merged according to the merge rules to generate common query information. The merge rules may include multiple types, such as source table merge rules, conditional merge rules, aggregation rules, etc. The source table merge rule refers to the rule for merging source table information, the conditional merge rule refers to the rule for merging based on the filter condition, and the aggregation rule refers to the rule for aggregating based on the operator. The normalized common expressions are merged according to the merge rules to generate common query information, including at least one of the following steps: obtaining the source table information of the two common expressions, sorting and merging the source table information; if the two common expressions include a third type of operator, merging the conditional information of the third type of operator; performing aggregation analysis on the two common expressions, and forming the union obtained by the analysis into an aggregate column. For any two common expressions, the source table information can be sorted and merged according to the set sorting rules. In the case where the two common expressions include a third type of operator, the conditional information of the third type of operator is merged, for example, the Filter operator is merged. By performing aggregation analysis on two common expressions, the union of the two common expressions can be determined, and then the corresponding aggregate column, that is, the Group By column, can be obtained by merging based on the union.

[0107] In the embodiment of the present application, resource consumption information and query frequency corresponding to each public expression may also be counted and added to the query information. The query frequency, resource consumption information, etc. corresponding to the public expression may be obtained, added to the public query information, and the public query information may be stored. Step 210 corresponding to the query user may also be fed back based on the public query information.

[0108] Feedback can be provided to the user for the public query information, such as providing prompts based on the information frequently queried by the user, or generating corresponding query services for the user for direct use by the user.

[0109] In an embodiment of the present application, feedback is provided based on the public query information, including at least one of the following steps: generating a query report based on the public query information, and feeding back the query report; generating prompt information based on the public query information, and feeding back the prompt information; generating a query service corresponding to the query operation based on the public query information, and feeding back the interface information of the query service. A visualization tool can be used to generate a visualized query report from the public query information, and push it to the corresponding query user, so that the user can query the situation. Prompt information can also be generated based on the public query information, and the prompt information can prompt a query method with reasonable resource consumption, or prompt that the frequency of certain query operations is high, and a corresponding query service can be generated to facilitate user queries. A query script corresponding to the query operation can also be generated based on the public query information, and the corresponding query service can be encapsulated based on the query script, and the interface information of the query service can be fed back, so that the user can directly call the interface for query.

[0110] In an embodiment of the present application, a visual report is generated based on public query information and pushed to the corresponding queryer, so as to encourage the upstream provider of query services to generate corresponding intermediate tables or views for public queries with a large number of repeated queries and high actual consumption. The corresponding recommended table creation code can be automatically generated according to the table / view name set by the user using string concatenation, thereby reducing the development workload. When the user uses it, the intermediate table / view can be directly queried, which can also reduce the resource consumption of downstream user queries.

[0111] In summary, the log data of the data server is collected, and various information of the query operation can be determined based on the log data. Then, the operation tree of the query operation can be determined based on the log data, and the execution logic corresponding to the query operation is determined. Then, the operation tree is traversed, and multiple common expressions are extracted based on the target node. The common expression of the query operation is determined based on the execution logic, and then the multiple common expressions are merged according to the merging rules to generate common query information. The query common information can reflect various situations of the user's query operation, and feedback is provided based on the common query information, so as to provide more reasonable query services to users, while meeting user needs and reducing resource consumption.

[0112] On the basis of the above-mentioned embodiments, the embodiments of the present application also provide an analysis method based on data query, which can analyze public query information based on the user's query operation, provide reasonable improvement measures, and reduce unreasonable consumption of resources.

[0113] Reference Figure 4 , showing a step flow chart of an embodiment of an analysis method based on data query of the present application.

[0114] Step 402: Collect log data from the data server.

[0115] Step 404: Acquire query logic information of the query operation from the log data, and generate a corresponding operation tree based on the query logic information.

[0116] Step 406: traverse the operation tree from the bottom layer to the upper layer.

[0117] Step 408, determining whether the operator corresponding to the node is the target operator;

[0118] If yes, execute step 410, if no, continue traversing.

[0119] Among them, if the first type of operator, the second type of operator, and the third type of operator are detected, it is determined that the target operator is detected. Of course, other operators can also be used as target operators. It can be determined according to needs, and the embodiments of the present application do not limit this.

[0120] Step 410: Use the node corresponding to the target operator as the target node.

[0121] Step 412: extract a sub-operation tree from the operation tree with the target node as the root node.

[0122] Among them, for the first type of operator, the sub-operation tree is extracted from the operation tree with the node of the first type of operator as the root node. For the second type of operator, the sub-operation tree is extracted from the operation tree with the node of the second type of operator as the root node, and the operators corresponding to other nodes are ignored until the leaf node is detected. For the third type of operator, if the target type operator has been detected before, the sub-operation tree is extracted from the operation tree with the node of the third type of operator as the root node. If the target type operator has not been detected before, the operator is ignored and the detection continues.

[0123] Step 414, normalize the common expression.

[0124] Among them, normalizing the common expression includes at least one of the following steps: obtaining label data of the common expression, sorting and merging source table information in the label data according to set sorting rules; encapsulating conditions corresponding to the first type of operators and the third type of operators; and adjusting the traversed specified operator to the top of the expression.

[0125] Step 416: merge the two normalized common expressions according to the merging rule to generate common query information.

[0126] The normalized common expressions are merged according to the merging rules to generate common query information, including at least one of the following steps: obtaining source table information of two common expressions, sorting and merging the source table information; if the two common expressions include a third type of operator, merging the condition information of the third type of operator; performing aggregation analysis on the two common expressions, and forming an aggregate column from the union obtained by the analysis.

[0127] Step 418: Count the resource consumption information and query frequency corresponding to each common expression and add them to the query information.

[0128] Step 420: providing feedback based on the public query information.

[0129] The method comprises at least one of the following steps: generating a query report based on the public query information and feeding back the query report; generating prompt information based on the public query information and feeding back the prompt information; generating a query service corresponding to the query operation based on the public query information and feeding back the interface information of the query service.

[0130] The embodiments of the present application, by analyzing the public query information of users and providing query reports, can enable the data provider to more clearly understand the data usage behavior of downstream users, thereby eliminating the need to communicate with each user one by one, thereby improving efficiency, and providing corresponding services based on the public query information, thereby upgrading the usability of the data model.

[0131] After understanding the user's data usage behavior, the data provider can directly find the corresponding data users and provide query operations to reduce unreasonable resource consumption. Or generate corresponding query services, pre-calculate intermediate data in a targeted manner, and let downstream data users directly call the service when querying data, automatically switching to a more efficient query method.

[0132] The embodiment of the present application can identify common queries from massive data queries, and the grammatical parsing method is universal and can be smoothly adapted to daily use.

[0133] In an embodiment of the present application, it is possible to perform utility evaluation on public expressions, estimate the cost of calculation by counting the resource consumption of public expressions, and then add the utility evaluation to public query information for subsequent provision of query services, automatic recommendation of query services, and reduction of development workload.

[0134] It should be noted that the embodiments of the present application may involve the use of user data. In actual applications, user-specific personal data can be used in the scheme described herein within the scope permitted by applicable laws and regulations, subject to the requirements of applicable laws and regulations of the country where the user is located (for example, with the user's explicit consent, effective notification to the user, etc.).

[0135] It should be noted that, for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the described order of actions, because according to the embodiments of the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.

[0136] On the basis of the above embodiment, this embodiment further provides an analysis device based on data query, which is applied to electronic devices such as server devices, and the device includes:

[0137] The collection module is used to collect log data from the data server.

[0138] The query tree determination module is used to determine the operation tree of the query operation based on the log data.

[0139] The traversal analysis module is used to traverse the operation tree and extract multiple common expressions based on the target node.

[0140] The merging analysis module is used to merge the multiple common expressions according to the merging rules to generate common query information.

[0141] A feedback module is used to provide feedback based on the public query information.

[0142] In summary, the log data of the data server is collected, and various information of the query operation can be determined based on the log data. Then, the operation tree of the query operation can be determined based on the log data, and the execution logic corresponding to the query operation is determined. Then, the operation tree is traversed, and multiple common expressions are extracted based on the target node. The common expression of the query operation is determined based on the execution logic, and then the multiple common expressions are merged according to the merging rules to generate common query information. The query common information can reflect various situations of the user's query operation, and feedback is provided based on the common query information, so as to provide more reasonable query services to users, while meeting user needs and reducing resource consumption.

[0143] The query tree determination module is used to obtain query logic information of the query operation from the log data, and generate a corresponding operation tree based on the query logic information.

[0144] The traversal analysis module is used to traverse the operation tree from the bottom layer to the upper layer to obtain the sub-operation tree corresponding to the target node; based on the sub-operation tree, extract the public expression corresponding to the target node.

[0145] The traversal analysis module is used to traverse the operation tree from the bottom layer to the upper layer. If it is detected that the operator corresponding to the node is the target operator, the node corresponding to the target operator is used as the target node; and a sub-operation tree is extracted from the operation tree with the target node as the root node.

[0146] The traversal analysis module is used to traverse the operation tree from the bottom layer to the upper layer; when it is detected that the operator corresponding to the node is a first-class operator, the sub-operation tree corresponding to the first-class operator is obtained; when it is detected that the operator corresponding to the node is a second-class operator, the sub-operation tree corresponding to the second-class operator is obtained, and the operators corresponding to other nodes are ignored until a leaf node is detected; when it is detected that the operator corresponding to the node is a third-class operator, if the target class operator has been detected before, the sub-operation tree corresponding to the third-class operator is obtained.

[0147] The merging analysis module is used to normalize the common expressions; merge the two normalized common expressions according to the merging rule to generate common query information.

[0148] The merging analysis module is used to obtain source table information of two common expressions, sort and merge the source table information; if the two common expressions include a third type of operator, merge the condition information of the third type of operator; perform aggregation analysis on the two common expressions, and form an aggregate column with the union obtained by the analysis.

[0149] The feedback module is used to generate a query report based on the public query information and feedback the query report; generate prompt information based on the public query information and feedback the prompt information; generate a query service corresponding to the query operation based on the public query information and feedback the interface information of the query service.

[0150] The embodiments of the present application, by analyzing the public query information of users and providing query reports, can enable the data provider to more clearly understand the data usage behavior of downstream users, thereby eliminating the need to communicate with each user one by one, thereby improving efficiency, and providing corresponding services based on the public query information, thereby upgrading the usability of the data model.

[0151] After understanding the user's data usage behavior, the data provider can directly find the corresponding data users and provide query operations to reduce unreasonable resource consumption. Or generate corresponding query services, pre-calculate intermediate data in a targeted manner, and let downstream data users directly call the service when querying data, automatically switching to a more efficient query method.

[0152] The embodiment of the present application can identify common queries from massive data queries, and the grammatical parsing method is universal and can be smoothly adapted to daily use.

[0153] In an embodiment of the present application, it is possible to perform utility evaluation on public expressions, estimate the cost of calculation by counting the resource consumption of public expressions, and then add the utility evaluation to public query information for subsequent provision of query services, automatic recommendation of query services, and reduction of development workload.

[0154] The embodiment of the present application also provides a non-volatile readable storage medium, which stores one or more modules (programs). When the one or more modules are applied to a device, the device can execute instructions (instructions) of each method step in the embodiment of the present application.

[0155] The present application embodiment provides one or more machine-readable media, on which instructions are stored, and when executed by one or more processors, an electronic device executes one or more methods as described in the above embodiments. In the present application embodiment, the electronic device includes a server, a terminal device, and the like.

[0156] The embodiments of the present disclosure may be implemented as a device configured as desired using any appropriate hardware, firmware, software, or any combination thereof, and the device may include electronic devices such as a server (cluster), a terminal, etc. Figure 5 An exemplary apparatus 500 that can be used to implement various embodiments described in this application is schematically shown.

[0157] For one embodiment, Figure 5 An exemplary apparatus 500 is shown having one or more processors 502, a control module (chip set) 504 coupled to at least one of the processor(s) 502, a memory 506 coupled to the control module 504, a non-volatile memory (NVM) / storage device 508 coupled to the control module 504, one or more input / output devices 510 coupled to the control module 504, and a network interface 512 coupled to the control module 504.

[0158] The processor 502 may include one or more single-core or multi-core processors, and the processor 502 may include any combination of general-purpose processors or special-purpose processors (such as graphics processors, application processors, baseband processors, etc.). In some embodiments, the device 500 can be used as a server, terminal, or other device described in the embodiments of the present application.

[0159] In some embodiments, the apparatus 500 may include one or more computer-readable media (e.g., memory 506 or NVM / storage device 508) having instructions 514 and one or more processors 502 configured in conjunction with the one or more computer-readable media to execute the instructions 514 to implement a module to perform the actions described in the present disclosure.

[0160] For one embodiment, control module 504 may include any suitable interface controller to provide any suitable interface to at least one of processor(s) 502 and / or any suitable device or component in communication with control module 504 .

[0161] The control module 504 may include a memory controller module to provide an interface to the memory 506. The memory controller module may be a hardware module, a software module, and / or a firmware module.

[0162] The memory 506 may be used, for example, to load and store data and / or instructions 514 for the device 500. For one embodiment, the memory 506 may include any suitable volatile memory, such as a suitable DRAM. In some embodiments, the memory 506 may include a double data rate type four synchronous dynamic random access memory (DDR5 SDRAM).

[0163] For one embodiment, control module 504 may include one or more input / output controllers to provide an interface to NVM / storage device 508 and input / output device(s) 510 .

[0164] For example, NVM / storage 508 may be used to store data and / or instructions 514. NVM / storage 508 may include any suitable non-volatile memory (e.g., flash memory) and / or may include any suitable non-volatile storage device(s) (e.g., one or more hard disk drives (HDDs), one or more compact disk (CD) drives, and / or one or more digital versatile disk (DVD) drives).

[0165] NVM / storage device 508 may include storage resources that are part of the device on which apparatus 500 is installed, or it may be accessible to the device without being part of the device. For example, NVM / storage device 508 may be accessed via (one or more) input / output devices 510 over a network.

[0166] (One or more) input / output devices 510 may provide an interface for the apparatus 500 to communicate with any other appropriate device, and the input / output device 510 may include a communication component, an audio component, a sensor component, etc. The network interface 512 may provide an interface for the apparatus 500 to communicate through one or more networks, and the apparatus 500 may wirelessly communicate with one or more components of a wireless network according to any of one or more wireless network standards and / or protocols, for example, accessing a wireless network based on a communication standard, such as Bluetooth, WiFi, 2G, 3G, 4G, 5G, etc., or a combination thereof for wireless communication.

[0167] For one embodiment, at least one of the processor(s) 502 may be packaged together with the logic of one or more controllers (e.g., a memory controller module) of the control module 504. For one embodiment, at least one of the processor(s) 502 may be packaged together with the logic of one or more controllers of the control module 504 to form a system-in-package (SiP). For one embodiment, at least one of the processor(s) 502 may be integrated on the same die with the logic of one or more controllers of the control module 504. For one embodiment, at least one of the processor(s) 502 may be integrated on the same die with the logic of one or more controllers of the control module 504 to form a system-on-chip (SoC).

[0168] In various embodiments, the apparatus 500 may be, but is not limited to, a terminal device such as a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet computer, a netbook, etc.). In various embodiments, the apparatus 500 may have more or fewer components and / or a different architecture. For example, in some embodiments, the apparatus 500 includes one or more cameras, a keyboard, a liquid crystal display (LCD) screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, an application-specific integrated circuit (ASIC), and a speaker.

[0169] Among them, the main control chip can be used as a processor or control module in the detection device, sensor data, location information, etc. are stored in a memory or NVM / storage device, the sensor group can be used as an input / output device, and the communication interface may include a network interface.

[0170] The embodiment of the present application also provides an electronic device, including: a processor; and a memory, on which executable code is stored, and when the executable code is executed, the processor executes one or more methods as described in the embodiment of the present application. In the embodiment of the present application, the memory can store various data, such as target files, file and application association data, and user behavior data, so as to provide a data basis for various processing.

[0171] The embodiments of the present application also provide one or more machine-readable media on which executable codes are stored. When the executable codes are executed, the processor executes one or more methods described in the embodiments of the present application.

[0172] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0173] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0174] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of 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 processes and / or boxes 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 terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0175] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0176] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0177] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.

[0178] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0179] The above is a detailed introduction to an analysis method based on data query, an electronic device and a computer-readable storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. An analysis method based on data query, characterized in that: The method comprises: Collect log data from the data server; Determine an operation tree of a query operation based on the log data; Traversing the operation tree, and extracting a plurality of common expressions based on the target node; Merging the multiple common expressions according to a merging rule to generate common query information; Feedback is provided based on the public query information.

2. The method according to claim 1, characterized in that: The operation tree of determining the query operation based on the log data includes: Query logic information of the query operation is obtained from the log data, and a corresponding operation tree is generated based on the query logic information.

3. The method according to claim 2, characterized in that The traversing the operation tree and extracting a common expression based on a target node includes: Traverse the operation tree from the bottom layer to the upper layer to obtain the sub-operation tree corresponding to the target node; Based on the sub-operation tree, a common expression corresponding to the target node is extracted.

4. The method according to claim 3, characterized in that Traversing the operation tree from the bottom layer to the upper layer to obtain the sub-operation tree corresponding to the target node includes: The operation tree is traversed from the bottom layer to the upper layer, and if it is detected that the operator corresponding to the node is the target operator, the node corresponding to the target operator is used as the target node; Extract a sub-operation tree from the operation tree with the target node as the root node.

5. The method according to claim 3, characterized in that: Traversing the operation tree from the bottom layer to the upper layer to obtain the sub-operation tree corresponding to the target node includes: Traversing the operation tree from the bottom layer to the upper layer; When it is detected that the operator corresponding to the node is a first type of operator, obtaining a sub-operation tree corresponding to the first type of operator; When it is detected that the operator corresponding to the node is a second type of operator, the sub-operation tree corresponding to the second type of operator is obtained, and the operators corresponding to other nodes are ignored until a leaf node is detected; When it is detected that the operator corresponding to the node is a third-category operator, if the target-category operator has been detected before, the sub-operation tree corresponding to the third-category operator is obtained.

6. The method according to claim 1, characterized in that The merging of the multiple common expressions according to a merging rule to generate common query information includes: Normalizing the common expression; The two normalized common expressions are merged according to the merging rule to generate common query information.

7. The method according to claim 6, characterized in that The step of merging the normalized common expressions according to the merging rule to generate common query information includes at least one of the following steps: Obtaining source table information of two common expressions, sorting and merging the source table information; If the two common expressions include a third type of operator, the condition information of the third type of operator is merged; Perform aggregation analysis on two common expressions and use the union obtained from the analysis to form an aggregate column.

8. The method according to claim 1, characterized in that Providing feedback based on the public query information includes at least one of the following steps: Generate a query report based on the public query information, and feed back the query report; Generate prompt information based on the public query information, and feed back the prompt information; A query service corresponding to the query operation is generated based on the public query information, and interface information of the query service is fed back.

9. An electronic device, comprising: processor; and a memory having executable codes stored thereon, wherein when the executable codes are executed by a processor, the method according to any one of claims 1 to 8 is executed.

10. A computer-readable storage medium having executable codes stored thereon, wherein when the executable codes are executed by a processor, the method according to any one of claims 1 to 8 is executed.