Data processing method and device, storage medium and electronic equipment
By displaying calculation results and process information in business intelligence products and combining them with local sample data for calculation, the high cost and low efficiency problems in the debugging process of complex expressions are solved, and an efficient debugging process is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HANGZHOU LANGHE TECH
- Filing Date
- 2022-10-11
- Publication Date
- 2026-04-10
AI Technical Summary
When debugging complex calculation field expressions using business intelligence products, the debugging process consumes a lot of computing resources, is time-consuming, relies on experience, and has low debugging efficiency.
This paper provides a data processing method that obtains the final calculation result and calculation process information of the expression to be processed and displays them in the debugging interface. Users can view the calculation order by expanding the control and perform calculations locally in combination with sample data, thereby reducing the dependence on the database.
It improves debugging efficiency and reduces computational costs, allowing users to perform overall and partial debugging simultaneously, quickly finding and correcting errors.
Smart Images

Figure CN115525629B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present disclosure relate to the technical field of data processing, and more particularly, to a data processing method, device, storage medium and electronic equipment. BACKGROUND
[0002] In the related art, an application product of a data processing method (such as Business Intelligence (BI)) has a function of editing a calculation field, and a user can calculate an existing field in a database through the calculation field to generate a new field. For example, there are two columns of fields in the database: [sales] and [cost], but the profit of a product is unknown, and a calculation field expression [sales]-[cost] can be written. After the expression [sales]-[cost] is dragged to an interface of the application product of the data processing method (such as a BI product), the system automatically generates a corresponding Structured Query Language (SQL) to query the result from the database.
[0003] In some cases, the business is often very complex, and the calculation field expression to be written is also very complex, and a combination of multiple functions can be used. The user can not write the calculation field expression correctly at one time, and thus an incorrect query result is obtained. In order to obtain a correct result, the user needs to modify the expression according to the query result returned by the database until the database returns a correct query result, so as to debug the expression; or each part of the expression is copied to establish a new calculation field, and whether the result queried from the database is correct is observed to confirm whether each part of the expression is correct, so as to gradually correct the incorrect calculation field expression until the database returns a correct query result. SUMMARY
[0004] However, in the related art, when the BI product is used, the user needs to constantly modify the calculation field expression and wait for the query result of the database to debug the calculation field expression, and thus the calculation cost brought by the debugging process is very high, the debugging efficiency is relatively low, and the debugging strategy is very dependent on experience.
[0005] Therefore, there is a great need for an improved data processing method to improve the problem of low debugging efficiency caused by high calculation cost in the debugging process and great dependence on experience.
[0006] In this context, embodiments of the present disclosure aim to provide a data processing method, device, computer-readable storage medium and electronic equipment.
[0007] According to a first aspect of the present disclosure, a data processing method is provided, comprising: obtaining a final calculation result and calculation process information of a to-be-processed expression; the to-be-processed expression is an expression for calculating one or more base fields; displaying the to-be-processed expression and the final calculation result in a debugging interface; in response to a triggering operation of an expansion control in the debugging interface, displaying the calculation process information according to a calculation order of the to-be-processed expression; the final calculation result and the calculation process information are used for debugging the to-be-processed expression.
[0008] In an implementation, the to-be-processed expression comprises one or more functions, and the calculation process information comprises intermediate calculation results corresponding to the functions; in response to the triggering operation of the expansion control in the debugging interface, displaying the functions and the intermediate calculation results corresponding to the functions according to the calculation order of the to-be-processed expression.
[0009] In an implementation, the functions of the to-be-processed expression have a hierarchical relationship, and the hierarchical relationship is determined according to the calculation order; the expansion control comprises a sub-expansion control associated with a currently displayed function; in response to the triggering operation of the expansion control in the debugging interface, displaying the functions and the intermediate calculation results corresponding to the functions according to the calculation order of the to-be-processed expression comprises: in response to the triggering operation of the sub-expansion control, displaying a next-level function of the currently displayed function and an intermediate calculation result corresponding to the next-level function according to the hierarchical relationship.
[0010] In an implementation, the obtaining of the final calculation result and the calculation process information of the to-be-processed expression comprises: obtaining the to-be-processed expression and obtaining sample data of a base field in the to-be-processed expression; and calculating the to-be-processed expression by using the sample data to obtain the final calculation result and the calculation process information.
[0011] In an implementation, the obtaining of the to-be-processed expression comprises: in response to an input operation of a user interface, obtaining a complete expression; and in response to an operation of selecting a sub-expression from the complete expression, taking the sub-expression as the to-be-processed expression; the user interface can be switched with the debugging interface.
[0012] In an implementation, after the obtaining of the to-be-processed expression, the method further comprises: converting a complete expression corresponding to the to-be-processed expression into a first syntax tree, and determining a shortest legal sub-expression corresponding to the to-be-processed expression according to the first syntax tree; determining legality of the to-be-processed expression according to the shortest legal sub-expression; and in a case where the to-be-processed expression is illegal, legalizing the to-be-processed expression by using the shortest legal sub-expression.
[0013] In an implementation, the determining of the legality of the to-be-processed expression according to the shortest legal sub-expression comprises: comparing the to-be-processed expression with the shortest legal sub-expression; if the to-be-processed expression is consistent with the shortest legal sub-expression, the to-be-processed expression is legal; and if the to-be-processed expression is not consistent with the shortest legal sub-expression, it is determined that the to-be-processed expression is illegal.
[0014] In an implementation, the determining of the shortest legal sub-expression corresponding to the to-be-processed expression according to the first syntax tree comprises: matching the to-be-processed expression with an original expression corresponding to a node in the first syntax tree; the original expression is an expression of the node in a complete expression; and determining a shortest original expression including the to-be-processed expression as the shortest legal sub-expression.
[0015] In an implementation, the obtaining of the sample data of the basic field in the to-be-processed expression comprises: obtaining input data from a parameter value area in the debugging interface, and taking the input data as the sample data.
[0016] In an implementation, the method further comprises: in response to an operation of modifying the to-be-processed expression in an expression detection area, if it is detected that a basic field in the to-be-processed expression changes, updating a corresponding field list in the parameter value area according to the changed basic field to re-obtain sample data of the changed basic field.
[0017] In an implementation, the obtaining of the sample data of the basic field in the to-be-processed expression comprises: obtaining the sample data from a local data source; and the local data source includes a preset number of sample data.
[0018] In an implementation, the method further comprises: in response to a triggering operation of a data replacement control associated with the parameter value area, re-obtaining the sample data from the local data source.
[0019] In an embodiment, the sample data is used to calculate the to-be-processed expression to obtain the final calculation result and the calculation process information, including: converting the to-be-processed expression into a corresponding second syntax tree according to the calculation order of the to-be-processed expression; and calculating the sample data based on the second syntax tree to obtain the final calculation result and the calculation process information.
[0020] In an embodiment, converting the to-be-processed expression into a corresponding second syntax tree according to the calculation order of the to-be-processed expression includes: generating function nodes according to functions in the to-be-processed expression, and determining hierarchical relationships between the function nodes according to the calculation order of the functions; if the functions include fields and / or constants, generating field nodes corresponding to the fields and / or constant nodes corresponding to the constants with the function nodes corresponding to the functions as parent nodes; and generating the second syntax tree according to the function nodes, the field nodes, and / or the constant nodes.
[0021] In an embodiment, calculating the sample data based on the second syntax tree to obtain the calculation process information includes: obtaining attribute information of nodes of the second syntax tree; the nodes of the second syntax tree include at least one of the function nodes, the field nodes, and the constant nodes; generating the calculation process information according to the attribute information of the nodes of the second syntax tree; and the hierarchical relationships of the calculation process information correspond to the parent-child relationships of the function nodes in the second syntax tree.
[0022] In an embodiment, the method further includes: in response to a debugging operation on the to-be-processed expression, recalculating the to-be-processed expression after debugging.
[0023] According to a second aspect of the present disclosure, a data processing apparatus is provided, including:
[0024] an obtaining module configured to obtain a final calculation result and calculation process information of a to-be-processed expression; the to-be-processed expression is an expression for calculating one or more base fields;
[0025] a result display module configured to display the to-be-processed expression and the final calculation result in a debugging interface;
[0026] a process display module configured to, in response to a triggering operation of an expansion control in the debugging interface, display the calculation process information according to the calculation order of the to-be-processed expression; the final calculation result and the calculation process information are used for debugging the to-be-processed expression.
[0027] In an embodiment, the to-be-processed expression comprises one or more functions, the computation process information comprises intermediate computation results corresponding to the functions; the process display module is configured to:
[0028] In response to a triggering operation on the expansion control in the debugging interface, display the functions and the intermediate computation results corresponding to the functions according to the computation order of the to-be-processed expression.
[0029] In an embodiment, the functions in the to-be-processed expression have a hierarchical relationship, the hierarchical relationship is determined according to the computation order; the expansion control comprises a sub-expansion control associated with a currently displayed function; the process display module is configured to:
[0030] In response to a triggering operation on the sub-expansion control, display a next-level function of the currently displayed function and an intermediate computation result corresponding to the next-level function according to the hierarchical relationship.
[0031] In an embodiment, the obtaining module is configured to:
[0032] Obtain the to-be-processed expression, and obtain sample data of a basic field in the to-be-processed expression;
[0033] Perform computation on the to-be-processed expression by using the sample data to obtain the final computation result and the computation process information.
[0034] In an embodiment, the obtaining module is configured to:
[0035] In response to an input operation on a user interface, obtain a complete expression; in response to an operation of selecting a sub-expression from the complete expression, take the sub-expression as the to-be-processed expression; the user interface can be switched with the debugging interface.
[0036] In an embodiment, the data processing apparatus further comprises a first debugging module configured to:
[0037] Convert a complete expression corresponding to the to-be-processed expression into a first syntax tree, and determine a shortest legal sub-expression corresponding to the to-be-processed expression according to the first syntax tree; determine the legality of the to-be-processed expression according to the shortest legal sub-expression; in a case where the to-be-processed expression is illegal, legalize the to-be-processed expression by using the shortest legal sub-expression.
[0038] In an embodiment, the first debugging module is configured to:
[0039] The to-be-processed expression is compared with the shortest legal sub-expression; if the to-be-processed expression is consistent with the shortest legal sub-expression, the to-be-processed expression is legal; if not, the to-be-processed expression is illegal.
[0040] In an embodiment, the first debugging module is configured to:
[0041] The to-be-processed expression is matched with an original expression corresponding to a node in the first syntax tree; the original expression is an expression of the node in a complete expression; and a shortest original expression including the to-be-processed expression is determined as the shortest legal sub-expression.
[0042] In an embodiment, the obtaining module is configured to:
[0043] Input data is obtained from a parameter value area in the debugging interface, and the input data is taken as the sample data.
[0044] In an embodiment, the data processing apparatus further comprises a data updating module configured to:
[0045] In response to an operation of modifying the to-be-processed expression in an expression detection area, if a change in a basic field in the to-be-processed expression is detected, a field list corresponding to the changed basic field in the parameter value area is updated according to the changed basic field, so as to re-obtain sample data of the changed basic field.
[0046] In an embodiment, the obtaining module is configured to:
[0047] The sample data is obtained from a local data source; the local data source includes a preset number of sample data.
[0048] In an embodiment, the obtaining module is configured to:
[0049] In response to a triggering operation of a data replacement control associated with the parameter value area, the sample data is re-obtained from the local data source.
[0050] In an embodiment, the data processing apparatus further comprises a second debugging module configured to:
[0051] The to-be-processed expression is converted into a corresponding second syntax tree according to a calculation order of the to-be-processed expression; sample data is calculated based on the second syntax tree, so as to obtain the calculation result and the calculation process information.
[0052] In an embodiment, the second debugging module is configured to:
[0053] According to the functions in the to-be-processed expression, function nodes are generated, and a hierarchical relationship between the function nodes is determined according to a calculation order between the functions; if the functions include fields and / or constants, field nodes corresponding to the fields and / or constant nodes corresponding to the constants are generated, with the function nodes corresponding to the functions as parent nodes; and the second syntax tree is generated according to the function nodes, the field nodes, and / or the constant nodes.
[0054] In an implementation, the second debugging module is configured to:
[0055] obtain attribute information of nodes of the second syntax tree, the nodes of the second syntax tree including at least one of the function nodes, the field nodes, and the constant nodes; and generate the calculation process information according to the attribute information of the nodes of the second syntax tree, the hierarchical relationship of the calculation process information corresponding to the parent-child relationship of the function nodes in the second syntax tree.
[0056] In an implementation, the second debugging module is configured to:
[0057] In response to a debugging operation on the to-be-processed expression, the to-be-processed expression after debugging is recalculated.
[0058] According to a third aspect of the embodiments of the present disclosure, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by a processor to implement the data processing method of the first aspect.
[0059] According to a fourth aspect of the embodiments of the present disclosure, an electronic device is provided, which includes a processor and a memory for storing executable instructions of the processor, and the processor is configured to execute the data processing method of the first aspect by executing the executable instructions.
[0060] According to the data processing method, the data processing apparatus, the computer readable storage medium, and the electronic device, the final calculation result of the to-be-processed expression is displayed, and the calculation process information is displayed by setting an expansion control. In this way, on the one hand, the user can simultaneously debug the to-be-processed expression according to the final calculation result and the calculation process information, thereby improving the debugging efficiency of the to-be-processed expression; on the other hand, by triggering the expansion control, the calculation process information of a specific step can be viewed, so that the to-be-processed expression can be locally debugged based on the calculation process information of the step in the case that the calculation process information of the step does not match the expected calculation process information, thereby further improving the debugging efficiency of the to-be-processed expression. BRIEF DESCRIPTION OF DRAWINGS
[0061] The above and other objects, features, and advantages of this disclosure will become readily apparent from the following detailed description of exemplary embodiments, taken in conjunction with the accompanying drawings. Several embodiments of this disclosure are illustrated in the drawings by way of example and not limitation, in which:
[0062] Figure 1 A flowchart illustrating a data processing method according to an embodiment of this disclosure is shown;
[0063] Figure 2A A schematic diagram showing a debugging interface in a data processing method according to an embodiment of the present disclosure is provided.
[0064] Figure 2B An example diagram showing calculation process information in a data processing method according to an embodiment of the present disclosure is shown;
[0065] Figure 3 This diagram shows a flowchart of the calculation process in a data processing method according to an embodiment of the present disclosure;
[0066] Figure 4A This diagram illustrates a flowchart of determining the expression to be processed in a data processing method according to an embodiment of the present disclosure;
[0067] Figure 4B An example diagram of a user interface in a data processing method according to an embodiment of this disclosure is shown;
[0068] Figure 5 This diagram illustrates a flowchart of a data processing method for validating data according to an embodiment of the present disclosure.
[0069] Figure 6 This diagram illustrates a flowchart of a data processing method for validating data according to an embodiment of the present disclosure.
[0070] Figure 7 This diagram illustrates a flowchart of a data processing method for validating data according to an embodiment of the present disclosure.
[0071] Figure 8 This diagram shows a flowchart of the calculation process in a data processing method according to an embodiment of the present disclosure;
[0072] Figure 9 This diagram illustrates an example syntax tree in a data processing method according to an embodiment of the present disclosure.
[0073] Figure 10 This diagram shows a flowchart of the calculation process in a data processing method according to an embodiment of the present disclosure;
[0074] Figure 11 This diagram illustrates a flowchart of a data processing method for generating computation process information according to an embodiment of the present disclosure.
[0075] Figure 12FIG. 1 shows a schematic diagram of a data processing apparatus according to an embodiment of the present disclosure.
[0076] Figure 13 FIG. 1 shows a schematic diagram of a data processing apparatus according to an embodiment of the present disclosure.
[0077] In the drawings, identical or corresponding elements are denoted by the same or corresponding reference numerals. DETAILED DESCRIPTION
[0078] The principles and spirits of the present disclosure will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are only given to enable those skilled in the art to better understand and implement the present disclosure, and do not limit the scope of the present disclosure in any way. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0079] Those skilled in the art understand that the embodiments of the present disclosure can be implemented as a system, apparatus, device, method or computer program product. Therefore, the present disclosure can be embodied as a complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0080] According to embodiments of the present disclosure, a data processing method, apparatus, storage medium and electronic device are provided.
[0081] In this document, the number of any elements in the drawings is used for illustration and not limitation, and any naming is only for distinction and does not have any limiting meaning.
[0082] The principles and spirits of the present disclosure will be described below with reference to several representative embodiments of the present disclosure. SUMMARY
[0084] In the related art, an application product (such as a BI product) of a data processing method has a function of editing a calculation field, and a user can generate a new field by calculating an existing field in a database through the calculation field. For example, there are two column fields [sales] and [cost] in the database, but the profit of a commodity is unknown, and a calculation field expression [sales]-[cost] can be written. After the expression [sales]-[cost] is dragged to an interface of the application product (such as a BI product) of the data processing method, the system automatically generates a corresponding structured query language (SQL) to query the result from the database, but the calculation resources consumed in the calculation process are very huge, because the data dragged by the system based on the structured query language includes all data under the [sales] field and all data under the [cost] field, and the calculation of [sales]-[cost] is performed on all data under the two fields.
[0085] In some cases, the business is often very complex, and the calculation field expression to be written is also very complex, and a combination of multiple functions can be used. The user can not write the calculation field expression correctly at one time, and thus an incorrect query result is obtained. In order to obtain a correct result, the user needs to modify the expression according to the query result returned by the database, until the database returns a correct query result, so as to debug the expression; or each part of the expression is copied to establish a new calculation field, and whether the result queried from the database is correct is observed to confirm whether each part of the expression is correct, so as to gradually correct the incorrect calculation field expression until the database returns a correct query result.
[0086] In summary, the present inventors find that in the related art, when the BI product is used, the following two problems exist: (1) the user needs to debug by continuously modifying the calculation field expression and then waiting for the database to calculate the result, and the debugging process needs to consume a large amount of calculation resources, the time cost is very high, and it is also very dependent on experience; (2) each time of debugging needs to query the calculation field query result from the user database, and the debugging process will bring a certain pressure to the database, the user cannot quickly obtain the result, and the debugging efficiency is very low.
[0087] In view of the above, the present disclosure provides a data processing method, device, storage medium and electronic equipment, which debugs a to-be-processed expression according to a final calculation result and calculation process information of the to-be-processed expression. On the one hand, not only the final calculation result but also the calculation process information is displayed for the user, so that the user can debug the to-be-processed expression according to the calculation process information, and the debugging efficiency of the to-be-processed expression is improved. On the other hand, the calculation of the to-be-processed expression is implemented based on sample data, which is from user input or from a local data source, without traversing database data to obtain the calculation result, thereby reducing the calculation cost and improving the calculation efficiency.
[0088] After introducing the basic principles of the present disclosure, various non-limiting embodiments of the present disclosure will be specifically introduced below.
[0089] Overview of Application Scenarios
[0090] It should be noted that the following application scenarios are only shown for the purpose of facilitating understanding of the spirit and principles of the present disclosure, and the embodiments of the present disclosure are not limited in this respect. On the contrary, the embodiments of the present disclosure can be applied to any applicable scenario.
[0091] In the process of using a BI product, when debugging a to-be-processed expression, the user debugs the to-be-processed expression according to a final calculation result and calculation process information of the to-be-processed expression displayed in a debugging interface, so that the to-be-processed expression is correct in format and logic.
[0092] Exemplary Methods
[0093] The exemplary embodiments of the present disclosure first provide a data processing method, which can include:
[0094] obtaining a final calculation result and calculation process information of a to-be-processed expression; the to-be-processed expression is an expression for calculating one or more base fields;
[0095] displaying the to-be-processed expression and the final calculation result in a debugging interface;
[0096] in response to a triggering operation on an expansion control in the debugging interface, displaying the calculation process information according to a calculation order of the to-be-processed expression;
[0097] The final calculation result and the calculation process information are used for debugging the to-be-processed expression.
[0098] Figure 1 An exemplary flow of the data processing method is shown, and each step in the exemplary flow will be specifically described below. Figure 1
[0099] ReferenceFigure 1 In step S110, the final calculation result and the calculation process information of the to-be-processed expression are obtained.
[0100] A field refers to a type of information in a database, which can be an attribute name of data. For example, in a database, each row of a table can be a tuple, and each column can be an attribute. Each column is a field. Different tuples can have different values under the same field.
[0101] A base field is an existing field in a database. For example, a database itself includes two fields, [sales] and [cost], which are both base fields.
[0102] A to-be-processed expression is an expression for calculating one or more base fields, which generates a new field by combining and calculating the base fields. The generated new field can be a calculation field.
[0103] A to-be-processed expression includes one or more functions. In the case of a to-be-processed expression including one function, the to-be-processed expression includes one calculation logic. In the case of a to-be-processed expression including multiple functions, the to-be-processed expression includes multiple calculation logics, which can include one type of calculation logic or multiple types of calculation logics. For example: add(A, B, C), IF [parameter] * [calculation type] = "calculate average profit per order" THEN sum([order amount]-[order cost]) / countd([order ID]) ELSE sum([order amount]-[order cost]) / countd([product ID]), which is not limited here.
[0104] The final calculation result, i.e. the result obtained by substituting the data into the to-be-processed expression for calculation, is exemplified as follows: as shown in FIG. 2, the to-be-processed expression is IF [parameter] * [calculation type] = "calculate average profit per order" THEN sum ([order amount] - [order cost]) / countd ([order ID]) ELSE sum ([order amount] - [order cost]) / countd ([product ID]), the order amount data is 3000, the order cost data is 1000, there is one order, and the order ID is 101000011, then the final calculation result of sum ([order amount] - [order cost]) / countd ([order ID]) is 3000-1000 = 2000; in the case that the order ID data is incomplete, the final calculation result 3000-1000 = 2000 can be obtained by calculating sum ([order amount] - [order cost]) / countd ([product ID]) based on the product ID; wherein, the to-be-processed expression IF [parameter] * [calculation type] = "calculate average profit per order" THEN sum ([order amount] - [order cost]) / countd ([order ID]) ELSE sum ([order amount] - [order cost]) / countd ([product ID]) means: if the average profit per order is calculated, then "sum ([order amount] - [order cost]) / countd ([order ID])" is used for calculation, otherwise, "sum ([order amount] - [order cost]) / countd ([product ID])" is used; for one product, whether the order ID generated in the sales end or the product ID generated in the production end can uniquely identify the product, i.e. the order ID and the product ID are different dimensions of the identification of the product, therefore, based on the order ID to determine the total order quantity, or based on the product ID to determine the total product quantity, the ratio of the total profit to the total order quantity, or the ratio of the total profit to the total product quantity, can calculate the average profit per order, and the calculation results of the two are equal.
[0105] The calculation process information includes the intermediate calculation result corresponding to the function, and in an embodiment, the step S130 can further include the following steps:
[0106] In response to the triggering operation of the expansion control in the debugging interface, the function and the intermediate calculation result corresponding to the function are displayed in the calculation order of the to-be-processed expression.
[0107] For the expression to be processed ROUND([quantity]*([sales]-[cost]),2), the subtraction is calculated first, then the multiplication, and finally the constant is calculated accordingly; here, the expression to be processed includes three functions, namely, ROUND([quantity]*([sales]-[cost]),2), [quantity]*([sales]-[cost]) and [sales]-[cost], and the calculation results of [quantity]*([sales]-[cost]) and [sales]-[cost] are intermediate calculation results for the function ROUND([quantity]*([sales]-[cost]),2), and the calculation result of [sales]-[cost] is an intermediate calculation result for the function [quantity]*([sales]-[cost]).
[0108] The expansion control can be represented by a symbol "+" or "▼", which is not limited here. For this step, for ROUND([quantity]*([sales]-[cost]),2), ROUND([quantity]*([sales]-[cost]),2) and the corresponding calculation result are displayed first, then [quantity]*([sales]-[cost]) and the corresponding calculation result are displayed, and finally [sales]-[cost] and the corresponding calculation result are displayed, and thus the calculation process information is as follows:
[0109] ▼ROUND([quantity]*([sales]-[cost]),2) Calculation result 1
[0110] ▼[quantity]*([sales]-[cost]) Calculation result 2
[0111] [sales]-[cost] Calculation result 3
[0112] Among them, the calculation result 1 is the final calculation result, and the calculation results 2 and 3 are intermediate calculation results.
[0113] With reference to Figure 1 , in step S120, the expression to be processed and the final calculation result are displayed in the debugging interface.
[0114] Among them, the debugging interface is the interface provided for debugging the expression to be processed, and the expression to be processed and the final calculation result are displayed in the debugging interface, so as to facilitate the user to debug the expression to be processed according to the final calculation result.
[0115] For example, as Figure 2AAs shown, the final calculation result 2000 is displayed in the final calculation result display area, and the calculation process information IF [parameter] * [calculation type] = "calculate average profit per order" THEN sum ([order amount] - [order cost]) / countd ([order ID]) ELSE sum ([order amount] - [order cost]) / countd ([product ID]) is displayed in the calculation process information display area; as Figure 2B As shown, the intermediate calculation process information of the to-be-processed expression ROUND ([quantity] * ([sales] - [cost]), 2) is [quantity] * ([sales] - [cost]) and [sales] - [cost]; the expansion control "▼" before the to-be-processed expression ROUND ([quantity] * ([sales] - [cost])) is operated to expand [quantity] * ([sales] - [cost]), and the sub-expansion control "▼" before [quantity] * ([sales] - [cost]) is operated to expand [sales] - [cost].
[0116] With reference to Figure 1 , in step S130, in response to the triggering operation of the expansion control in the debugging interface, the calculation process information is displayed in the calculation order of the to-be-processed expression.
[0117] Among them, the final calculation result and the calculation process information are used for debugging the to-be-processed expression.
[0118] The function of the expansion control is to display the calculation process information in the calculation order of the to-be-processed expression. Here, the calculation process information in the front calculation order can be displayed below the calculation process information in the rear calculation order, or the calculation process information in the front calculation order can be displayed above the calculation process information in the rear calculation order, which is not limited here. In addition, the calculation process information refers to the information representing the calculation process and the calculation order generated according to the calculation process, such as: in the example of step S110 above, in the average profit per order 3000-1000=2000, 2000 is the calculation result, and the expression "sum ([order amount] - [order cost]) / countd ([order ID])" and the expression "sum ([order amount] - [order cost]) / countd ([product ID])" are the calculation process information.
[0119] As shown in FIG. 2, for example, by clicking the expansion control "▼" before IF [parameter] * [calculation type] = "calculate average profit per order", THEN sum([order amount]-[order cost]) / countd([order ID]) ELSE sum([order amount]-[order cost]) / countd([product ID]) is displayed, wherein THEN sum([order amount]-[order cost]) / countd([order ID]) ELSE sum([order amount]-[order cost]) / countd([product ID]) is the calculation process information of IF [parameter] * [calculation type] = "calculate average profit per order". In addition to the click operation of the mouse, the triggering operation of the expansion control "▼" can also be achieved by touch or cursor stay.
[0120] In the method of the embodiment, the user can debug the to-be-processed expression according to the final calculation result and the calculation process information; for example, if there is a deviation between the final calculation result and the theoretical calculation result (expected calculation result), the to-be-processed expression is debugged as a whole; or, according to the calculation process information, the to-be-processed expression is debugged locally; for example, according to the calculation process information "[order amount]-[order cost]", the expression corresponding to the part in the to-be-processed expression is debugged.
[0121] In order to facilitate the user to debug the to-be-processed expression locally according to the calculation process information, the calculation process information can be unfolded layer by layer according to the calculation order; in an embodiment, the functions of the to-be-processed expression have a hierarchical relationship, and the hierarchical relationship is determined according to the calculation order; the expansion control includes a sub-expansion control associated with the currently displayed function, and the above step can further include the following steps:
[0122] In response to the triggering operation of the sub-expansion control, the next level function of the currently displayed function and the intermediate calculation result corresponding to the next level function are displayed according to the hierarchical relationship.
[0123] The hierarchical relationship can be understood as that the function in the calculation order is the upper level of the function in the calculation order, for example, the function [quantity]*([sales]-[cost]) is the upper level of the function [sales]-[cost].
[0124] The functions of the to-be-processed expression have a nested and nested relationship, and the nested function can be the next level function of the nested function. As described above, the to-be-processed expression "ROUND ([number] * ([sales] - [cost]), 2)" includes three functions: the ROUND function, the multiplication function, and the subtraction function. Among them, the multiplication function "([number] * ([sales] - [cost])" is nested in the ROUND function "ROUND ([number] * ([sales] - [cost]), 2)", which is the next level function of the ROUND function; the subtraction function "[sales] - [cost]" is nested in the multiplication function "([number] * ([sales] - [cost])", which is the next level function of the multiplication function.
[0125] The sub-expansion control is relative to the expansion control corresponding to the currently displayed function, that is, the currently displayed function corresponds to the expansion control, and the next level function of the currently displayed function corresponds to the sub-expansion control. The sub-expansion control and the expansion control have the same function and are the same function control associated based on the hierarchical relationship of the function, for example: Figure 2B As shown in the above function, for the above function, the "▼" in the above function is the expansion control, and the "▼" in the sub-expansion control is the sub-expansion control.
[0126] The expansion (display) is the hierarchical expansion (display) according to the calculation order, that is, the trigger operation of the expansion control will display the next level function of the currently displayed function, and will not display the next next level function. For example, the trigger operation of the expansion control "▼" in the above function will display the next level function of the currently displayed function, and will not display the next next level function. For example, the trigger operation of the expansion control "▼" in the above function will display the next level function of the currently displayed function, and will not display the next next level function. For example, the trigger operation of the expansion control "▼" in the above function will display the next level function of the currently displayed function, and will not display the next next level function.
[0127] The debugging of the to-be-processed expression can be manually debugged by the user, or automatically debugged by the system / program; for example, the user can directly debug the to-be-processed expression according to the correctness of the final calculation result, or the user can debug the to-be-processed expression by selecting the returned options, or the system / program can directly debug the to-be-processed expression.
[0128] Further, the to-be-processed expression is [sales]-[profit]=[cost], the sales data is 1000, the cost data is 300, the correct calculation result is 700, and the displayed calculation result is 300, so the user adjusts the to-be-processed expression to [sales]-[cost]=[profit] according to the deviation between the displayed calculation result and the correct calculation result; for example, the user selects [sales]-[cost] and [sales]-[cost]=[profit] to debug the to-be-processed expression, and the to-be-processed expression [sales]-[cost]=[profit] is debugged to [sales]-[cost]=[profit]; for example, the machine directly debugs the to-be-processed expression [sales]-[cost]=[profit] to [sales]-[cost]=[profit] according to [sales]-[cost] and [sales]-[cost]=[profit], obviously, through the debugging, [sales] in the to-be-processed expression is debugged to [sales], and the missing "sales" is supplemented, so that the to-be-processed expression after the debugging is correct in format and logic.
[0129] The method of the embodiment can expand the calculation process information according to the calculation order, and further, the user can accurately find the intermediate calculation process information and the corresponding intermediate calculation result of the local to-be-processed expression to be debugged; in this way, the local to-be-processed expression can be accurately and efficiently debugged.
[0130] In order to improve the calculation efficiency of the final calculation result, the sample data can be substituted into the to-be-processed expression to directly calculate locally; in an implementation manner, referring to FIG. 11, the step S110 can further include the following steps S310 and S320. Figure 3
[0131] The step S310 acquires the to-be-processed expression and acquires the sample data of the basic field in the to-be-processed expression.
[0132] The sample data is data that can be substituted into the to-be-processed expression to calculate the to-be-processed expression, for example, the to-be-processed expression is [sales]-[cost]=[profit], the sales data is 1000, and the cost data is 300, 1000 and 300 are sample data, wherein 1000 is sample data of [sales] and 300 is sample data of [cost].
[0133] The step S320 calculates the to-be-processed expression by using the sample data to obtain the final calculation result and the calculation process information.
[0134] The sample data can be obtained through the input of the user. In this case, the sample data input by the user can be directly substituted into the to-be-processed expression, and the final calculation result can be obtained through local calculation, and the corresponding calculation process information can be obtained. In another embodiment, the sample data can also be several pieces of data taken from the corresponding data source. In this case, the selected sample data is substituted into the to-be-processed expression. Since the amount of data involved in the sample data is much smaller than the total amount of data in the data source, the calculation can also be performed locally, so that the final calculation result can be quickly obtained, and the corresponding calculation process information can be obtained.
[0135] In addition, it should be noted that in the related art, the input function of the sample data is not provided, and the several pieces of data taken from the data source are not provided. Instead, all the data in the online database is traversed to obtain the query result, and then the to-be-processed expression is debugged according to the query result. Therefore, the calculation cannot be performed locally, and the calculation cost is very high.
[0136] In order to improve the debugging efficiency, the to-be-processed expression can be a part of the complete expression. In an embodiment, referring to FIG. 2, the step S210 can further include steps S410 and S420. Figure 4A
[0137] The step S410 acquires the complete expression in response to the input operation on the user interface.
[0138] The user interface is used for the user to input the complete expression. The user interface includes a debugging button. After the user inputs the complete expression, the debugging button is triggered, and the debugging interface can be switched to, as shown in FIG. 3. Figure 4B
[0139] The acquisition of the complete expression can be real-time acquisition, or can be acquired after all the complete expressions are edited (for example, acquired when the user stops the input operation for a preset length of time), which is not limited here.
[0140] The step S420 takes the sub-expression as the to-be-processed expression in response to the operation of selecting the sub-expression from the complete expression.
[0141] The user interface and the debugging interface can be switched.
[0142] The user interface is used for users to input complete expressions. These complete expressions are correctly formatted, meaning they conform to grammatical rules, but may be logically correct or logically incorrect. Correspondingly, the expression to be processed selected from the complete expression may be correctly formatted or incorrectly formatted, and may be logically correct or logically incorrect. For example, the complete expression is ROUND([Quantity]*([Cost]-[Sales Amount]), 2), and the expression to be processed selected from it is [Quantity]*([Cost]-[Sales Amount]. It can be seen that the expression "[Sales Amount]" is incomplete, missing "Amount]"), which is a formatting error.
[0143] The complete expression is entered by the user through the user interface. In one implementation, the user interface provides debugging controls. When the user enters the complete expression and selects the expression to be processed, the debugging controls are triggered, and the user is redirected to the debugging interface to debug the expression to ensure that the expression is correctly formatted and logically correct. This enables the debugging of the complete expression to ensure that the complete expression is logically correct. In this way, new expressions and new fields can be derived from existing complete expressions without the need for the user to write the expression to be processed from scratch, which is more convenient and efficient.
[0144] Debugging the expression to be processed can be divided into two main parts: format debugging and logic debugging. Format debugging ensures that the expression conforms to the syntax rules (i.e., fields are complete); logic debugging ensures that the calculation logic of the expression is correct. Format debugging is performed before logic debugging. In one implementation, refer to... Figure 5 As shown, after step S210 above, the method may further include the following steps:
[0145] Step S510: Convert the complete expression corresponding to the expression to be processed into a first syntax tree, and determine the shortest legal sub-expression corresponding to the expression to be processed based on the first syntax tree.
[0146] The first syntax tree, which is the syntax tree of the complete expression, includes three types of nodes: constant nodes, field nodes, and function nodes, and each node stores different attribute information.
[0147] Validity can include: conforming to the syntax rules (correct format), such as: ROUND([Quantity]*([Sales Amount]-[Cost]), 2); complete fields, which is a complete expression that conforms to the syntax rules, such as ROUND([Quantity]*([Sales Amount]-[Cost]), 2); and incomplete fields, which is a complete expression that does not conform to the syntax rules (incorrect format).
[0148] The shortest legal sub-expression can be the shortest and legal sub-expression among the sub-expressions comprising the to-be-processed expression, such as: the to-be-processed expression is [sales]-[cost], the sub-expressions comprising the to-be-processed expression are [sales]-[cost], [quantity]*([sales]-[cost]) and ROUND([quantity]*([sales]-[cost]), 2), then, the sub-expression [sales]-[cost] is the shortest legal sub-expression of the to-be-processed expression.
[0149] Step S520: determining the legality of the to-be-processed expression according to the shortest legal sub-expression.
[0150] The shortest legal sub-expression is the shortest and legal sub-expression among the sub-expressions comprising the to-be-processed expression, thus, the legality of the to-be-processed expression is determined by using the shortest legal sub-expression, which is more concise and efficient.
[0151] In an embodiment, the legality of the to-be-processed expression can be determined by comparing the to-be-processed expression with the corresponding shortest legal sub-expression, as shown in FIG. 6. Figure 6 The step S520 can include the following steps:
[0152] Step S610: comparing the to-be-processed expression with the shortest legal sub-expression.
[0153] The legality of the to-be-processed expression can be determined by comparing the to-be-processed expression with the corresponding shortest legal sub-expression, as the shortest legal sub-expression can be used as a reference, such as: comparing the to-be-processed expression [sales]-[cost] with the corresponding shortest legal sub-expression [sales]-[cost].
[0154] Step S620: if the to-be-processed expression is consistent with the shortest legal sub-expression, the to-be-processed expression is legal; if the to-be-processed expression is not consistent with the shortest legal sub-expression, it is determined that the to-be-processed expression is illegal.
[0155] As the shortest legal sub-expression can be used as a reference, in the case of consistent comparison results, it is indicated that the to-be-processed expression is correct, i.e., the to-be-processed expression is legal; in the case of inconsistent comparison results, it is indicated that the to-be-processed expression is incorrect, i.e., the to-be-processed expression is illegal, such as: comparing the to-be-processed expression [sales]-[cost] with the corresponding shortest legal sub-expression [sales]-[cost], the to-be-processed expression is not consistent with the corresponding shortest legal sub-expression, then, the to-be-processed expression is illegal.
[0156] Step S630: in the case that the to-be-processed expression is illegal, the to-be-processed expression is legalized by using the shortest legal sub-expression.
[0157] Wherein, whether legal can be determined by the shortest legal sub-expression corresponding to the expression to be processed, and then, in the case of the expression to be processed is illegal, the shortest legal sub-expression is used to legalize the expression to be processed, so that the expression to be processed is correct in format and meets the syntax rules; here, the legalization can be achieved by replacing the expression to be processed with the shortest legal sub-expression, or by modifying the expression to be processed with the shortest legal sub-expression, etc., which is not limited here.
[0158] The method of the embodiment introduces a syntax tree to determine the shortest legal sub-expression including the expression to be processed based on the syntax tree, and then uses the shortest legal sub-expression to legalize the expression to be processed, thereby improving the efficiency of legalizing the expression to be processed and achieving the purpose of format debugging of the expression to be processed.
[0159] The shortest legal sub-expression can be determined by matching the expression to be processed with the first syntax tree; in one embodiment, referring to Figure 7 As shown in the figure, the step S510 can include the following steps:
[0160] Step S710, matching the expression to be processed with the original expression corresponding to the node in the first syntax tree.
[0161] Wherein, the original expression is the expression of the node in the complete expression; for example: the complete expression is ROUND ([number] * ([cost] - [sales]), 2), and the expression to be processed selected therefrom is [number] * ([cost] - [sales, then, the original expression is [cost] - [sales], [number] * ([cost] - [sales]) and ROUND ([number] * ([cost] - [sales]), 2).
[0162] Step S720, determining the shortest original expression including the expression to be processed as the shortest legal sub-expression.
[0163] In the step S710, the to-be-processed expression is matched with the original expressions corresponding to the nodes in the first syntax tree to obtain a plurality of original expressions including the to-be-processed expression, and the shortest original expression in the plurality of original expressions including the to-be-processed expression is determined as the shortest legal sub-expression. For example, in the example following the step S710, the original expression "[number]*([cost]-[sales])" in the original expressions "[cost]-[sales]", "[number]*([cost]-[sales])" and ROUND([number]*([cost]-[sales]), 2) is determined as the shortest legal sub-expression of the to-be-processed expression "[number]*([cost]-[sales]".
[0164] In the method of the embodiment, the complete expression is converted into the first syntax tree, the field recorded in the node of the first syntax tree is consistent with the complete expression, and the format of the first syntax tree may be correct or incorrect. However, the original expression recorded in the node of the first syntax tree is correct, and the original expression can be obtained through a pre-established database or other ways. Then, the to-be-processed expression is matched with the original expression recorded in the node of the first syntax tree to obtain the original expression including the to-be-processed expression, and the shortest original expression including the to-be-processed expression is determined from the original expressions, so that the to-be-processed expression can be legalized efficiently.
[0165] In a case where the sample data is obtained based on user input, the sample data can be obtained from a parameter value area of the user input. In an embodiment, the step S210 can include the following steps.
[0166] The input data is obtained from a parameter value area in the debugging interface, and the input data is used as the sample data.
[0167] The parameter value area can be arranged below the to-be-processed expression in the debugging interface, or above the to-be-processed expression in the debugging interface, and the like, which is not limited herein. In this way, the sample data can be directly used to calculate the to-be-processed expression. In this way, the calculation can be directly performed locally, and the calculation cost is saved.
[0168] The parameter value area includes a field list and corresponding sample data. The sample data provides an editing function, and the user can input data. As shown in FIG. 2, the order amount, the order cost, and the order ID are the field list, and 3000, 1000, and 101000011 are the corresponding sample data. The sample data can be input by the user or obtained from a data source.
[0169] The logic debugging of the to-be-processed expression can be manual debugging by the user according to the final calculation result and the calculation process information. Therefore, the user can edit the to-be-processed expression. In an embodiment, the method can include the following steps:
[0170] In response to the operation of modifying the to-be-processed expression in the expression detection area, if it is detected that the basic field in the to-be-processed expression changes, the corresponding field list in the parameter value area is updated according to the changed basic field to reacquire the sample data of the changed basic field.
[0171] The expression detection area refers to an area for displaying the to-be-processed expression. The area provides an editing function for the user, and the user can edit the to-be-processed expression in the area. When it is detected that the to-be-processed expression changes, it indicates that the user has debugged the to-be-processed expression. Then, the field list of the parameter value area is updated accordingly. At this time, the updated to-be-processed expression is calculated by using the sample data corresponding to the updated field list.
[0172] In the case of obtaining the sample data based on the data source, the data source can store one sample data or a preset number of sample data as backup data. Generally, one data can meet the demand. In an embodiment, the above step S210 can include the following steps:
[0173] The sample data is obtained from a local data source. The local data source includes a preset number of sample data.
[0174] In addition to the above calculation of the to-be-processed expression by directly obtaining the sample data from the parameter value area, the to-be-processed expression can also be calculated by using the preset number of sample data in the local data source. In this way, the calculation of the to-be-processed expression can be realized by using one or more sample data in the local data source, which overcomes the problem of high calculation cost and low debugging efficiency caused by the calculation of the to-be-processed expression by traversing all data in the database in the related art.
[0175] In the case of the above data source including a preset number of sample data, in order to improve the authenticity of the final calculation result, the final calculation result can be verified by using multiple sample data to reduce the debugging cost of the to-be-processed expression. In an embodiment, the method can include the following steps:
[0176] In response to a triggering operation of the data replacement control associated with the parameter value area, the sample data is reacquired from the local data source.
[0177] The debugging interface further includes a data replacement control associated with the parameter value area, as shown in FIG. 2, the "change a line of data" is the data replacement control, and after the data replacement control is triggered, a line of data can be randomly acquired from the data source; in this way, in the case of calculating the to-be-processed expression by using the sample data in the local data source, the sample data can be replaced to perform multiple verifications on the to-be-processed expression according to the calculation results and the calculation process information of the to-be-processed expression calculated according to multiple pieces of sample data, so as to further ensure the debugging accuracy.
[0178] In order to improve the calculation efficiency of the final calculation result, the to-be-processed expression can be converted into a syntax tree, and the sample data is substituted into the syntax tree to calculate according to the rules and structure of the syntax tree; in an implementation manner, the calculation of the to-be-processed expression by using the sample data is implemented by converting the to-be-processed expression into a syntax tree, as shown in FIG. 1, the step S110 can include the following steps S810 and S820: Figure 8
[0179] The step S810 converts the to-be-processed expression into a corresponding second syntax tree according to the calculation order of the to-be-processed expression.
[0180] The conversion principle of the second syntax tree is the same as that of the first syntax tree, and the syntax tree according to the calculation order can also be regarded as a syntax tree having a hierarchical relationship, for example: the to-be-processed expression ROUND ([number] * ([sales]-[cost]), 2) is converted into the syntax tree shown in FIG. 2, at this time, the hierarchical relationship of the calculation order corresponds to the hierarchical relationship of the syntax tree. Figure 9
[0181] The step S820 calculates the sample data based on the second syntax tree to obtain the final calculation result and the calculation process information.
[0182] The calculation is to substitute the sample data into the second syntax tree and calculate by using the second syntax tree, so that the final calculation result and the calculation process information can be obtained.
[0183] In order to make the to-be-processed expression consistent with the syntax tree and make the syntax tree accurately express the to-be-processed expression, the syntax tree can be generated based on the calculation order between functions; in an implementation manner, as shown in FIG. 1, the step S810 can include the following steps S1010 to S1030: Figure 10
[0184] Step S1010, generating function nodes according to the functions in the expression to be processed, and determining the hierarchical relationship between the function nodes according to the calculation order between the functions.
[0185] The hierarchical relationship in the second syntax tree is consistent with the hierarchical relationship between the functions; in this way, the second syntax tree can accurately express the expression to be processed.
[0186] The function node can be understood as a node for performing addition, subtraction, multiplication, division, etc. For example, in the expression to be processed ROUND ([number] * ([cost] - [sales]), 2), there are three function nodes, namely, the ROUND node, the - (subtraction operation) node, and the * (multiplication operation) node.
[0187] Step S1020, if the function includes a field and / or a constant, generating a field node corresponding to the field and / or a constant node corresponding to the constant, with the function node corresponding to the function as the parent node.
[0188] The function node is the parent node, and the field and / or the constant included in the function are the child nodes. Of course, there is also a case where the child node is still a function node, the difference being that the function node of the child node is a function whose calculation order is earlier than that of the parent node. For example, for the function ROUND ([number] * ([sales] - [cost]), 2), there are three function nodes: ROUND, *, and -, among which the ROUND function node has two child nodes: 2 and *, i.e., a constant node and a function node; the * function node has two child nodes: - and number, i.e., a function node and a field node; the - function node has two child nodes: sales and cost, i.e., two field nodes.
[0189] Step S1030, generating a second syntax tree according to the function nodes, the field nodes, and / or the constant nodes. All the function nodes, the field nodes, and / or the constant nodes constitute the second syntax tree; for example, as shown in Figure 8 As shown in the figure, the nodes of [cost], [sales], -, [number], *, ROUND, and 2 constitute the second syntax tree.
[0190] Since the syntax tree can accurately express the expression to be processed and has a specific structure, the calculation process information can be conveniently obtained according to the calculation rules of the syntax tree and the information recorded in the syntax tree nodes; in an implementation mode, as shown in Figure 11 The above step S820 can include the following steps S1110 and S1120:
[0191] Step S1110, obtaining attribute information of the nodes of the second syntax tree; the nodes of the second syntax tree include at least one of the function nodes, the field nodes, and the constant nodes.
[0192] For the function node, the attribute information includes: name of the function, syntax tree corresponding to each parameter of the function, original expression content corresponding to the node, and start index and end index of the original expression corresponding to the node in the whole expression.
[0193] For the constant node, the attribute information includes: constant itself, original expression content corresponding to the node, and start index and end index of the original expression corresponding to the node in the whole expression; for example, for the expression to be processed 666+888+999, there are 11 characters in total, and the indices of the characters from left to right are from 0 to 10, and the start index of the constant 888 is 4 and the end index is 6.
[0194] For the field node, the attribute information includes: value corresponding to the field, original expression content corresponding to the node, and start index and end index of the original expression corresponding to the node in the whole expression.
[0195] In step S1120, the calculation process information is generated according to the attribute information of the nodes of the second syntax tree.
[0196] The hierarchical relationship of the calculation process information corresponds to the parent-child relationship of the function nodes in the second syntax tree.
[0197] The calculation process information can be generated according to the sub-tree corresponding to the function node; for example, for the function ROUND([quantity]*([sales]-[cost]), 2), the function node has three: ROUND, *, and -, then the sub-tree corresponding to the ROUND function node is ROUND([quantity]*([sales]-[cost]), 2), the sub-tree corresponding to the * function node is [quantity]*([sales]-[cost], and the sub-tree corresponding to the - function node is [sales]-[cost].
[0198] The debugging can be one time or multiple times, after the completion of this debugging, if the debugging is still needed, the next debugging is performed, and in an implementation mode, the method can further include the following steps:
[0199] In response to the debugging operation on the expression to be processed, the calculation of the expression to be processed after debugging is performed again.
[0200] Wherein, when the debugging of the to-be-processed expression continues, the sample data is substituted into the to-be-processed expression to recalculate, the whole process can refer to steps S110 to S130, and a new final calculation result and calculation process information are obtained after recalculation. Then, whether the to-be-processed expression is debugged completely or further debugging is performed can be determined according to the new final calculation result and calculation process information. In this way, through local debugging and multiple debugging, the debugging of the to-be-processed expression can be completed, and then through multiple debugging of the to-be-processed expression, an accurate to-be-processed expression can be obtained, so that the user can obtain a calculation field and the user demand can be met.
[0201] Exemplary Apparatus
[0202] After introducing the data processing method of the example embodiment of the present disclosure, next, with reference to Figure 12 The data processing device of the example embodiment of the present disclosure is described.
[0203] With reference to Figure 12 As shown in the figure, the data processing device 1200 can include:
[0204] The acquisition module 1210 is configured to acquire a final calculation result and calculation process information of a to-be-processed expression; the to-be-processed expression is an expression for calculating one or more basic fields;
[0205] The result display module 1220 is configured to display the to-be-processed expression and the final calculation result in a debugging interface.
[0206] The process display module 1230 is configured to display the calculation process information according to the calculation order of the to-be-processed expression in response to a triggering operation of an expansion control in the debugging interface; the final calculation result and the calculation process information are used for debugging the to-be-processed expression.
[0207] In an embodiment, the to-be-processed expression includes one or more functions, and the calculation process information includes intermediate calculation results corresponding to the functions; the process display module 1230 is configured to display the functions and the intermediate calculation results corresponding to the functions according to the calculation order of the to-be-processed expression in response to the triggering operation of the expansion control in the debugging interface.
[0208] In an embodiment, the functions of the to-be-processed expression have a hierarchical relationship, and the hierarchical relationship is determined according to the calculation order; the expansion control includes a sub-expansion control associated with a currently displayed function; the process display module 1230 is configured to display a next-level function of the currently displayed function and an intermediate calculation result corresponding to the next-level function according to the hierarchical relationship in response to a triggering operation of the sub-expansion control.
[0209] In an embodiment, the obtaining module 1210 is configured to obtain a to-be-processed expression, and obtain sample data of a base field in the to-be-processed expression; and perform calculation on the to-be-processed expression by using the sample data to obtain a final calculation result and calculation process information.
[0210] In an embodiment, the obtaining module 1210 is configured to obtain a complete expression in response to an input operation on a user interface, and obtain a sub-expression from the complete expression as the to-be-processed expression in response to an operation of selecting the sub-expression from the complete expression; and the user interface is switchable with the debugging interface.
[0211] In an embodiment, the data processing apparatus 1200 further comprises a first debugging module 1240 configured to convert a complete expression corresponding to the to-be-processed expression into a first syntax tree, and determine a shortest legal sub-expression corresponding to the to-be-processed expression according to the first syntax tree; determine legality of the to-be-processed expression according to the shortest legal sub-expression; and in a case where the to-be-processed expression is illegal, legalize the to-be-processed expression by using the shortest legal sub-expression.
[0212] In an embodiment, the first debugging module 1240 is configured to compare the to-be-processed expression with the shortest legal sub-expression; if the to-be-processed expression is consistent with the shortest legal sub-expression, the to-be-processed expression is legal; and if the to-be-processed expression is inconsistent with the shortest legal sub-expression, it is determined that the to-be-processed expression is illegal.
[0213] In an embodiment, the first debugging module 1240 is configured to match the to-be-processed expression with an original expression corresponding to a node in the first syntax tree; the original expression is an expression of the node in the complete expression; and determine a shortest original expression including the to-be-processed expression as the shortest legal sub-expression.
[0214] In an embodiment, the obtaining module 1210 is configured to obtain input data from a parameter value area in the debugging interface, and take the input data as the sample data.
[0215] In an embodiment, the data processing apparatus 1200 further comprises a data updating module 1250 configured to, in response to an operation of modifying the to-be-processed expression in an expression detection area, if it is detected that a base field in the to-be-processed expression changes, update a field list corresponding to the changed base field in a parameter value area to re-obtain sample data of the changed base field.
[0216] In an embodiment, the obtaining module 1210 is configured to obtain the sample data from a local data source; and the local data source includes a preset number of sample data.
[0217] In an implementation, the obtaining module 1210 is configured to re-obtain the sample data from the local data source in response to a triggering operation on the data replacement control associated with the parameter value region.
[0218] In an implementation, the data processing apparatus further comprises a second debugging module 1260 configured to convert the to-be-processed expression into a corresponding second syntax tree according to a calculation order of the to-be-processed expression; and perform calculation on the sample data based on the second syntax tree to obtain a final calculation result and calculation process information.
[0219] In an implementation, the second debugging module 1260 is configured to generate function nodes according to functions in the to-be-processed expression, and determine hierarchical relationships between the function nodes according to a calculation order of the functions; if the functions include fields and / or constants, generate field nodes corresponding to the fields and / or constant nodes corresponding to the constants with the function nodes corresponding to the functions as parent nodes; and generate the second syntax tree according to the function nodes, the field nodes and / or the constant nodes.
[0220] In an implementation, the second debugging module 1260 is configured to obtain attribute information of nodes of the second syntax tree, the nodes of the second syntax tree including at least one of function nodes, field nodes and constant nodes; generate the calculation process information according to the attribute information of the nodes of the second syntax tree; and the hierarchical relationships of the calculation process information correspond to parent-child relationships of the function nodes in the second syntax tree.
[0221] In an implementation, the second debugging module 1260 is configured to re-perform calculation on the to-be-processed expression after debugging in response to a debugging operation on the to-be-processed expression.
[0222] In addition, other specific details of the embodiments of the present disclosure have been described in detail in the above-mentioned method embodiments, and will not be repeated here.
[0223] Exemplary Storage Medium
[0224] The storage medium of the exemplary embodiments of the present disclosure is described below.
[0225] In the exemplary embodiments, the above-mentioned method can be implemented by a program product, for example, a portable compact disc read-only memory (CD-ROM) including program codes and can be run on a device, for example, a personal computer. However, the program product of the present disclosure is not limited to this, and in this document, the 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, apparatus or device.
[0226] The program product can employ any combination of one or more computer-readable media. The computer-readable media can be a computer-readable storage medium or a computer-readable signal medium. The computer-readable storage medium can be, for example, but 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 (a non-exhaustive list) of the computer-readable storage medium include the following: an electrical connection having one or more wires, a portable disc, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0227] The computer-readable signal medium can include a computer-readable storage medium that is propagated as a carrier wave. The computer-readable signal medium can further be any computer-readable medium that is not a storage medium. The computer-readable signal medium can be a computer-readable storage medium that is a propagated signal on a carrier wave.
[0228] The program code embodied on the computer-readable media can be transmitted using any appropriate medium, including but not limited to wireless, wired, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0229] The program code can be executed by one or more programmable processors, which can be implemented using one or more microprocessors, microcontrollers, digital signal processors, central processing units, state machines, logic circuitries, and / or any other devices suitable for retrieval and execution of instructions. The program code can execute entirely on a user's computing device, partly on the user's computing device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device or entirely on the remote computing device or server. In the latter scenario, the remote computing device can be connected to the user's computing device 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 computing device, such as through the Internet using an Internet Service Provider (ISP).
[0230] Exemplary Electronic Device
[0231] Reference Figure 13 An electronic device according to an exemplary embodiment of the present disclosure is described.
[0232] Figure 13 The electronic device 1300 shown is merely an example and should not limit the scope of functionality or use of any embodiments of the present disclosure.
[0233] As Figure 13 shown, the electronic device 1300 is in the form of a general-purpose computing device. The components of electronic device 1300 can include, but are not limited to, at least one processing unit 1310, at least one storage unit 1320, a bus 1330 that connects the different system components including the storage unit 1320 and the processing unit 1310, a display unit 1340.
[0234] The storage unit stores program code that can be executed by the processing unit 1310 to cause the processing unit 1310 to perform the steps described in the above "Exemplary Methods" section according to various exemplary embodiments of the present disclosure. For example, the processing unit 1310 can perform the method steps as shown in Figure 1 and the like.
[0235] The storage unit 1320 can include volatile storage unit such as random access memory (RAM) 1321 and / or cache memory 1322, and can further include non-volatile storage unit such as read-only memory (ROM) 1323.
[0236] The storage unit 1320 can also include program / utility 1324 having one or more program modules 1325, such as an operating system (OS), one or more application programs, other programs, and program data, each of which performs one or more tasks.
[0237] The bus 1330 can include a data bus, an address bus, and a control bus.
[0238] The electronic device 1300 can also communicate with one or more external devices 2000 such as a keyboard or pointing device, a Bluetooth device, etc. through Input / Output (I / O) interface(s) 1350. The electronic device 1300 can further include a display unit 1340, which is connected to the Input / Output (I / O) interface(s) 1350, for displaying information to a user. Additionally, the electronic device 1300 can communicate with one or more networks, such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet, through a network adapter 1360. As depicted, the network adapter 1360 communicates with the other modules of the electronic device 1300 through the bus 1330. It should be appreciated that although not shown, other hardware and / or software modules could be used in conjunction with the electronic device 1300. Such as, but not limited to, microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data archival storage systems, etc.
[0239] It should be noted that, although several modules or sub-modules of the apparatus are mentioned in the foregoing detailed description, such a division is merely exemplary and not mandatory. Indeed, according to an embodiment of the disclosure, the features and functionalities of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functionalities of one unit / module described above can be further divided into units / modules embodied by several units / modules.
[0240] Moreover, although the operations of the method(s) according to the disclosure are described in a particular, sequential order, this order is not meant to be a limitation and is not intended to imply that
[0241] While the spirit and principles of the disclosure have been described with reference to several specific embodiments, it is to be understood that the disclosure is not limited to the disclosed specific embodiments, and that the division into aspects does not imply that features from these aspects cannot be combined to benefit. The disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.
Claims
1. A data processing method, characterized in that, include: Obtain the final calculation result and calculation process information of the expression to be processed; The expression to be processed is an expression that performs calculations on one or more basic fields; The expression to be processed and the final calculation result are displayed in the debugging interface; In response to a trigger operation on the expanded control in the debugging interface, the calculation process information is displayed according to the calculation order of the expression to be processed; The final calculation result and the calculation process information are used to debug the expression to be processed; The step of obtaining the final calculation result and calculation process information of the expression to be processed includes: Obtain the expression to be processed, and obtain sample data of the basic fields in the expression to be processed; Based on the functions in the expression to be processed, function nodes are generated, and the hierarchical relationship between the function nodes is determined according to the calculation order between the functions; If the function includes fields and / or constants, then the function node corresponding to the function is used as the parent node to generate field nodes corresponding to the fields and / or constant nodes corresponding to the constants; A second syntax tree is generated based on the function node, the field node, and / or the constant node; The sample data is calculated based on the second syntax tree to obtain the final calculation result and the calculation process information.
2. The data processing method according to claim 1, characterized in that, The expression to be processed includes one or more functions, and the calculation process information includes the intermediate calculation results corresponding to the functions; The step of responding to a trigger operation on an expanded control in the debugging interface and displaying the calculation process information according to the calculation order of the expressions to be processed includes: In response to a trigger operation on the expanded control in the debugging interface, the function and its corresponding intermediate calculation results are displayed according to the calculation order of the expression to be processed.
3. The data processing method according to claim 2, characterized in that, The functions in the expression to be processed have a hierarchical relationship, which is determined according to the calculation order; the expanded control includes sub-expanded controls associated with the currently displayed functions; the step of displaying the functions and their corresponding intermediate calculation results according to the calculation order of the expression to be processed in response to a trigger operation on the expanded control in the debugging interface includes: In response to a trigger operation on the sub-expand control, the next-level function of the currently displayed function and the intermediate calculation results corresponding to the next-level function are displayed according to the hierarchical relationship.
4. The data processing method according to claim 1, characterized in that, The step of obtaining the expression to be processed includes: Retrieve the complete expression in response to input from the user interface; In response to the operation of selecting a subexpression from the complete expression, the subexpression is used as the expression to be processed; the user interface and the debugging interface can be switched.
5. The data processing method according to claim 4, characterized in that, After obtaining the expression to be processed, the method further includes: The complete expression corresponding to the expression to be processed is converted into a first syntax tree, and the shortest legal subexpression corresponding to the expression to be processed is determined based on the first syntax tree. The validity of the expression to be processed is determined based on the shortest valid subexpression; If the expression to be processed is invalid, the shortest valid subexpression is used to legalize the expression to be processed.
6. The data processing method according to claim 5, characterized in that, Determining the validity of the expression to be processed based on the shortest valid subexpression includes: The expression to be processed is compared with the shortest legal subexpression; If the expression to be processed is consistent with the shortest valid subexpression, then the expression to be processed is determined to be valid; if the expression to be processed is inconsistent with the shortest valid subexpression, then the expression to be processed is determined to be invalid.
7. The data processing method according to claim 5, characterized in that, The step of determining the shortest valid subexpression corresponding to the expression to be processed based on the first syntax tree includes: The expression to be processed is matched with the original expression corresponding to the node in the first syntax tree; the original expression is the expression of the node in the complete expression. The shortest original expression that includes the expression to be processed is determined as the shortest legal subexpression.
8. The data processing method according to claim 1, characterized in that, The step of obtaining sample data of the basic fields in the expression to be processed includes: The input data is obtained from the parameter value area in the debugging interface, and the input data is used as the sample data.
9. The data processing method according to claim 8, characterized in that, The method further includes: In response to the operation of modifying the expression to be processed in the expression detection area, if a change is detected in the basic field of the expression to be processed, the corresponding field list in the parameter value area is updated according to the changed basic field to re-acquire the sample data of the changed basic field.
10. The data processing method according to claim 1, characterized in that, The step of obtaining sample data of the basic fields in the expression to be processed includes: The sample data is obtained from a local data source; the local data source includes a preset number of sample data entries.
11. The data processing method according to claim 10, characterized in that, The method further includes: In response to a trigger operation on the data replacement control associated with the parameter value range, the sample data is retrieved again from the local data source.
12. The data processing method according to claim 1, characterized in that, The calculation based on the second syntax tree on the sample data to obtain the calculation process information includes: Obtain the attribute information of the nodes of the second syntax tree; the nodes of the second syntax tree include at least one of the function nodes, the field nodes, and the constant nodes; The calculation process information is generated based on the attribute information of the nodes in the second syntax tree; the hierarchical relationship of the calculation process information corresponds to the parent-child relationship of the function nodes in the second syntax tree.
13. The data processing method according to claim 1, characterized in that, The method further includes: In response to the debugging operation on the expression to be processed, the debugged expression to be processed is recalculated.
14. A data processing apparatus, characterized in that, include: The acquisition module is configured to acquire the final calculation result and calculation process information of the expression to be processed; The expression to be processed is an expression that performs calculations on one or more basic fields; The result display module is configured to display the expression to be processed and the final calculation result in the debugging interface; The process display module is configured to display the calculation process information in accordance with the calculation order of the expressions to be processed in response to a trigger operation on the expanded control in the debugging interface; The final calculation result and the calculation process information are used to debug the expression to be processed; The acquisition module is configured as follows: Obtain the expression to be processed, and obtain sample data of the basic fields in the expression to be processed; use the sample data to calculate the expression to be processed, and obtain the final calculation result and the calculation process information; The second debugging module is configured to: generate function nodes based on the functions in the expression to be processed, and determine the hierarchical relationship between the function nodes according to the calculation order of the functions; if the function includes fields and / or constants, generate field nodes corresponding to the fields and / or constant nodes corresponding to the constants, with the function node corresponding to the function as the parent node; generate a second syntax tree based on the function nodes, the field nodes, and / or the constant nodes; and perform calculations on the sample data based on the second syntax tree to obtain the calculation results and the calculation process information.
15. The data processing apparatus according to claim 14, characterized in that, The expression to be processed includes one or more functions, and the calculation process information includes intermediate calculation results corresponding to the functions; the process display module is configured to: In response to a trigger operation on the expanded control in the debugging interface, the function and its corresponding intermediate calculation results are displayed according to the calculation order of the expression to be processed.
16. The data processing apparatus according to claim 15, characterized in that, The functions in the expression to be processed have a hierarchical relationship, which is determined according to the calculation order; the expanded control includes sub-expanded controls associated with the currently displayed functions; the process display module is configured to: In response to a trigger operation on the sub-expand control, the next-level function of the currently displayed function and the intermediate calculation results corresponding to the next-level function are displayed according to the hierarchical relationship.
17. The data processing apparatus according to claim 14, characterized in that, The acquisition module is configured as follows: In response to the operation of selecting a sub-expression from a complete expression, the sub-expression is used as the expression to be processed; the complete expression is obtained through a corresponding input operation on the user interface, which can be switched with the debugging interface.
18. The data processing apparatus according to claim 17, characterized in that, The data processing device further includes a first debugging module, configured as follows: The complete expression corresponding to the expression to be processed is converted into a first syntax tree, and the shortest legal sub-expression corresponding to the expression to be processed is determined based on the first syntax tree; the legality of the expression to be processed is determined based on the shortest legal sub-expression; if the expression to be processed is invalid, the shortest legal sub-expression is used to legalize the expression to be processed.
19. The data processing apparatus according to claim 18, characterized in that, The first debugging module is configured as follows: The expression to be processed is compared with the shortest legal subexpression; if the expression to be processed is the same as the shortest legal subexpression, then the expression to be processed is legal. If they do not match, then it is invalid.
20. The data processing apparatus according to claim 18, characterized in that, The first debugging module is configured as follows: The expression to be processed is matched with the original expression corresponding to the node in the first syntax tree; the original expression is the expression of the node in the complete expression; the shortest original expression including the expression to be processed is determined as the shortest legal subexpression.
21. The data processing apparatus according to claim 14, characterized in that, The acquisition module is configured as follows: The input data is obtained from the parameter value area in the debugging interface, and the input data is used as the sample data.
22. The data processing apparatus according to claim 21, characterized in that, The data processing device further includes a data update module, configured as follows: In response to the operation of modifying the expression to be processed in the expression detection area, if a change is detected in the basic field of the expression to be processed, the corresponding field list in the parameter value area is updated according to the changed basic field to re-acquire the sample data of the changed basic field.
23. The data processing apparatus according to claim 14, characterized in that, The acquisition module is configured as follows: The sample data is obtained from a local data source; the local data source includes a preset number of sample data entries.
24. The data processing apparatus according to claim 23, characterized in that, The acquisition module is configured as follows: In response to a trigger operation on the data replacement control associated with the parameter value range, the sample data is retrieved again from the local data source.
25. The data processing apparatus according to claim 14, characterized in that, The second debugging module is configured as follows: Obtain the attribute information of the nodes of the second syntax tree; the nodes of the second syntax tree include at least one of the function nodes, the field nodes, and the constant nodes; generate the calculation process information based on the attribute information of the nodes of the second syntax tree; The hierarchical relationship of the calculation process information corresponds to the parent-child relationship of function nodes in the second syntax tree.
26. The data processing apparatus according to claim 14, characterized in that, The second debugging module is configured as follows: In response to the debugging operation on the expression to be processed, the debugged expression to be processed is recalculated.
27. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 13.
28. An electronic device, characterized in that, include: processor; as well as A memory for storing executable instructions of the processor; wherein the processor is configured to perform the method of any one of claims 1 to 13 by executing the executable instructions.
Citation Information
Patent Citations
Expression processing method, apparatus and terminal
CN107797963A
Data processing method and device, storage medium and electronic device
CN110941634A