Data query method and device, electronic equipment and storage medium

By receiving user-inputted data measurement requests, determining and transforming them into subquery information and post-processing information, the problem of low data query efficiency in existing technologies is solved, and efficient data measurement across data storage engines is achieved.

CN115544081BActive Publication Date: 2026-04-10BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-24
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing technologies require manual integration of data from multiple data storage engines when making complex data measurement requests, resulting in low data query efficiency and a high risk of errors, making it difficult to meet personalized needs.

Method used

By receiving data measurement requests from users, the system determines the data storage engine associated with the measurement expression, transforms it into subquery information and post-processing information, generates the target query result, and realizes data measurement across data storage engines.

Benefits of technology

It improves data query efficiency, reduces the complexity of data measurement, avoids data measurement delays, and does not require the operation of professional technicians.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115544081B_ABST
    Figure CN115544081B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide a data query method and device, electronic equipment and storage medium. The method comprises: receiving a data measurement request input by a user based on a data query interface, obtaining a measurement expression corresponding to the data measurement request; determining a data storage engine associated with the measurement expression, converting the measurement expression into subquery information corresponding to each data storage engine and post-processing information associated with the subquery information; obtaining a subquery result corresponding to the subquery information fed back by the data storage engine, generating a target query result according to the subquery result and the post-processing information, and displaying the target query result. The technical solution of the embodiments of the present disclosure can realize cross-data storage engine data measurement, which can not only avoid the phenomenon of data measurement delay, but also reduce the complexity of data measurement without relying on professional technical personnel operation. Further improve the efficiency of data query.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present disclosure relate to data processing technology, and in particular, to a data query method and device, an electronic device, and a storage medium. BACKGROUND

[0002] For a complex data measurement request, data query needs to be performed from multiple data storage engines. In the related art, professional technical personnel usually needs to individually obtain data from each data storage engine, and manually integrate and process the data obtained by each data storage engine, and then recompute the integrated data according to the data measurement request. Once a large amount of data needs to be obtained, data measurement delay phenomenon is likely to occur, and the operation is prone to error, and it is difficult to troubleshoot problems, thereby reducing the efficiency of data query. SUMMARY

[0003] The present disclosure provides a data query method, device, electronic device, and storage medium to realize data measurement across data storage engines and improve data query efficiency.

[0004] In a first aspect, the embodiments of the present disclosure provide a data query method, which includes:

[0005] receiving a data measurement request input by a user based on a data query interface, obtaining a measurement expression corresponding to the data measurement request;

[0006] determining a data storage engine associated with the measurement expression, converting the measurement expression into subquery information corresponding to each data storage engine and post-processing information associated with the subquery information;

[0007] obtaining a subquery result corresponding to the subquery information fed back by the data storage engine, generating a target query result according to the subquery result and the post-processing information, and displaying the target query result.

[0008] In a second aspect, the embodiments of the present disclosure also provide a data query device, which includes:

[0009] The request receiving module is configured to receive a data measurement request input by a user based on a data query interface, and obtain a measurement expression corresponding to the data measurement request.

[0010] The request conversion module is configured to determine a data storage engine associated with the measurement expression, and convert the measurement expression into subquery information corresponding to each data storage engine and post-processing information associated with the subquery information.

[0011] The result output module is configured to acquire a subquery result corresponding to the subquery information fed back by the data storage engine, generate a target query result according to the subquery result and the post-processing information, and display the target query result.

[0012] In a third aspect, the embodiments of the present disclosure further provide an electronic device, which comprises:

[0013] one or more processors;

[0014] a storage device configured to store one or more programs,

[0015] When the one or more programs are executed by the one or more processors, the one or more processors implement the data query method according to any of the embodiments of the present disclosure.

[0016] In a fourth aspect, the embodiments of the present disclosure further provide a storage medium containing computer executable instructions, which, when executed by a computer processor, are configured to implement the data query method according to any of the embodiments of the present disclosure.

[0017] The technical solution of the embodiments of the present disclosure can acquire a metric expression corresponding to a data metric request input by a user based on a data query interface, and can accurately acquire the data metric requirement based on the data query interface through user interaction, and meet the user's personalized metric requirement setting, compared with the prior art. After the metric expression is acquired, the data storage engine associated with the metric expression can be determined, the metric expression can be converted into subquery information corresponding to each data storage engine and post-processing information associated with the subquery information, the complex metric logic can be simplified, and the foundation for subsequent fast response of data query is laid. Then, the subquery result corresponding to the subquery information fed back by the data storage engine is acquired, the target query result is generated according to the subquery result and the post-processing information, and the target query result is displayed, which solves the problem of high data metric complexity and low data query efficiency in related data query technologies. The data metric across data storage engines can be implemented, which not only avoids the phenomenon of data metric delay, but also reduces the complexity of data metric, and does not need to rely on professional technical personnel operation. The efficiency of data query is further improved. BRIEF DESCRIPTION OF DRAWINGS

[0018] The above and other features, advantages, and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the original and elements are not necessarily drawn according to the scale.

[0019] Figure 1 A flowchart of a data query method provided by an embodiment of the present disclosure;

[0020] Figure 2 A flowchart of a data query method provided by an embodiment of the present disclosure;

[0021] Figure 3 A schematic diagram of a metric abstract syntax tree in a data query method provided by an embodiment of the present disclosure;

[0022] Figure 4 A flowchart of a data query method provided by an embodiment of the present disclosure;

[0023] Figure 5 A flowchart of a data query method provided by an embodiment of the present disclosure;

[0024] Figure 6 A system architecture schematic diagram of a multi-data storage engine service applicable to a data query method provided by an embodiment of the present disclosure;

[0025] Figure 7 A system working principle diagram of a data query method provided by an embodiment of the present disclosure for performing data metrics;

[0026] Figure 8 A system working principle diagram of an AST semantic analysis optimizer for performing a data query method provided by an embodiment of the present disclosure;

[0027] Figure 9 A structural schematic diagram of a data query device provided by an embodiment of the present disclosure;

[0028] Figure 10 A structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0029] Embodiments of the present disclosure will be described in more detail by referring to the attached drawings. Although certain embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein, but rather the embodiments are provided to make the present disclosure more thorough and complete. It should be understood that the drawings and embodiments of the present disclosure are for exemplary purposes only and are not intended to limit the scope of protection of the present disclosure.

[0030] It should be understood that each step described in the method embodiments of the present disclosure can be executed in different orders and / or in parallel. In addition, the method embodiments can include additional steps and / or omit the execution of the steps shown. The scope of the present disclosure is not limited in this respect.

[0031] As used herein, the term "includes" and its variants are to be read to be analogous to "comprises," or "comprising." The term "based on" is to be read as "based, at least in part, on." The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments." Related terms have corresponding meanings.

[0032] It should be noted that the terms "first", "second", etc. mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not intended to limit the order or interdependence of the functions performed by these devices, modules or units.

[0033] It should be noted that the modification of "one" or "multiple" mentioned in the present disclosure is illustrative rather than limiting, and those skilled in the art should understand that unless the context clearly indicates otherwise, it should be understood as "one or more".

[0034] The names of the messages or information exchanged between the devices in the embodiments of the present disclosure are only for illustrative purposes, and are not intended to limit the scope of the messages or information.

[0035] It can be understood that, before using the technical solutions disclosed in the embodiments of the present disclosure, the type, use range, use scenario, etc. of the personal information involved in the present disclosure should be informed to the user and the authorization of the user should be obtained through appropriate means according to relevant laws and regulations.

[0036] For example, in response to receiving the active request of the user, prompt information is sent to the user to explicitly prompt the user that the operation requested to be performed will require obtaining and using the personal information of the user. Thus, the user can voluntarily choose whether to provide personal information to the software or hardware such as electronic device, application program, server or storage medium that performs the operation of the technical solutions of the present disclosure according to the prompt information.

[0037] As an optional but non-limiting implementation manner, in response to receiving the active request of the user, the manner of sending prompt information to the user may, for example, be a pop-up window manner, and the prompt information may, for example, be presented in the form of text in the pop-up window. In addition, the pop-up window may, for example, carry a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.

[0038] It can be understood that the above notification and user authorization process is only illustrative, and does not limit the implementation manner of the present disclosure, and other manners meeting the relevant laws and regulations can also be applied to the implementation manner of the present disclosure.

[0039] It can be understood that the data involved in the technical solution (including but not limited to the data itself, the acquisition or use of the data) should comply with the requirements of the corresponding laws and regulations and relevant provisions.

[0040] Figure 1 A flowchart of a data query method provided by the embodiments of the present disclosure is provided. The embodiments of the present disclosure are applicable to scenarios of querying data, and are particularly applicable to situations of querying data based on different data storage engines. The method can be executed by a data query device, which can be implemented in the form of software and / or hardware, and can be implemented by an electronic device, which can be a mobile terminal, a PC terminal, or a server, etc.

[0041] As shown in Figure 1 , the method comprises:

[0042] S110, receiving a data measurement request input by a user based on a data query interface, and obtaining a measurement expression corresponding to the data measurement request.

[0043] The data query interface can be understood as an interface for receiving a request of the user to input query data. The request of querying data can include a data measurement request. The data query interface can display an input control (Input) for inputting a measurement expression and a button control (Button) bound to the input control. The input control can be a text input box (TextBox) or a multi-line text box (TextArea). The button control is a response control and can be used to receive a data measurement request input by the user. Receiving a data measurement request input by the user based on the button control can be understood as receiving a touch operation (such as single-click or double-click) input by the user based on the button control.

[0044] The data measurement is a statistical value of the data after being aggregated, that is, the result of the data after being aggregated. The data measurement request can be understood as a request for measuring data stored in a database and / or a data center. The measurement expression can be an expression generated based on an aggregation function, a field to be measured, and a data table where the measurement field is located. The measurement expression can introduce the field to be measured in the data table through the aggregation function. Exemplarily, the aggregation function can include at least one of a SUM (sum) function, a COUNT (row statistics) function, a MIN (minimum value) function, a MAX (maximum value) function, and an AVG (average value) function. The measurement expression can include at least one data indicator expression and / or at least one measurement dimension expression.

[0045] In the embodiments of the present disclosure, a touch operation input by a user on a data query button control of a data query interface is received. After receiving the touch operation, an input control bound to the data query button control can be determined. Then, a metric expression input in the input control can be read, i.e., a metric expression corresponding to a data metric request is obtained.

[0046] In S120, a data storage engine associated with the metric expression is determined, and the metric expression is converted into subquery information corresponding to each data storage engine and post-processing information associated with the subquery information.

[0047] For example, the data storage engine can include at least one of a relational database management system (Mysql), a columnar database (Click Stream Data WareHouse, Clickhouse), and a relational database management system (such as SQL Server database and Oracle database, etc.). In the embodiments of the present disclosure, the data storage engine associated with the metric expression can understand the data storage engine that needs to be accessed for result operation of the metric expression. The subquery information can include function information, fields to be queried, and data tables where the fields to be queried are located, which are used for data query by the data storage engine. The post-processing information can be used for comprehensive processing of query results obtained by one or more subquery information. For example, the post-processing information can include comprehensive processing of the subquery results, and can also include sorting rules of each field after comprehensive processing. It can be understood that one field corresponds to one column of data in a data table.

[0048] Specifically, a data table associated with the metric expression is determined. Then, according to a corresponding relationship between the data storage engine and the data table, the data storage engine associated with the metric expression is determined. For example, the data table associated with the metric expression includes data table A1, data table A2, data table B2, and data table C3. The data storage engine corresponding to the data table A1 and the data table A2 is data storage engine A. The data storage engine corresponding to the data table B2 is data storage engine B. The data storage engine corresponding to the data table C3 is data storage engine C. Thus, the data storage engine associated with the metric expression is determined as the data storage engine A, the data storage engine B, and the data storage engine C.

[0049] After determining the data storage engine corresponding to the metric expression, in order to avoid the transformed subquery information being invalid query information, the metric expression can be transformed into the subquery information corresponding to each data storage engine and the post-processing information associated with the subquery information according to the syntax rules of each data storage engine. Compared with the prior art, in the disclosed embodiment, the metric expression is transformed into the subquery information corresponding to each data storage engine and the post-processing information associated with the subquery information, which breaks through the technical limitation of the prior art that cannot cross data storage engines, can perform data query from any data storage engine, reduces the cost of data query, and improves the efficiency of data query.

[0050] In the disclosed embodiment, after determining the data storage engine associated with the metric expression, a connection can be established with the data storage engine. Then the data storage engine can be used based on the connection. When the use of the data storage engine is completed, the connection with the data storage engine can be disconnected, which not only can avoid the security problem of data caused by long-time connection with the data storage engine, but also can establish a connection with the associated data storage engine for different metric expressions, thereby improving the flexibility of connection with the data storage engine and reducing the occupation of resources.

[0051] S130, obtaining the subquery result corresponding to the subquery information fed back by the data storage engine, generating a target query result according to the subquery result and the post-processing information, and displaying the target query result.

[0052] The subquery result is the query result fed back by the data storage engine based on the subquery information. The corresponding relationship between the data storage engine and the subquery information can be one-to-one or one-to-many. The target query result is the execution result of the metric expression, which can be the result generated by processing the subquery result corresponding to the subquery information based on the post-processing information.

[0053] Specifically, the subquery result corresponding to the subquery information fed back by the data storage engine is obtained. The subquery result can be aggregated according to the post-processing information. Then the aggregation result can be obtained, that is, the target query result can be generated. After generating the target query result, the target query result can be displayed.

[0054] Optionally, the displaying the target query result comprises displaying the target query result in a form created based on the post-processing information. Alternatively, the target query result is displayed in a preset display form in the data query interface. From the perspective of display state, the preset display form can comprise static display and / or dynamic display. From the perspective of display form, the preset display form can comprise at least one of sound, text, number and graphical display. The graphical display comprises but is not limited to at least one of line chart, column chart, pie chart and Gantt chart. From the perspective of display position, the target query result can be displayed in a part of the target query interface or in a pop-up window.

[0055] In the embodiments of the present disclosure, in order to present the target query result to the user more intuitively, before the target query result is displayed, the data adjustment processing is further included after the target query result is generated based on the sub-query result and the post-processing information. The data adjustment processing comprises at least one of data dimension supplement, data translation and conversion processing, data sorting processing and data aggregation processing.

[0056] The technical scheme of the embodiments of the present disclosure can acquire the measurement expression corresponding to the data measurement request input by the user based on the data query interface, and compared with the prior art, the data measurement requirement can be accurately acquired based on the data query interface in the manner of interaction with the user, and the setting of the individualized measurement requirement of the user is met. After the measurement expression is acquired, the data storage engine associated with the measurement expression is determined, the measurement expression is converted into the sub-query information corresponding to each data storage engine and the post-processing information associated with the sub-query information, the complex measurement logic can be simplified, and the foundation for the fast response of the subsequent data query is laid. Then, the sub-query result corresponding to the sub-query information fed back by the data storage engine is acquired, the target query result is generated based on the sub-query result and the post-processing information, and the target query result is displayed, which solves the problem of high data measurement complexity and low data query efficiency in the related data query technology. The data measurement across the data storage engines can be implemented, which not only can avoid the phenomenon of data measurement delay, but also can reduce the complexity of data measurement without relying on the operation of professional technicians. The efficiency of data query is further improved.

[0057] Figure 2A flowchart of a data query method provided by an embodiment of the present disclosure is shown. The embodiment is based on the above-mentioned embodiment and provides an optional solution of how to convert a metric expression into subquery information corresponding to each data storage engine and post-processing information associated with the subquery information. Optionally, the conversion of the metric expression into subquery information corresponding to each data storage engine and post-processing information associated with the subquery information includes: converting the metric expression into a metric abstract syntax tree; parsing the metric abstract syntax tree to obtain subquery abstract syntax trees corresponding to each data storage engine, and constructing a post-processing abstract syntax tree according to the subquery abstract syntax trees corresponding to the metric abstract syntax tree; determining subquery information according to the subquery abstract syntax trees, and determining post-processing information associated with the subquery information according to the post-processing abstract syntax tree. The same or corresponding technical features as in the foregoing embodiments are not described again.

[0058] As shown in Figure 2 , the method of the embodiment can include:

[0059] S210, receiving a data metric request input by a user based on a data query interface, and obtaining a metric expression corresponding to the data metric request.

[0060] S220, determining a data storage engine associated with the metric expression.

[0061] S230, converting the metric expression into a metric abstract syntax tree.

[0062] The metric abstract syntax tree can be a tree data structure composed of functions and function input parameters (data columns), or constants, as shown in Figure 3 , where the metric expression is F(C1, T1, G(T2, G2)). The function input parameter can be an input parameter related to the function operation. The constant can be used as a basic condition for the metric data. The metric abstract syntax tree can intuitively reflect the relationship between functions.

[0063] In the embodiment of the present disclosure, a top-down analysis method or a bottom-up analysis method can be used to perform lexical analysis and syntax analysis on the metric expression. Thus, an analysis result can be obtained. Further, an abstract syntax tree, that is, a metric abstract syntax tree, can be constructed based on the analysis result, so as to facilitate subsequent data processing and analysis. The lexical analysis refers to scanning the functions, constants and function input parameters in the metric expression one by one to obtain the information of each letter and generate a one-dimensional array composed of objects. The syntax analysis refers to integrating the associated objects into a tree structure expression form.

[0064] S240, parse the metric abstract syntax tree to obtain a subquery abstract syntax tree corresponding to each data storage engine, and construct a post-processing abstract syntax tree according to the subquery abstract syntax tree corresponding to the metric abstract syntax tree.

[0065] The subquery abstract syntax tree can be a subtree of the metric abstract syntax tree. The correspondence between the data storage engine and the subquery abstract syntax tree can be one-to-one or one-to-many. The post-processing abstract syntax tree can reflect the dependency relationship between the subquery abstract syntax trees in the metric abstract syntax tree. Each node in the post-processing abstract syntax tree is an identifier of each subquery abstract syntax tree.

[0066] In the embodiments of the present disclosure, parsing the metric abstract syntax tree to obtain a subquery abstract syntax tree corresponding to each data storage engine includes traversing each node in the metric abstract syntax tree. The data storage engine corresponding to each node can be determined. Thus, the subquery abstract syntax tree corresponding to each data storage engine can be constructed according to the nodes corresponding to each data storage engine and the relationship between the nodes. It should be noted that the way of traversing each node in the metric abstract syntax tree can be depth-first traversal or breadth-first traversal.

[0067] Optionally, constructing a post-processing abstract syntax tree according to the subquery abstract syntax tree corresponding to the metric abstract syntax tree includes determining a post-processing dependency relationship between the subquery abstract syntax trees corresponding to the metric expression according to the post-processing dependency relationship, and constructing a post-processing abstract syntax tree according to the post-processing dependency relationship. The post-processing dependency relationship can reflect the dependency relationship between the subquery abstract syntax trees.

[0068] S250, determining subquery information according to the subquery abstract syntax tree, and determining post-processing information associated with the subquery information according to the post-processing abstract syntax tree.

[0069] In the embodiments of the present disclosure, determining subquery information according to the subquery abstract syntax tree includes traversing each node in the subquery abstract syntax tree, obtaining node information corresponding to each node, and then determining the subquery information. The node information corresponding to each node can include any one of a function, a constant, and a function input parameter.

[0070] Determining post-processing information associated with the subquery information according to the post-processing abstract syntax tree includes traversing each node in the post-processing abstract syntax tree. Then the dependency relationship between each node, that is, the association relationship between each subquery information, can be determined. Thus, the post-processing information associated with each subquery information can be obtained according to the association relationship between each subquery information.

[0071] Optionally, the subquery information comprises a subquery statement for accessing the data storage engine; correspondingly, the determining the subquery information according to the subquery abstract syntax tree comprises: for each data storage engine, converting the subquery abstract syntax tree corresponding to the data storage engine into a subquery statement for accessing the data storage engine, so as to access the data storage engine based on the subquery statement to obtain the subquery result corresponding to the subquery information.

[0072] The subquery statement can be understood as a database query statement for accessing the data storage engine generated based on the metric expression, and can be used for data query in the data storage engine. The correspondence between the data storage engine and the subquery statement can be one-to-one or one-to-many.

[0073] Specifically, for each data storage engine, each node in the subquery abstract syntax tree corresponding to the data storage engine is traversed. Then the node information corresponding to each node and the dependency relationship between each node can be determined, that is, the functions, function input parameters and constants contained in the subquery abstract syntax tree, and the calling relationship between each function can be determined.

[0074] S260, obtaining the subquery result corresponding to the subquery information fed back by the data storage engine, generating the target query result according to the subquery result and the post-processing information, and displaying the target query result.

[0075] The technical scheme of the embodiment of the present disclosure avoids the influence of the syntax of the metric expression on data measurement by converting the metric expression into a metric abstract syntax tree. Then the metric abstract syntax tree can be parsed. Thus the subquery abstract syntax tree corresponding to each data storage engine can be obtained, and the post-processing abstract syntax tree is constructed according to the subquery abstract syntax tree corresponding to the metric abstract syntax tree. By constructing the corresponding subquery abstract syntax tree for each data storage engine and constructing the post-processing abstract syntax tree according to the subquery abstract syntax tree, the complexity of the metric abstract syntax tree is reduced, and the direct dependency relationship between the data storage engines is reduced. Thus the subquery information can be determined according to the subquery abstract syntax tree, and the post-processing information associated with the subquery information can be determined according to the post-processing abstract syntax tree, so that the subquery information and the post-processing information can be obtained more quickly and effectively.

[0076] Figure 4A flowchart of a data query method provided by an embodiment of the present disclosure is shown. The embodiment is based on the above-mentioned embodiment and provides an optional solution of how to obtain a subquery abstract syntax tree according to a metric abstract syntax tree. Optionally, the parsing of the metric abstract syntax tree to obtain a subquery abstract syntax tree corresponding to each data storage engine comprises: splitting the metric abstract syntax tree to obtain at least one subquery abstract syntax tree; and performing grouping and aggregation processing on the subquery abstract syntax trees obtained by splitting according to the data storage engine corresponding to the metric abstract syntax tree to obtain a subquery abstract syntax tree corresponding to each data storage engine.

[0077] As shown in Figure 4 , the method of the embodiment can comprise:

[0078] S310, receiving a data metric request input by a user based on a data query interface, and obtaining a metric expression corresponding to the data metric request.

[0079] S320, determining a data storage engine associated with the metric expression, and converting the metric expression into a metric abstract syntax tree.

[0080] S330, splitting the metric abstract syntax tree to obtain at least one subquery abstract syntax tree.

[0081] In the embodiment of the present disclosure, splitting the metric abstract syntax tree comprises: splitting the metric abstract syntax tree according to attribute information of a function at each function node in the metric abstract syntax tree and / or function input parameters.

[0082] The attribute information of the function can represent the function of the function. The function of the function can include an aggregation function, a type conversion function, a date and time function, or a conditional judgment function, etc. It should be noted that splitting the metric abstract syntax tree according to the attribute information of the function at each function node in the metric abstract syntax tree can ensure the integrity of the function. Splitting the metric abstract syntax tree according to the function input parameters at each function node in the metric abstract syntax tree can perform fine-grained splitting, especially for nested functions, which can effectively avoid the situation that the function execution operation cannot be allocated to the corresponding data storage engine, thereby ensuring the smooth progress of data metric.

[0083] Optionally, the splitting of the metric abstract syntax tree according to the attribute information of the function at each function node in the metric abstract syntax tree and / or the function input parameters comprises at least one of the following operations:

[0084] If the data storage engine corresponding to the function input parameter of the current function node in the metric expression is different from the data storage engine corresponding to the function input parameter of the parent function node of the current function node, the current function node can be split as the root node of the subquery abstract syntax tree to the metric abstract syntax tree, which can avoid the problem of low query performance caused by cross-data storage engine query.

[0085] If the function attribute corresponding to the current function node in the metric abstract syntax tree is an aggregation function, the current function node can be split as the root node of the subquery abstract syntax tree to the metric abstract syntax tree, which can improve the efficiency of data query.

[0086] If the function input parameter corresponding to the current function node in the metric expression is missing in at least part of the data storage engines, the current function node can be split as the root node of the subquery abstract syntax tree to the metric abstract syntax tree, and the leaf function nodes under the function node are recursively split. It can be understood that the function input parameter corresponding to the current function node in the metric expression is missing in one or more data storage engines.

[0087] In the embodiments of the present disclosure, the advantage of splitting the metric expression according to the data storage engine is that the problem of query failure caused by cross-data storage engine query can be avoided. The advantage of splitting the metric expression according to the function attribute is that the success rate of data query can be guaranteed.

[0088] S340, grouping and aggregating the subquery abstract syntax trees obtained by splitting according to the data storage engines corresponding to the metric abstract syntax tree, to obtain a subquery abstract syntax tree corresponding to each data storage engine.

[0089] Specifically, after obtaining multiple subquery abstract syntax trees by splitting, the data table where each function input parameter is located can be determined according to the function input parameter in each subquery abstract syntax tree. Then, the data storage engine corresponding to each subquery abstract syntax tree can be determined according to the correspondence between the data table and the data storage engine. In other words, the subquery abstract syntax tree corresponding to each data storage engine can be determined according to the correspondence between the data table and the data storage engine. Then, the subquery abstract syntax tree corresponding to each data storage engine can be aggregated. Thus, the subquery abstract syntax tree corresponding to each data storage engine can be obtained.

[0090] In the embodiments of the present disclosure, optionally, grouping and aggregating the subquery abstract syntax trees obtained by splitting according to the data storage engines corresponding to the metric abstract syntax tree, to obtain a subquery abstract syntax tree corresponding to each data storage engine, includes:

[0091] generate a function execution dependency relationship according to the function call relationship between the functions in the split subquery abstract syntax tree; and perform grouping and aggregation processing on the split subquery abstract syntax tree according to the function execution dependency relationship and the association relationship between the subquery abstract syntax tree and the data storage engine, to obtain a subquery abstract syntax tree corresponding to each data storage engine.

[0092] The function execution dependency relationship can be generated based on the function call relationship between the functions, and can more comprehensively reflect the dependency relationship between the functions. The function execution dependency relationship can be constructed to quickly perform grouping and aggregation processing on the abstract syntax tree, and accurately construct a subquery abstract syntax tree corresponding to each data storage engine.

[0093] Specifically, the execution order of the functions can be determined according to the function call relationship between the functions in the split subquery abstract syntax tree. Then, the function execution dependency relationship can be generated according to the execution order of the functions. Thus, the split subquery abstract syntax tree can be grouped and aggregated according to the function execution dependency relationship and the association relationship between the subquery abstract syntax tree and the data storage engine, that is, the split subquery abstract syntax tree corresponding to each data storage engine is taken as a separate group, and the split subquery abstract syntax tree in each group is aggregated. Thus, a subquery abstract syntax tree corresponding to each data storage engine can be obtained.

[0094] S350, constructing a post-processing abstract syntax tree according to the subquery abstract syntax tree corresponding to the metric abstract syntax tree.

[0095] S360, determining subquery information according to the subquery abstract syntax tree, and determining post-processing information associated with the subquery information according to the post-processing abstract syntax tree.

[0096] S370, obtaining a subquery result corresponding to the subquery information fed back by the data storage engine, generating a target query result according to the subquery result and the post-processing information, and displaying the target query result.

[0097] The technical scheme of the embodiment of the present disclosure splits the metric abstract syntax tree to obtain at least one subquery abstract syntax tree. Then, the split subquery abstract syntax tree is grouped and aggregated according to the data storage engine corresponding to the metric abstract syntax tree, so that a subquery abstract syntax tree corresponding to each data storage engine can be quickly and effectively obtained, thereby improving the data query efficiency of each data storage engine.

[0098] Figure 5A flowchart of a data query method provided by an embodiment of the present disclosure is shown. The embodiment is based on the above-mentioned embodiment. Optionally, the post-processing information includes a target table creation statement for creating a metric query table and a target metric statement associated with the subquery information, and the metric query table is used to store the subquery result of the data storage engine. The post-processing abstract syntax tree is used to determine the post-processing information associated with the subquery information, including: converting the post-processing abstract syntax tree into a target table creation statement for creating a metric query table and a target metric statement associated with the subquery information, respectively. The target query result is generated according to the subquery result and the post-processing information, including: creating a metric query table by executing the target table creation statement, and storing the subquery result in the metric query table; and processing the subquery result in the metric query table by executing the target metric statement to obtain the target query result.

[0099] As shown in Figure 5 , the method of the embodiment can include:

[0100] S410, receiving a data metric request input by a user based on a data query interface, and obtaining a metric expression corresponding to the data metric request.

[0101] S420, determining a data storage engine associated with the metric expression, and converting the metric expression into a metric abstract syntax tree.

[0102] S430, parsing the metric abstract syntax tree to obtain a subquery abstract syntax tree corresponding to each data storage engine, and constructing a post-processing abstract syntax tree according to the subquery abstract syntax tree corresponding to the metric abstract syntax tree.

[0103] S440, determining subquery information according to the subquery abstract syntax tree, and converting the post-processing abstract syntax tree into a target table creation statement for creating a metric query table and a target metric statement associated with the subquery information, respectively.

[0104] The target table creation statement can be used to create the table structure of the metric query table. The metric query table is used to store the subquery result of the data storage engine. The target table creation statement can include a keyword for creating a data table. The target metric statement can be used to perform data metric on the subquery result of the data storage engine.

[0105] Specifically, each node in the post-processing abstract syntax tree is traversed. According to the node information of each node, the data columns to be displayed after data measurement is determined, and the arrangement order of the data columns to be displayed is determined. Then, according to the data columns to be displayed and the arrangement order of the data columns to be displayed, and based on the keywords for creating the data table, a target table creation statement for constructing the measurement query table is generated.

[0106] After traversing each node in the post-processing abstract syntax tree, the function for calculating data can be determined according to the node information of each node, that is, the function for data measurement is determined. The function input parameters in the function for data measurement are further determined. Thus, based on the function for data measurement and the function input parameters of each function, a target measurement statement associated with the subquery information is generated.

[0107] Optionally, the post-processing abstract syntax tree is converted into a target table creation statement for constructing the measurement query table, including:

[0108] According to the target measurement factors in the post-processing abstract syntax tree and the subquery results corresponding to the subquery information, a target table creation statement for constructing the measurement query table is generated.

[0109] The target measurement factors can be understood as conditions for measuring data. The target measurement factors can include data indicators and / or measurement dimensions. The data indicators are results obtained after statistical processing of quantitative data. The data dimensions are different angles of the indicators. For example, the data indicator is sales volume, and the data dimension can be by product type, or can be by sales subject, or can be by time period. The data indicators and / or measurement dimensions can be set according to the specific requirements of data measurement.

[0110] Optionally, the post-processing abstract syntax tree is converted into a target measurement statement associated with the subquery information, including: generating a measurement query statement for accessing the measurement query table according to the association relationship between the data indicators, the measurement dimensions, and the subquery results corresponding to the subquery information. The measurement query statement includes at least one of a table association statement, an aggregation statement, and a filtering statement; and generating a data processing statement associated with the subquery result according to the measurement query table and the post-processing abstract syntax tree.

[0111] The data measurement query statement can be used to read the data stored in the measurement query table. The data processing statement can be used to perform data processing on the data obtained by querying. The data processing includes data type conversion processing (such as converting string type data to integer type data) and / or data padding processing. The data padding processing can be understood as measurement dimension padding.

[0112] S450, obtaining the subquery result corresponding to the subquery information fed back by the data storage engine, constructing a metric query table by executing the target table creation statement, and storing the subquery result into the metric query table.

[0113] In the embodiments of the present disclosure, the metric query table is constructed by executing the target table creation statement, which includes creating the metric query table based on the table creation keyword in the target table creation statement, and constructing the structure of the metric query table based on the table definition option in the target table creation statement. The table definition option can include the column name of the table, the definition of the column, and the possible null value description, integrity constraint or table index. After the metric query table is constructed, the subquery result corresponding to the subquery information fed back by the data storage engine can be stored into the metric query table. The storage of the subquery result into the metric storage table includes storing the subquery result according to the column name of the metric query table and storing it into the metric query table.

[0114] S460, processing the subquery result in the metric query table by executing the target metric statement to obtain the target query result, and displaying the target query result.

[0115] In the embodiments of the present disclosure, the target query result is obtained by processing the subquery result in the metric query table by executing the target metric statement, which includes accessing the metric query table by executing the metric query statement to obtain the target access result, and obtaining the target query result corresponding to the data metric request by executing the data processing statement. The target access result can be understood as the result obtained after the data in the metric query table is measured.

[0116] Specifically, the data in the metric query table can be obtained by executing the metric query statement, and then the obtained data can be measured by the function in the metric query statement. Thus, the measurement result can be obtained, that is, the target access result can be obtained. Further, the target access result can be processed in data type and / or data padding by executing the data processing statement. Then, the target query result corresponding to the data measurement request can be obtained. And the target query result is displayed. It should be noted that in the embodiments of the present disclosure, the data storage engine executing the target metric statement is used to measure the data in the metric query table based on the target metric statement. The data storage engine executing the target metric statement can be a lightweight database (SQLite), and can also be a file-based data storage engine, or an in-memory data storage engine (In-Memory Databases), so as to ensure the automatic release or saving of the intermediate result data after the measurement request is completed. It should be further noted that in the embodiments of the present disclosure, the lightweight database executing the target metric statement can also be configured with data measurement parameters, so as to dynamically support various customized data measurement requirements.

[0117] The technical scheme of the embodiments of the present disclosure converts the post-processing abstract syntax tree into the target table building statement for building the metric query table and the target metric statement associated with the subquery information, respectively. Then, the target query result can be quickly and accurately obtained by executing the target table building statement to build the metric query table and storing the subquery result into the metric query table, and executing the target metric statement to process the subquery result in the metric query table. Compared with the prior art, the data in one or more data storage engines can be automatically measured.

[0118] As an optional example of the embodiments of the present disclosure, the data query method provided by the embodiments of the present disclosure can be applied to a system architecture with multiple data storage engines, such as Figure 6As shown, a common metric service architecture diagram: including data storage engines for storing business data and data storage engines for responding to data metric requests (such as data warehouse 1 and data warehouse 2). In response to a user's business request, business services are provided to the user by reading and writing data to the data storage engine for storing business data; in response to a data metric request, data metric services can be provided by querying data warehouse 1, data warehouse 2, and the data storage engine for storing business data. Alternatively, business data can be stored to the data storage engine for responding to data metric requests through the results of the data ETL service. Wherein, data ETL service, is the abbreviation of English Extract-Transform-Load, used to describe the process of extracting (extract), transforming (transform), and loading (load) data from the source end to the destination end. The data metric method provided by the embodiments of the present disclosure can directly read data based on the existing business data storage or service, or can perform secondary metric calculation on the data result set after storing the results of the data ETL service.

[0119] As shown in the Figure 7 The embodiments of the present disclosure provide a system for performing data query method for data metric. The data metric system includes an Abstract Syntax Tree (AST) builder, an AST semantic analysis optimizer, a data storage engine bound subquery statement generator, a SQLite table structure statement generator, a SQLite query statement generator, a data queryer, a SQLite execution engine, and a metric result post-processor. The specific way of data metric is as follows:

[0120] 1. AST builder

[0121] The AST builder is responsible for checking and parsing the metric expression input by the user side or the upper layer service, for example, at least one data indicator expression and at least one metric dimension expression, and respectively converting each expression into a legal AST syntax tree.

[0122] For example, consider that there are tables T1 and T2 in databases DB1 and DB2 respectively, and the two groups of metric indicators M1 and M2 and the two groups of metric dimensions D1 and D2 can be described using the following function expressions, for example:

[0123] Data indicator expression: And,

[0124] Metric dimension expression:

[0125] Wherein, d1, d2, d3, t 11 And t12 represents the fields of the data table T1, d1 and t 21 represents the fields of the data table T2, the data storage engine corresponding to the data table T1 is DB1, and the data storage engine corresponding to the data table T2 is DB2.

[0126] 2. AST semantic analysis optimizer

[0127] The AST semantic analysis optimizer receives the abstract syntax trees output by the AST builder, including a dimension AST array containing at least one dimension AST syntax tree and a metric AST array containing at least one data metric AST syntax tree. Then, according to the coupling relationship of the underlying data structure in the metric expression, the calculation compatibility of the data storage engine, and the system operation optimization strategy and other factors, each abstract syntax tree is disassembled into one or more sub-syntax trees as needed, and the disassembled sub-syntax trees are grouped and aggregated according to certain rules to improve the query efficiency of each sub-query.

[0128] Specifically, the AST semantic analysis optimizer can include an AST sub-tree splitter, an AST dependency association parser, and a sub-tree clustering optimizer. The specific workflow is as shown in Figure 8

[0129] First, the AST sub-tree splitter disassembles the AST of the metric dimension expression and the metric expression according to the data table structure. The general expression disassembly rules include:

[0130] If the function attribute in the expression is an aggregation function (such as AVG, SUM, or MAX, etc.), the function node is disassembled as the root of the AST sub-tree;

[0131] If the data column in the function input parameter in the data metric expression comes from the data table in different data storage engines, the function node is disassembled as the root of the AST sub-tree; (such as M1 in the above example) If the function input parameter in the metric dimension expression is missing in the data table of part of the data storage engine, the function node is disassembled as the root node of the AST sub-tree, and all functions under the function child node are recursively disassembled (such as D1 in the above example). If f1(x, y), f2(x), f3(x), g1(x, y), and g2(x) are functions that can be directly translated into data storage engines and directly operated in data queries. The disassembled sub-query syntax tree can be:

[0132]

[0133] ​Secondly, the dependency resolver is responsible for dependency sorting the split AST sub-trees corresponding to each expression according to the function call relationship, generating the dependency relationship between each sub-query syntax tree, so as to determine the execution order and relationship of each sub-query syntax tree:

[0134]

[0135] Finally, the sub-query syntax tree clustering optimizer will aggregate the AST sub-tree groups into sub-query AST arrays according to the AST sub-tree groups and the storage structure of the data table. Considering the data structure of table T1 and table T2, the sub-query AST tree group and the dependency relationship output by the sub-query syntax tree clustering optimizer are:

[0136]

[0137] 3、Sub-query statement generator

[0138] The sub-query statement generator is responsible for translating the AST query tree group into a data engine-bound data query statement. In this embodiment, if the data storage engine of data table T1 is Hive and the data storage engine of data table T2 is Clickhouse, the sub-query AST array T1 will generate a corresponding HSQL query statement through the HSQL sub-query statement generator, and the sub-query AST array T2 will generate a corresponding Clickhouse query statement through the Clickhouse SQL sub-query statement generator.

[0139] 4、Data queryer

[0140] Similar to the sub-query statement generator, the data queryer is a data query adapter bound to the data engine, responsible for executing the sub-query statement on a specific data engine and reading the sub-query result. In this example, the HSQL sub-query statement and the Clickhouse SQL sub-query statement will execute the query of the data subset through the corresponding data queryer respectively, and read the result into the metric service memory.

[0141] 5、SQLite table structure statement generator

[0142] As a data aggregation engine, the SQLite database engine needs to dynamically define and generate a database table structure according to each sub-query statement to store the sub-query result. The SQLite table structure statement generator generates a corresponding result set SQLite table creation statement for each sub-query AST tree group. Since the structure of each data subset to be queried can be inferred according to the sub-query statement or the sub-query AST tree group, the SQLite table structure statement can be generated according to the output result of the AST semantic analysis optimizer.

[0143] 6、SQLite query statement generator

[0144] The SQLite query statement generator converts the post AST query tree group that depends on the subquery data result set into a SQLite table association and query statement, and after all the subquery data sets are returned and loaded into the SQLite database engine, the result data set of the data measurement request is directly calculated and obtained by the SQLite database engine. The SQLite query statement generator generates corresponding data table association statements, aggregation statements and filtering statements according to the measurement dimensions, data indicators in each subquery data result set and the relationship between the subquery result sets, so as to obtain the measurement result data set. The SQLite query statement generator first scans the common dimensions in each result set as the association key of the sub data set, and fills in all the target measurement dimensions through the table association operation, and generates the target measurement statement according to the measurement query table and the post AST tree group.

[0145] In this embodiment, since the d2 and d3 columns are not included in the subquery AST array $$G_{T_2}$$, it is necessary to fill in the dimensions and aggregate through the association operation of the subquery data table in the SQLite query statement, and the required G2 will be calculated. The post query AST array $$G_{temp}$$ can be converted into a sql statement.

[0146] 7、SQLite execution engine

[0147] The SQLite execution engine is an actual execution module for post processing of data result sets, and calculates the measurement result data set by executing the SQLite table association statement and the query statement. In the measurement service, the SQLite database engine also supports user calling of a custom function in the application service to operate the data set, thereby dynamically supporting various customized measurement requirements. In the actual measurement service, the SQLite engine can select a file-based data storage engine as needed, or select an in-memory data storage engine (In-Memory Databases), thereby ensuring automatic release or saving of the intermediate result data after the measurement request is completed.

[0148] 8、Data post processor

[0149] After obtaining the measurement result data set through the SQLite engine, the measurement service can perform custom data post processing operations on the data result set in the data post processor, including data dimension filling, data translation and conversion, data sorting and data post aggregation operations.

[0150] The data measurement method of the embodiments of the present disclosure can realize cross-database storage engine data measurement, has high execution efficiency and fast response speed, has low error rate compared with manual processing mode, saves time and effort, and greatly improves user experience.

[0151] Figure 9 This is a schematic diagram of the structure of a data query device provided in an embodiment of the present disclosure, as shown below. Figure 9 As shown, the device includes: a request receiving module 510, a request conversion module 520, and a result output module 530. Wherein,

[0152] The request receiving module 510 is used to receive a data measurement request input by a user based on the data query interface and obtain a measurement expression corresponding to the data measurement request.

[0153] The request conversion module 520 is used to determine the data storage engine associated with the metric expression, and convert the metric expression into subquery information corresponding to each data storage engine and post-processing information associated with the subquery information;

[0154] The result output module 530 is used to obtain the subquery result corresponding to the subquery information fed back by the data storage engine, generate the target query result based on the subquery result and the post-processing information, and display the target query result.

[0155] The technical solution of this disclosure embodiment, through a request receiving module, receives data measurement requests input by users based on a data query interface. It can obtain the measurement expression corresponding to the data measurement request. Compared to existing technologies, this allows for accurate acquisition of data measurement needs through user interaction via the data query interface, satisfying personalized measurement requirements. After obtaining the measurement expression, a request conversion module determines the data storage engine associated with the expression, converting it into subquery information and associated post-processing information for each data storage engine. This simplifies complex measurement logic and lays the foundation for rapid response in subsequent data queries. Furthermore, a result output module obtains the subquery results corresponding to the subquery information from the data storage engine, generates the target query result based on the subquery results and post-processing information, and displays the target query result. This solves the problems of high data measurement complexity and low data query efficiency in related data query technologies. It enables cross-data storage engine data measurement, avoiding data measurement delays and reducing complexity without relying on specialized technical personnel, further improving data query efficiency.

[0156] Based on the above-mentioned optional technical solutions, optionally, the request conversion module 520 includes: a measurement expression conversion unit, a measurement abstract syntax tree parsing unit, and a syntax tree information determination unit; wherein,

[0157] a metric expression transformation unit, configured to transform the metric expression into a metric abstract syntax tree;

[0158] a metric abstract syntax tree parsing unit, configured to parse the metric abstract syntax tree to obtain a subquery abstract syntax tree corresponding to each data storage engine, and to construct a post-processing abstract syntax tree according to the subquery abstract syntax tree corresponding to the metric abstract syntax tree;

[0159] a syntax tree information determination unit, configured to determine subquery information according to the subquery abstract syntax tree, and to determine post-processing information associated with the subquery information according to the post-processing abstract syntax tree.

[0160] In the above optional technical solutions, the subquery information includes a subquery statement for accessing the data storage engine; and the syntax tree information determination unit is configured to:

[0161] for each data storage engine, transform the subquery abstract syntax tree corresponding to the data storage engine into a subquery statement for accessing the data storage engine, so as to access the data storage engine based on the subquery statement to obtain a subquery result corresponding to the subquery information.

[0162] In the above optional technical solutions, the metric abstract syntax tree parsing unit is configured to: split the metric abstract syntax tree to obtain at least one subquery abstract syntax tree; and perform grouping and aggregation processing on the subquery abstract syntax trees obtained by splitting according to the data storage engines corresponding to the metric abstract syntax tree, to obtain a subquery abstract syntax tree corresponding to each data storage engine.

[0163] In the above optional technical solutions, the metric abstract syntax tree parsing unit is configured to split the metric abstract syntax tree according to attribute information of a function at each function node in the metric abstract syntax tree or and / or a function input parameter.

[0164] In the above optional technical solutions, the metric abstract syntax tree parsing unit is configured to perform at least one of the following operations:

[0165] if the data storage engine corresponding to the function input parameter of the current function node in the metric expression is different from the data storage engine corresponding to the function input parameter of the parent function node, split the metric abstract syntax tree with the current function node as a root node of a subquery abstract syntax tree;

[0166] if the function attribute corresponding to the current function node in the metric abstract syntax tree is an aggregation function, split the metric abstract syntax tree with the current function node as a root node of a subquery abstract syntax tree.

[0167] If the function input parameter corresponding to the current function node in the metric expression is missing in at least part of the data storage engine, the current function node is split as a root node of the subquery abstract syntax tree from the metric abstract syntax tree, and the leaf function nodes under the function node are recursively split.

[0168] On the basis of each of the optional technical solutions described above, the metric abstract syntax tree parsing unit is configured to: generate a function execution dependency relationship according to the function call relationship between each function in the split subquery abstract syntax tree; and perform grouping and aggregation processing on the split subquery abstract syntax tree according to the function execution dependency relationship and the association relationship between the subquery abstract syntax tree and the data storage engine, to obtain a subquery abstract syntax tree corresponding to each data storage engine.

[0169] On the basis of each of the optional technical solutions described above, the metric abstract syntax tree parsing unit is configured to: determine a post-processing dependency relationship between the subquery abstract syntax trees corresponding to the metric abstract syntax tree according to the metric expression, and construct a post-processing abstract syntax tree according to the post-processing dependency relationship.

[0170] On the basis of each of the optional technical solutions described above, the post-processing information includes a target table creation statement for constructing a metric query table and a target metric statement associated with the subquery information, and the metric query table is configured to store the subquery result of the data storage engine.

[0171] The syntax tree information determination unit is configured to convert the post-processing abstract syntax tree into a target table creation statement for constructing a metric query table and a target metric statement associated with the subquery information, respectively.

[0172] The result output module 530 is configured to construct a metric query table by executing the target table creation statement, and store the subquery result into the metric query table; and process the subquery result in the metric query table by executing the target metric statement, to obtain a target query result.

[0173] On the basis of each of the optional technical solutions described above, the syntax tree information determination unit is specifically configured to: generate a target table creation statement for constructing a metric query table according to a target metric factor in the post-processing abstract syntax tree and a subquery result corresponding to the subquery information, wherein the target metric factor includes a data index and / or a metric dimension.

[0174] On the basis of each of the optional technical solutions above, optionally, the target metric statement comprises a metric query statement and a data processing statement; a syntax tree information determination unit is configured to generate a metric query statement for accessing the metric query table according to an association relationship between the data index, the metric dimension, and a subquery result corresponding to the subquery information, wherein the metric query statement comprises at least one of a table association statement, an aggregation statement, and a filtering statement; and

[0175] generate a data processing statement associated with the subquery result according to the metric query table and the post-processing abstract syntax tree;

[0176] A result output module 530 is specifically configured to access the metric query table by executing the metric query statement to obtain a target access result, and obtain a target query result corresponding to the data metric request by executing the data processing statement.

[0177] On the basis of each of the optional technical solutions above, optionally, after the target query result is generated according to the subquery result and the post-processing information and before the target query result is displayed, the apparatus further comprises a data adjustment processing module configured to:

[0178] perform data adjustment processing on the target query data, wherein the data adjustment processing comprises at least one of data dimension padding, data translation and conversion processing, data sorting processing, and data aggregation processing.

[0179] The data query apparatus provided in the embodiments of the present disclosure can execute the data query method provided in any of the embodiments of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0180] It should be noted that each unit and module included in the apparatus above is only divided according to functional logic, but is not limited to the division described above, as long as the corresponding functions can be implemented; in addition, the specific names of each functional unit are only for convenient mutual distinction, and are not used to limit the protection scope of the embodiments of the present disclosure.

[0181] Figure 10 A structural schematic diagram of an electronic device provided in an embodiment of the present disclosure is shown in FIG. 1. Hereinafter, the structural schematic diagram of the electronic device will be described with reference to FIG. 1. Figure 10 FIG. 1 shows an electronic device (for example, a mobile phone) suitable for implementing the embodiments of the present disclosure. Figure 10The diagram below shows the structure of the terminal device or server 500. The terminal device in this embodiment may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and vehicle terminals (e.g., vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 10 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0182] like Figure 10 As shown, electronic device 500 may include a processing unit (e.g., central processing unit, graphics processor, etc.) 501, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 502 or a program loaded from storage device 508 into random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of electronic device 500. The processing unit 501, ROM 502, and RAM 503 are interconnected via bus 504. An edit / output (I / O) interface 505 is also connected to bus 504.

[0183] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 508 including, for example, magnetic tapes, hard disks, etc.; and communication devices 509. Communication device 509 allows electronic device 500 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 10 An electronic device 500 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0184] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, it performs the functions defined in the methods of embodiments of this disclosure.

[0185] Names of messages or information exchanged between multiple devices in the embodiments of the present disclosure are only for illustrative purposes, and are not used to limit the scope of the messages or information.

[0186] The electronic device provided by the embodiments of the present disclosure and the data query method provided by the above embodiments belong to the same inventive concept, and the technical details not described in detail in the present embodiment can be referred to the above embodiments, and the present embodiment has the same beneficial effects as the above embodiments.

[0187] The embodiments of the present disclosure provide a computer storage medium, which stores a computer program, and the program is executed by a processor to implement the data query method provided by the above embodiments.

[0188] It should be noted that the computer readable medium of the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. The computer readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination of the above. More specific examples of computer readable storage media can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, the computer readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or apparatus. In the present disclosure, the computer readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer readable program code. Such a propagated data signal can take many forms, including but not limited to an electromagnetic signal, an optical signal or any suitable combination of the above. The computer readable signal medium can also be any computer readable medium other than the computer readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or apparatus. The program code contained in the computer readable medium can be transmitted by any suitable medium, including but not limited to a wire, a cable, an RF (radio frequency) or the like, or any suitable combination of the above.

[0189] In some embodiments, the client, server, or both can communicate using any current known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), the Internet, and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any current known or future developed networks.

[0190] The computer readable medium described above can be included in the electronic device described above; or can exist separately from the electronic device and be not assembled into the electronic device.

[0191] The computer readable medium described above carries one or more programs, when the one or more programs are executed by the electronic device, the electronic device is caused to:

[0192] The computer readable medium described above carries one or more programs, when the one or more programs are executed by the electronic device, the electronic device is caused to: receive a data metric request input by a user based on a data query interface, obtain a metric expression corresponding to the data metric request;

[0193] determine a data storage engine associated with the metric expression, convert the metric expression into subquery information corresponding to each data storage engine and post-processing information associated with the subquery information;

[0194] obtain subquery results corresponding to the subquery information fed back by the data storage engine, generate a target query result according to the subquery results and the post-processing information, and display the target query result.

[0195] Or, the computer readable medium described above carries one or more programs, when the one or more programs are executed by the electronic device, the electronic device is caused to: receive a data metric request input by a user based on a data query interface, obtain a metric expression corresponding to the data metric request;

[0196] determine a data storage engine associated with the metric expression, convert the metric expression into subquery information corresponding to each data storage engine and post-processing information associated with the subquery information;

[0197] obtain subquery results corresponding to the subquery information fed back by the data storage engine, generate a target query result according to the subquery results and the post-processing information, and display the target query result.

[0198] Computer program code for carrying out operations of the present disclosure can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).

[0199] The computer program instructions can also be loaded onto a computer or other programmable information processing apparatus to cause a series of operations to be performed on the computer or other programmable information processing apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable information processing apparatus implement the functions / acts specified in the flowchart and / or block diagram block or blocks.

[0200] The units described in the embodiments of the present disclosure can be implemented by hardware, software, or a combination thereof. In some cases, the names of the units do not constitute a limitation on the units themselves. For example, the first obtaining unit can also be described as a unit that obtains at least two Internet protocol addresses.

[0201] The functions described in this specification can be performed by one or more hardware logic components. For example, non-limiting examples of hardware logic components that can be used include: Field-programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application-Specific Standard Products (ASSPs), System-on-a-Chip (SOCs), Complex Programmable Logic Devices (CPLDs), etc.

[0202] In the context of the present disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0203] According to one or more embodiments of the present disclosure, Example One provides a data query method, comprising:

[0204] receiving a data metric request input by a user based on a data query interface, obtaining a metric expression corresponding to the data metric request;

[0205] determining a data storage engine associated with the metric expression, converting the metric expression into subquery information corresponding to each data storage engine and post-processing information associated with the subquery information;

[0206] obtaining subquery results corresponding to the subquery information fed back by the data storage engine, generating a target query result according to the subquery results and the post-processing information, and displaying the target query result.

[0207] According to one or more embodiments of the present disclosure, Example Two provides a data query method, comprising:

[0208] Optionally, the converting the metric expression into subquery information corresponding to each data storage engine and post-processing information associated with the subquery information comprises:

[0209] converting the metric expression into a metric abstract syntax tree;

[0210] parsing the metric abstract syntax tree to obtain subquery abstract syntax trees corresponding to each data storage engine, and constructing a post-processing abstract syntax tree according to the subquery abstract syntax trees corresponding to the metric abstract syntax tree;

[0211] determining subquery information according to the subquery abstract syntax trees, and determining post-processing information associated with the subquery information according to the post-processing abstract syntax tree.

[0212] According to one or more embodiments of the present disclosure, Example Three provides a data query method, comprising:

[0213] Optionally, the subquery information comprises a subquery statement for accessing the data storage engine; and the determining the subquery information according to the subquery abstract syntax tree comprises:

[0214] For each data storage engine, converting the subquery abstract syntax tree corresponding to the data storage engine into a subquery statement for accessing the data storage engine, so as to access the data storage engine based on the subquery statement to obtain a subquery result corresponding to the subquery information.

[0215] According to one or more embodiments of the present disclosure, Example Four provides a data query method, comprising:

[0216] Optionally, the parsing the metric abstract syntax tree to obtain a subquery abstract syntax tree corresponding to each data storage engine comprises:

[0217] Splitting the metric abstract syntax tree to obtain at least one subquery abstract syntax tree;

[0218] Grouping and aggregating the subquery abstract syntax trees obtained by splitting according to the data storage engine corresponding to the metric abstract syntax tree, to obtain a subquery abstract syntax tree corresponding to each data storage engine.

[0219] According to one or more embodiments of the present disclosure, Example Five provides a data query method, comprising:

[0220] Optionally, the splitting the metric abstract syntax tree comprises:

[0221] Splitting the metric abstract syntax tree according to attribute information of a function at each function node in the metric abstract syntax tree and / or a function input parameter.

[0222] According to one or more embodiments of the present disclosure, Example Six provides a data query method, comprising:

[0223] Optionally, the splitting the metric abstract syntax tree according to the attribute information of the function at each function node in the metric abstract syntax tree and / or the function input parameter comprises at least one of the following operations:

[0224] If the data storage engine corresponding to the function input parameter of the current function node in the metric expression is different from the data storage engine corresponding to the function input parameter of the parent function node of the current function node, splitting the metric abstract syntax tree with the current function node as a root node of a subquery abstract syntax tree.

[0225] If the function attribute corresponding to the current function node in the metric abstract syntax tree is an aggregate function, the current function node is taken as a root node of a subquery abstract syntax tree to split the metric abstract syntax tree;

[0226] If the function input parameter corresponding to the current function node in the metric expression is missing in at least part of the data storage engine, the current function node is taken as a root node of a subquery abstract syntax tree to split the metric abstract syntax tree, and leaf function nodes under the function node are recursively split.

[0227] According to one or more embodiments of the present disclosure, Example Seven provides a data query method, comprising:

[0228] Optionally, the subquery abstract syntax trees obtained by splitting are grouped and aggregated according to the data storage engines corresponding to the metric abstract syntax tree, to obtain a subquery abstract syntax tree corresponding to each data storage engine, comprising:

[0229] A function execution dependency relationship is generated according to the function call relationship between the functions in the subquery abstract syntax trees obtained by splitting;

[0230] The subquery abstract syntax trees obtained by splitting are grouped and aggregated according to the function execution dependency relationship and the association relationship between the subquery abstract syntax trees and the data storage engines, to obtain a subquery abstract syntax tree corresponding to each data storage engine.

[0231] According to one or more embodiments of the present disclosure, Example Eight provides a data query method, comprising:

[0232] Optionally, the post-processing abstract syntax tree is constructed according to the subquery abstract syntax trees corresponding to the metric abstract syntax tree, comprising:

[0233] A post-processing dependency relationship between the subquery abstract syntax trees corresponding to the metric abstract syntax tree is determined according to the metric expression, and a post-processing abstract syntax tree is constructed according to the post-processing dependency relationship.

[0234] According to one or more embodiments of the present disclosure, Example Nine provides a data query method, comprising:

[0235] Optionally, the post-processing information comprises a target table creation statement used for constructing a metric query table and a target metric statement associated with the subquery information, and the metric query table is used for storing a subquery result of the data storage engine;

[0236] The determining of the post-processing information associated with the subquery information according to the post-processing abstract syntax tree comprises:

[0237] The post-processing abstract syntax tree is respectively converted into a target table building statement for building a metric query table and a target metric statement associated with the subquery information;

[0238] The generating of the target query result according to the subquery result and the post-processing information comprises:

[0239] The subquery result is stored into the metric query table by executing the target table building statement;

[0240] The subquery result in the metric query table is processed by executing the target metric statement to obtain the target query result.

[0241] According to one or more embodiments of the present disclosure, Example Ten provides a data query method, comprising:

[0242] Optionally, the converting of the post-processing abstract syntax tree into the target table building statement for building the metric query table comprises:

[0243] The target table building statement for building the metric query table is generated according to a target metric factor in the post-processing abstract syntax tree and a subquery result corresponding to the subquery information, wherein the target metric factor comprises a data index and / or a metric dimension.

[0244] According to one or more embodiments of the present disclosure, Example Eleven provides a data query method, comprising:

[0245] Optionally, the target metric statement comprises a metric query statement and a data processing statement.

[0246] The converting of the post-processing abstract syntax tree into the target metric statement associated with the subquery information comprises:

[0247] The metric query statement for accessing the metric query table is generated according to an association relationship among the data index, the metric dimension and a subquery result corresponding to the subquery information, wherein the metric query statement comprises at least one of a table association statement, an aggregation statement and a filtering statement; and

[0248] The data processing statement associated with the subquery result is generated according to the metric query table and the post-processing abstract syntax tree.

[0249] The processing of the subquery result in the metric query table by executing the target metric statement to obtain the target query result comprises:

[0250] Access the metric query table by executing the metric query statement to obtain a target access result, and obtain a target query result corresponding to the data metric request by executing the data processing statement.

[0251] According to one or more embodiments of the present disclosure, Example Twelve provides a data query method, comprising:

[0252] Optionally, after the target query result is generated according to the subquery result and the post-processing information, before the target query result is displayed, the method further comprises:

[0253] Performing data adjustment processing on the target query data, wherein the data adjustment processing comprises at least one of data dimension padding, data translation and conversion processing, data sorting processing, and data aggregation processing.

[0254] According to one or more embodiments of the present disclosure, Example Thirteen provides an example data query device / system, comprising:

[0255] A request receiving module configured to receive a data metric request input by a user based on a data query interface, and obtain a metric expression corresponding to the data metric request;

[0256] A request conversion module configured to determine a data storage engine associated with the metric expression, convert the metric expression into subquery information corresponding to each data storage engine, and post-processing information associated with the subquery information;

[0257] A result output module configured to obtain a subquery result corresponding to the subquery information fed back by the data storage engine, generate a target query result according to the subquery result and the post-processing information, and display the target query result.

[0258] The above description is merely preferred embodiments of the present disclosure and a description of the principles of the technology applied. Those skilled in the art should understand that the scope of the disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combinations of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features disclosed in the present disclosure (but not limited to) having similar functions to form technical solutions.

[0259] Moreover, while operations are depicted in a particular order, this should not be understood as requiring such an order nor infringing on the scope of the disclosure. Certain of the operations described in the discussion are combinable into a single operation, and certain operations can be separated into several operations. In some embodiments, the operations described in the discussion can be performed in an order different than presented in the discussion. In some embodiments, the operations described in the discussion can be performed concurrently. Also, while several specific implementation details are discussed in the discussion, these should not be interpreted as limiting the scope of the disclosure. Rather, certain features described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable sub-combination.

[0260] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims

1. A data query method, characterized by, The method comprises the following steps: receiving a data metric request input by a user based on a data query interface, obtaining a metric expression corresponding to the data metric request, determining a data storage engine associated with the metric expression, and converting the metric expression into a metric abstract syntax tree; parsing the metric abstract syntax tree to obtain a subquery abstract syntax tree corresponding to each data storage engine, and constructing a post-processing abstract syntax tree according to the subquery abstract syntax tree corresponding to the metric abstract syntax tree, wherein the post-processing abstract syntax tree is used to represent the dependency relationship between the subquery abstract syntax trees; determining subquery information according to the subquery abstract syntax tree, and determining post-processing information associated with the subquery information according to the post-processing abstract syntax tree, wherein the post-processing information comprises a target table creation statement used to construct a metric query table and a target metric statement associated with the subquery information; the metric query table is used to store the subquery result of the data storage engine; the target table creation statement is used to indicate the table structure of the metric query table; and the target metric statement is used to process the subquery result in the metric query table; obtaining the subquery result corresponding to the subquery information fed back by the data storage engine, generating a target query result according to the subquery result and the post-processing information, and displaying the target query result.

2. The data query method of claim 1, wherein, The subquery information comprises a subquery statement used to access the data storage engine; and the determination of the subquery information according to the subquery abstract syntax tree comprises the following steps: for each data storage engine, converting the subquery abstract syntax tree corresponding to the data storage engine into a subquery statement used to access the data storage engine, so as to access the data storage engine based on the subquery statement to obtain the subquery result corresponding to the subquery information.

3. The data query method of claim 1, wherein, The parsing of the metric abstract syntax tree to obtain a subquery abstract syntax tree corresponding to each data storage engine comprises the following steps: splitting the metric abstract syntax tree to obtain at least one subquery abstract syntax tree; grouping and aggregating the subquery abstract syntax trees obtained by splitting according to the data storage engine corresponding to the metric abstract syntax tree, to obtain a subquery abstract syntax tree corresponding to each data storage engine.

4. The data query method of claim 3, wherein, The splitting of the metric abstract syntax tree comprises the following steps: splitting the metric abstract syntax tree according to the attribute information and / or function input parameter of the function at each function node in the metric abstract syntax tree.

5. The data query method of claim 4, wherein, The splitting of the metric abstract syntax tree according to the attribute information and / or function input parameter of the function at each function node in the metric abstract syntax tree comprises at least one of the following operations: if the data storage engine corresponding to the function input parameter of the current function node in the metric expression is different from the data storage engine corresponding to the function input parameter of the parent function node, splitting the metric abstract syntax tree by taking the current function node as the root node of a subquery abstract syntax tree; If the function attribute corresponding to the current function node in the metric abstract syntax tree is an aggregate function, the current function node is taken as a root node of a subquery abstract syntax tree to split the metric abstract syntax tree; If the function input parameter corresponding to the current function node in the metric expression is missing in at least part of the data storage engine, the current function node is taken as a root node of a subquery abstract syntax tree to split the metric abstract syntax tree, and leaf function nodes under the function node are recursively split.

6. The data query method of claim 3, wherein, The grouped and aggregated processing of the split subquery abstract syntax trees according to the data storage engines corresponding to the metric abstract syntax tree is performed to obtain a subquery abstract syntax tree corresponding to each data storage engine, including: A function execution dependency relationship is generated according to function call relationships among the functions in the split subquery abstract syntax trees; The split subquery abstract syntax trees are grouped and aggregated according to the function execution dependency relationship and the association relationship between the subquery abstract syntax trees and the data storage engines to obtain a subquery abstract syntax tree corresponding to each data storage engine.

7. The data query method of claim 1, wherein, The post-processing abstract syntax tree is constructed according to the subquery abstract syntax trees corresponding to the metric abstract syntax tree, including: A post-processing dependency relationship between the subquery abstract syntax trees corresponding to the metric expression is determined, and a post-processing abstract syntax tree is constructed according to the post-processing dependency relationship.

8. The data query method of claim 1, wherein, The post-processing information associated with the subquery information is determined according to the post-processing abstract syntax tree, including: The post-processing abstract syntax tree is converted into a target table building statement used for constructing a metric query table and a target metric statement associated with the subquery information, respectively; The target query result is generated according to the subquery result and the post-processing information, including: A metric query table is constructed by executing the target table building statement, and the subquery result is stored in the metric query table; The target query result is obtained by executing the target metric statement to process the subquery result in the metric query table.

9. The data query method of claim 8, wherein, The post-processing abstract syntax tree is converted into a target table building statement used for constructing a metric query table, including: A target table building statement used for constructing a metric query table is generated according to a target metric factor in the post-processing abstract syntax tree and a subquery result corresponding to the subquery information, wherein the target metric factor includes a data index and / or a metric dimension.

10. The data query method of claim 8, wherein, The target metric statement includes a metric query statement and a data processing statement; The post-processing abstract syntax tree is converted into a target metric statement associated with the subquery information, including: A metric query statement used for accessing the metric query table is generated according to an association relationship among a data index, a metric dimension, and a subquery result corresponding to the subquery information, wherein the metric query statement includes at least one of a table association statement, an aggregation statement, and a filtering statement; and A data processing statement associated with the subquery result is generated according to the metric query table and the post-processing abstract syntax tree; The processing of the subquery result in the metric query table by executing the target metric statement includes: Accessing the metric query table by executing the metric query statement to obtain a target access result, and obtaining the target query result corresponding to the data metric request by executing the data processing statement.

11. The data query method of claim 1, wherein, After the target query result is generated according to the subquery result and the post-processing information, before the target query result is displayed, the method further includes: Performing data adjustment processing on the target query data, wherein the data adjustment processing includes at least one of data dimension padding, data translation and conversion processing, data sorting processing, and data aggregation processing.

12. A data query apparatus, characterized by comprising: The method includes: A request receiving module configured to receive a data metric request input by a user based on a data query interface, and obtain a metric expression corresponding to the data metric request; A request converting module configured to determine a data storage engine associated with the metric expression, and convert the metric expression into a metric abstract syntax tree; The metric abstract syntax tree is parsed to obtain a subquery abstract syntax tree corresponding to each data storage engine, and a post-processing abstract syntax tree is constructed according to the subquery abstract syntax tree corresponding to the metric abstract syntax tree, wherein the post-processing abstract syntax tree is used to represent a dependency relationship between the subquery abstract syntax trees; subquery information is determined according to the subquery abstract syntax tree, and post-processing information associated with the subquery information is determined according to the post-processing abstract syntax tree, wherein the post-processing information includes a target table building statement used to build a metric query table and a target metric statement associated with the subquery information; the metric query table is used to store a subquery result of the data storage engine; the target table building statement is used to indicate a table structure of the metric query table; and the target metric statement is used to process the subquery result in the metric query table; A result output module configured to obtain a subquery result corresponding to the subquery information fed back by the data storage engine, generate a target query result according to the subquery result and the post-processing information, and display the target query result.

13. An electronic device, comprising: The electronic device includes: One or more processors; A storage device configured to store one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the data query method according to any one of claims 1-11.

14. A storage medium containing computer-executable instructions, wherein: The computer executable instructions, when executed by a computer processor, are used to perform the data query method according to any one of claims 1-11.

Citation Information

Patent Citations

  • Information query method and device, computer equipment and computer readable storage medium

    CN114443699A