Indicator processing methods, devices and storage media
By parsing the indicator configuration table to generate a weighted dependency topology graph and target execution chain, and by using bytecode functions, the problem of poor flexibility in the calculation of derived indicators in existing technologies is solved, and flexible adjustment and efficient calculation are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- INDUSTRIAL AND COMMERCIAL BANK OF CHINA
- Filing Date
- 2026-03-19
- Publication Date
- 2026-07-31
AI Technical Summary
In existing technologies, the calculation of derived indicators often adopts hard coding or static configuration methods, resulting in poor flexibility, high iteration costs, and an inability to flexibly adjust dimension combinations and dependencies.
By receiving the indicator configuration table, the weighted indicator calculation dependency topology graph is parsed, the target execution chain is generated, and the derived indicator results are obtained using bytecode functions, thus avoiding hard-coded modifications.
It enables flexible adjustment of dimension sets and dependencies without modifying the code, improving the flexibility and efficiency of derived metric calculation.
Smart Images

Figure CN122489113A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of financial technology, and more specifically, to an indicator processing method, apparatus, and storage medium. Background Technology
[0002] Derivative indicators refer to composite business indicators calculated based on original business data through mathematical formulas, time windows, or dimensional aggregation, such as year-on-year, month-on-month, cumulative values, and percentages. They are key data processing procedures for financial risk control, data analysis, and data-driven decision-making.
[0003] However, in existing technologies, the calculation of derived indicators is mostly implemented using hard-coding or static configuration. Each indicator requires separate calculation logic, dependencies are statically bound via annotations, and dimension combinations are limited to fixed fields. Therefore, adding or modifying indicators requires modifying the code for calculating derived indicators, and the application must be redeployed based on the modified code. This approach leads to rigid indicator processing, high iteration costs, and significantly reduces the flexibility of derived indicator calculation.
[0004] There is currently no effective solution to the problem of poor flexibility in calculating derived indicators in related technologies. Summary of the Invention
[0005] The main objective of this application is to provide an index processing method, apparatus, and storage medium to solve the problem of poor flexibility in calculating derived indices in related technologies.
[0006] To achieve the above objectives, according to one aspect of this application, an indicator processing method is provided. The method includes: receiving an indicator configuration table and parsing the indicator configuration table to obtain a weighted indicator calculation dependency topology graph, wherein the indicator configuration table includes at least multiple derived indicators and the corresponding expression, dimension set, and dependency relationship for each derived indicator; generating a target execution chain based on the indicator calculation dependency topology graph, wherein the target execution chain includes multiple nodes, and the node information of each node includes at least an indicator calculation task; determining bytecode functions based on each indicator calculation task in the target execution chain, and determining the calculation context corresponding to the dimension set based on the dimension set; and calling the bytecode functions according to the target execution chain and the calculation context to obtain the target results corresponding to the multiple derived indicators using the bytecode functions.
[0007] Furthermore, the indicator configuration table is parsed to obtain a weighted indicator calculation dependency topology graph, which includes: extracting derived indicators, expressions, dimension sets, and dependencies from the indicator configuration table; determining variable reference relationships and built-in function reference relationships based on the expressions, and generating supplementary dependency information based on these relationships; supplementing the dependencies based on the supplementary information to determine the target dependency relationship, and using derived indicators as nodes and target dependencies as edges to generate an initial dependency topology graph; and weighting the nodes in the initial dependency topology graph to obtain a weighted indicator calculation dependency topology graph.
[0008] Furthermore, generating the target execution chain based on the indicator calculation dependency topology graph includes: determining the preset connected components in the indicator calculation dependency topology graph, and determining the cyclic dependency edges based on the preset connected components; breaking the cyclic dependency edges according to the weights to obtain an acyclic graph corresponding to the indicator calculation dependency topology graph; arranging all nodes in the acyclic graph in sequence to obtain the arrangement result; and determining the target execution chain based on the arrangement result.
[0009] Further, determining the target execution chain based on the permutation results includes: combining every two adjacent nodes in the permutation results to obtain multiple candidate groups, inputting the multiple candidate groups into the merging decision model, outputting a merging suggestion matrix corresponding to the multiple candidate groups based on the merging decision model, wherein the merging suggestion matrix is used to represent the probability value of merging every two adjacent nodes; determining the target merging threshold according to the business type corresponding to the indicator configuration table, and merging the nodes in the permutation results based on the merging suggestion matrix and the target merging threshold to obtain the target execution chain.
[0010] Furthermore, the training steps of the merge decision model include: extracting historical task execution information from the target log, and determining multiple candidate sample groups based on the historical task execution information, wherein each candidate sample group includes two sample nodes; determining the merge benefit of each candidate sample group, and determining the merge label of the candidate sample group based on the merge benefit and the data source of the sample nodes; training the preset neural network model based on the multiple candidate sample groups and the merge label of each candidate sample group to obtain the merge decision model.
[0011] Furthermore, determining the bytecode function based on the calculation tasks of each indicator in the target execution chain includes: parsing the expressions corresponding to each calculation task in the target execution chain to obtain an abstract syntax tree; compiling the expressions into bytecode classes based on the abstract syntax tree; and caching the bytecode classes in a memory cache pool to obtain the bytecode function.
[0012] Furthermore, determining the computational context corresponding to the dimension set based on the dimension set includes: generating a grouping key for the database query based on the dimension set, and extracting the original data corresponding to the grouping key from the target database, wherein the original data includes at least the original indicator values; generating a multidimensional mapping structure with dimension combinations as key names and original indicator values as key values based on the grouping key and the original data, wherein the dimension combination refers to the result after instantiating the dimension set based on the original data; and determining the computational context based on the multidimensional mapping structure.
[0013] To achieve the above objectives, according to another aspect of this application, an indicator processing apparatus is provided. The apparatus includes: a configuration parsing unit, configured to receive an indicator configuration table and parse the indicator configuration table to obtain a weighted indicator calculation dependency topology graph, wherein the indicator configuration table includes at least multiple derived indicators and an expression, dimension set, and dependency relationship corresponding to each derived indicator; an execution chain generation unit, configured to generate a target execution chain based on the indicator calculation dependency topology graph, wherein the target execution chain includes multiple nodes, and the node information of each node includes at least an indicator calculation task; a function determination unit, configured to determine bytecode functions based on each indicator calculation task in the target execution chain, and determine the calculation context corresponding to the dimension set based on the dimension set; and a result acquisition unit, configured to call the bytecode functions according to the target execution chain and the calculation context to obtain the target results corresponding to multiple derived indicators using the bytecode functions.
[0014] Furthermore, the configuration parsing unit includes: an information extraction module, used to extract derived indicators, expressions, dimension sets, and dependencies from the indicator configuration table; a supplementary information determination module, used to determine variable reference relationships and built-in function reference relationships based on expressions, and generate dependency supplementary information based on variable reference relationships and built-in function reference relationships; a topology graph generation module, used to supplement dependencies based on dependency supplementary information to determine target dependencies, and generate an initial dependency topology graph with derived indicators as nodes and target dependencies as edges; and a weight labeling module, used to label the nodes in the initial dependency topology graph with weights to obtain a weighted indicator calculation dependency topology graph.
[0015] Furthermore, the execution chain generation unit includes: a dependency edge determination module, used to determine the preset connected components in the index calculation dependency topology graph, and determine the cyclic dependency edges based on the preset connected components; an acyclic graph generation module, used to disconnect the cyclic dependency edges according to the weights, to obtain an acyclic graph corresponding to the index calculation dependency topology graph; an arrangement result acquisition module, used to arrange all nodes in the acyclic graph in order to obtain the arrangement result; and a target execution chain determination module, used to determine the target execution chain based on the arrangement result.
[0016] Furthermore, the target execution chain determination module includes: a merging decision submodule, used to combine every two adjacent nodes in the permutation result to obtain multiple candidate groups, and input the multiple candidate groups into the merging decision model respectively, and output a merging suggestion matrix corresponding to the multiple candidate groups based on the merging decision model, wherein the merging suggestion matrix is used to represent the probability value of merging every two adjacent nodes; and a node merging submodule, used to determine the target merging threshold according to the business type corresponding to the indicator configuration table, and merge the nodes in the permutation result according to the merging suggestion matrix and the target merging threshold to obtain the target execution chain.
[0017] Furthermore, the device also includes: a sample acquisition unit, used to extract historical task execution information from the target log and determine multiple candidate sample groups based on the historical task execution information, wherein each candidate sample group includes two sample nodes; a label determination unit, used to determine the merging benefit of each candidate sample group and determine the merging label of the candidate sample group based on the merging benefit and the data source of the sample nodes; and a model training unit, used to train a preset neural network model based on multiple candidate sample groups and the merging label of each candidate sample group to obtain a merging decision model.
[0018] Furthermore, the function determination unit includes: a syntax parsing module, used to parse the expressions corresponding to each index calculation task in the target execution chain to obtain an abstract syntax tree; a compilation module, used to compile the expressions into bytecode classes based on the abstract syntax tree; and a caching module, used to cache the bytecode classes in a memory cache pool to obtain bytecode functions.
[0019] Furthermore, the function determination unit includes: a raw data extraction module, used to generate a grouping key for the database query based on the dimension set, and extract raw data corresponding to the grouping key from the target database, wherein the raw data includes at least raw indicator values; a mapping structure generation module, used to generate a multidimensional mapping structure with dimension combinations as key names and raw indicator values as key values based on the grouping key and the raw data, wherein the dimension combination refers to the result after instantiating the dimension set based on the raw data; and a context determination module, used to determine the computational context based on the multidimensional mapping structure.
[0020] According to another aspect of this application, a computer-readable storage medium is provided, which includes a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform any index processing method.
[0021] According to another aspect of this application, an electronic device is provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include methods for performing any kind of index processing.
[0022] According to another aspect of this application, a computer program product is provided, including computer instructions, which, when executed by a processor, implement the steps of the index processing method described above.
[0023] In this embodiment, by receiving and parsing an indicator configuration table, a weighted indicator calculation dependency topology graph is obtained. The indicator configuration table includes at least multiple derived indicators and their corresponding expressions, dimension sets, and dependencies. A target execution chain is generated based on the indicator calculation dependency topology graph. This target execution chain includes multiple nodes, and each node's information includes at least the indicator calculation task. Bytecode functions are determined based on each indicator calculation task in the target execution chain, and a calculation context corresponding to the dimension set is determined based on the dimension set. The bytecode functions are called according to the target execution chain and the calculation context to obtain the target results corresponding to multiple derived indicators. This solves the technical problem of poor flexibility in calculating derived indicators in the prior art.
[0024] By parsing the configuration table to construct a weighted topology graph for metric calculation, the dimension set, expressions, and dependencies can be flexibly adjusted based on the configuration table without modifying any code. When the configuration changes, the corresponding target execution chain can be generated based on the configuration table and the path of the metric calculation dependency topology graph, and the corresponding bytecode function and calculation context can be determined. There is no need to hardcode or re-modify the code for calculating derived metrics, thus improving the flexibility of calculating derived metrics. Attached Figure Description
[0025] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0026] Figure 1 A hardware structure block diagram of a computer terminal for implementing an index processing method is shown.
[0027] Figure 2 This is a flowchart of the index processing method provided according to the embodiments of this application;
[0028] Figure 3 This is a schematic diagram of an index processing device provided according to an embodiment of this application;
[0029] Figure 4 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation
[0030] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0031] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0032] It should be noted that the information collected in this application (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) are information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of this data all comply with relevant laws, regulations, and standards, necessary confidentiality measures have been taken, and they do not violate public order and good morals. Corresponding access points are provided for users to choose to authorize or refuse. For example, interfaces are set up between this system and relevant users or organizations, providing users with corresponding access points to choose to agree to or refuse automated decision-making results; if the user chooses to refuse, the process proceeds to the expert decision-making stage.
[0033] Example 1
[0034] According to an embodiment of this application, a method embodiment for index processing is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0035] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware block diagram of a computer terminal (or mobile device) for implementing an index processing method is shown. Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) 102 (processor 102 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0036] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0037] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the indicator processing method in the embodiments of this application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby realizing the above-mentioned indicator processing method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0038] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0039] The display may be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10 (or mobile device).
[0040] Under the aforementioned operating environment, this application provides the following: Figure 2 The indicator processing method is shown. Figure 2 This is a flowchart of the index processing method according to Embodiment 1 of this application.
[0041] Step S201: Receive the indicator configuration table and parse the indicator configuration table to obtain a weighted indicator calculation dependency topology graph. The indicator configuration table includes at least multiple derived indicators and the expression, dimension set and dependency relationship corresponding to each derived indicator.
[0042] Optionally, the indicator configuration table can be a pre-configured structured data file. The indicator configuration table includes at least multiple derived indicators (i.e., the specific names of the derived indicators), the expression (i.e., the formula expression) for each derived indicator, a set of dimensions (e.g., year, month, region), and dependencies (e.g., annual cumulative sales dependent on monthly sales). In this embodiment, if it is necessary to add a new derived indicator or modify an existing one, only the modified indicator configuration table needs to be received. Subsequent steps can then be automatically calculated based on the modified indicator configuration table, eliminating the need for coding and shortening the development cycle.
[0043] Optionally, the configuration table can be configured using YAML (a lightweight data serialization format). In this case, a parser can read the contents of the configuration table, parse the expressions to generate an abstract syntax tree, and construct directed edges based on dependencies to generate an initial topology graph. Alternatively, the configuration table can be a table structure, with each row corresponding to a derived metric. Columns include the metric name, formula expression, dimension, dependency, weight, etc. The table can be read, and regular expressions can be used to extract functions and variables from the formula expressions. Based on the functions and variables combined with dependencies, target dependencies can be constructed to generate the initial topology graph. Based on the initial topology graph, weights can be labeled for each node in the initial topology graph to obtain a weighted metric calculation dependency topology graph.
[0044] Optionally, in this embodiment, the metric calculation dependency topology graph is a directed graph composed of nodes (i.e., derived metrics) and directed edges (i.e., dependencies). For example, a path from A to B indicates that the calculation of B depends on the result of A. Weights are numerical values that need to be added to each node. These weights are used to determine which edge to disconnect when a circular dependency is detected, ensuring that the topology graph can be converted into an acyclic graph and avoiding computational deadlock.
[0045] Step S202: Generate a target execution chain based on the indicator calculation dependency topology graph, wherein the target execution chain includes multiple nodes, and the node information of each node includes at least the indicator calculation task.
[0046] Optionally, the target execution chain can be a linear task sequence, where each node's node information includes at least one executable metric calculation task. In addition, the node information may also include the expression (derived from the configuration table) corresponding to the metric calculation task, the dimension set, dependencies, etc.
[0047] It should be noted that when there are dependency constraints between different nodes, the order in the sequence can be determined based on the dependency. However, for two nodes that do not have dependency constraints, the original order in the configuration table can be used as the order in the linear task sequence (these nodes can be merged later based on the merge decision model).
[0048] Step S203: Determine the bytecode function based on the calculation tasks of each indicator in the target execution chain, and determine the calculation context corresponding to the dimension set based on the dimension set.
[0049] Optionally, a bytecode function refers to a Java (a programming language) bytecode class that dynamically compiles an expression into an executable bytecode class. The computation context refers to the structured data input environment formed after dimension aggregation, which serves as the input source for the bytecode function and is used to determine the grouping dimension information required for the calculation of derived indicators.
[0050] For example, a compiler can be used to parse the expression string into an abstract syntax tree, and then compile it into a Java class that implements the `evaluate` interface. This class is generated and cached in the memory pool on the first call, and subsequent calls can be made directly without recompilation. A `GROUP BY` clause (a type of database query statement) is generated based on the dimension set to retrieve the original data from the target database. Based on the original data, the original indicator values are determined, and key-value pairs of dimension combinations and original indicator values are constructed as the computation context for the input of the bytecode function. It should be noted that a dimension combination refers to the result of instantiating the dimension set based on the original data; the dimension set is also the calculation rule template for the dimension combination. For example, if the dimension set defines the attributes [year, month, region], then the dimension combination could be [2026, 2, East China].
[0051] Step S204: Invoke the bytecode function according to the target execution chain and computation context to obtain the target results corresponding to multiple derived indicators using the bytecode function.
[0052] Optionally, for each node in the target execution chain, bytecode functions can be called sequentially based on the node information and the computation context can be injected into the bytecode functions to calculate the target results corresponding to all derived metrics.
[0053] In summary, by parsing the configuration table to construct a weighted topology graph for metric calculation, the dimension set, expressions, and dependencies can be flexibly adjusted based on the configuration table without modifying any code. When the configuration changes, the corresponding target execution chain can be generated based on the configuration table and the path of the metric calculation dependency topology graph, and the corresponding bytecode function and calculation context can be determined without hardcoding or re-modifying the code for calculating derived metrics. Therefore, the flexibility of calculating derived metrics is improved.
[0054] To improve the flexibility of calculating derived metrics, optionally, the metric configuration table is parsed to obtain a weighted metric calculation dependency topology graph, including: extracting derived metrics, expressions, dimension sets, and dependencies from the metric configuration table; determining variable reference relationships and built-in function reference relationships based on the expressions, and generating dependency supplementary information based on the variable reference relationships and built-in function reference relationships; supplementing the dependencies based on the dependency supplementary information to determine the target dependency relationship, and generating an initial dependency topology graph with derived metrics as nodes and target dependencies as edges; and weighting the nodes in the initial dependency topology graph to obtain a weighted metric calculation dependency topology graph.
[0055] Optionally, derived metrics are business metrics calculated from the original data, expressions are formulas, dimension sets are the grouping dimension combinations on which the derived metrics are based (e.g., year, month, region, etc.), and dependencies refer to direct references of the metric to other metrics or the original data source. By constructing a syntax tree corresponding to the expression and recursively traversing the nodes in the syntax tree, all variable references and function call information can be identified. Built-in function references can be determined based on the function call information. Variable references refer to the metric names or field names appearing in the expression, while built-in function references refer to the functions called in the expression (e.g., OVER or LAG functions, which contain dependencies on other data). Therefore, supplementing the dependency information with additional dependency information can yield a more complete target dependency relationship. For example, if the dependency relationship is C depending on A, after expression parsing, if A contains LAG(B, 1), then the supplementary dependency information is determined to be A depending on B (lagging by 1 period), forming a complete path where C depends on A and A depends on B. Nodes are derived metrics, and edges are dependencies, generating an initial dependency topology graph of a labeled directed graph. The weight of each node can be labeled based on the score, which can be a weighted sum of data freshness and business priority (e.g., 0.6 × data freshness + 0.4 × business priority). Data freshness refers to the update frequency of the data on which the derived indicator depends, and business priority is labeled by the operations personnel in the configuration table.
[0056] In summary, this method extracts derived metrics, expressions, dimension sets, and dependencies from the metric configuration table; determines variable reference relationships and built-in function reference relationships based on the expressions, and generates supplementary dependency information based on these relationships; supplements the dependencies based on this supplementary information to determine target dependencies, and generates an initial dependency topology graph by using derived metrics as nodes and target dependencies as edges; and weights the nodes in the initial dependency topology graph to obtain a weighted metric calculation dependency topology graph, thus improving the flexibility of calculating derived metrics.
[0057] To improve the flexibility of calculating derived metrics, optionally, generating a target execution chain based on the metric calculation dependency topology graph includes: determining a preset connected component in the metric calculation dependency topology graph, and determining cyclic dependent edges based on the preset connected components; breaking the cyclic dependent edges according to their weights to obtain an acyclic graph corresponding to the metric calculation dependency topology graph; arranging all nodes in the acyclic graph in sequence to obtain the arrangement result; and determining the target execution chain based on the arrangement result.
[0058] Optionally, the strongly connected component analysis of the topology graph dependent on the index calculation can be performed based on the Tarjan algorithm (a graph theory algorithm). A predefined connected component is defined as a component containing two or more nodes with cyclic dependencies between them (e.g., A points to B, B points to C, C points to A, meaning B depends on A, C depends on B, and A depends on C). The nodes involved in this predefined connected component are then identified as cyclic dependency regions, and all edges within them are cyclic dependency edges. For any given predefined connected component with multiple cyclic dependency edges, the following operations can be performed: obtain the weight of the node pointed to by each cyclic dependency edge (e.g., the edge from X to Y corresponds to the weight of node Y), and disconnect the cyclic dependency edge with the smallest weight, retaining the high-value dependency path. After performing the above operations on each predefined connected component, an acyclic graph is obtained. Algorithms such as Kahn (a greedy algorithm based on in-degree) can be used to perform topological sorting on all nodes in the acyclic graph to obtain the sorting result, which can be directly determined as the target execution chain.
[0059] In summary, by determining the preset connected components in the topology graph that the index calculation depends on, and determining the cyclic dependent edges based on the preset connected components; breaking the cyclic dependent edges according to the weights, an acyclic graph corresponding to the topology graph that the index calculation depends on is obtained; arranging all nodes in the acyclic graph in sequence, the arrangement result is obtained; and determining the target execution chain based on the arrangement result, the flexibility of calculating derived indices is improved.
[0060] To improve the efficiency of calculating derived indicators, optionally, determining the target execution chain based on the permutation results includes: combining every two adjacent nodes in the permutation results to obtain multiple candidate groups, inputting the multiple candidate groups into the merging decision model, outputting a merging suggestion matrix corresponding to the multiple candidate groups based on the merging decision model, wherein the merging suggestion matrix is used to represent the probability value of merging every two adjacent nodes; determining the target merging threshold according to the business type corresponding to the indicator configuration table, and merging the nodes in the permutation results based on the merging suggestion matrix and the target merging threshold to obtain the target execution chain.
[0061] Optionally, for the permutation result [A, B, C, D, E], where each node depends on the previous node, adjacent nodes can be extracted to obtain tuples (A, B), (B, C), (C, D), and (D, E). Candidate groups characterize potential options for merging the indicator calculation tasks of these two adjacent nodes into one node. They are the smallest input unit for the merge decision. Combining only adjacent nodes to construct candidate groups ensures that the topological order constraint is maintained after merging, avoiding disruption of dependencies. The merge decision model predicts the probability of merging two adjacent nodes into one task. The merge suggestion matrix refers to the probability of merging two adjacent nodes in all candidate groups. For example, the merge suggestion matrix could be [[A,B,0.92], [B,C,0.31], [C,D,0.87], [D,E,0.53]]. The target merge threshold can be a threshold corresponding to the business type in the configuration table. For example, the business type could be risk management, operational analysis, etc., with different target merge thresholds for different business types. Assuming the target merging threshold is 0.90, nodes A and B in the previous example should be merged into a new task, which is expressed as the parallel computation of the index calculation tasks of the two original nodes.
[0062] Optionally, for any candidate group, feature engineering can be performed on the node information of its two nodes to obtain multiple features, and these multiple features can be input into the merged decision model. Feature engineering can involve obtaining the corresponding computational complexity score (e.g., it can be obtained by statistically counting the number of nested formulas, the number of function calls, and the number of operators, adding 1 for each nested level, each function call, and each operator), the number of dimension combination levels (e.g., the number of dimension combination levels for [year, month, region] is 3), whether they come from the same data source (Boolean value), and whether the dimension sets are completely consistent (Boolean value).
[0063] In summary, by combining every two adjacent nodes in the permutation results to obtain multiple candidate groups, and inputting these candidate groups into the merging decision model, the model outputs a merging suggestion matrix corresponding to each candidate group. This matrix represents the probability of merging every two adjacent nodes. The target merging threshold is determined based on the business type corresponding to the indicator configuration table. Then, the nodes in the permutation results are merged according to the merging suggestion matrix and the target merging threshold to obtain the target execution chain. This achieves automatic merging of indicator calculation tasks, reduces the number of data scans, and improves the efficiency of calculating derived indicators.
[0064] To improve the accuracy of the merging decision model, the training steps of the merging decision model may optionally include: extracting historical task execution information from the target log, and determining multiple candidate sample groups based on the historical task execution information, wherein each candidate sample group includes two sample nodes; determining the merging benefit of each candidate sample group, and determining the merging label of the candidate sample group based on the merging benefit and the data source of the sample nodes; and training a preset neural network model based on the multiple candidate sample groups and the merging label of each candidate sample group to obtain the merging decision model.
[0065] Optionally, the target log, i.e., the execution log of the metric calculation tasks recorded in the production environment, can consist of two adjacent metric calculation tasks forming a sample pair, used to train the model to determine whether these two tasks should be merged. The merging benefit refers to the quantified value of system resources or time saved compared to independent execution after merging two tasks into one execution unit. For example, the merging benefit can be the weighted sum of the reduction rate in execution time and the reduction in the number of data scans. The merging benefit can be determined through simulation calculation. If the merging benefit is greater than the preset benefit and the two sample nodes have a merging basis (i.e., the two sample nodes have the same data source and there are no cross-node references between their formulas), the merging label can be set to 1; otherwise, the merging label can be set to 0. The preset neural network model can be a multilayer perceptron. Feature engineering can be referenced above to extract feature vectors from the sample nodes. The multilayer perceptron can include an input layer, a first hidden layer, a second hidden layer, and an output layer. The training parameters can use the Adam optimizer, a batch size of 64, and K-fold cross-validation, thereby training the model to obtain the merging decision model.
[0066] In summary, by extracting historical task execution information from the target log and determining multiple candidate sample groups based on this information, with each candidate sample group including two sample nodes, the merging benefit of each candidate sample group is determined, and the merging label of the candidate sample group is determined based on the merging benefit and the data source of the sample nodes. The preset neural network model is trained based on the multiple candidate sample groups and the merging label of each candidate sample group to obtain the merging decision model, thereby improving the accuracy of the merging decision model.
[0067] To improve the flexibility of calculating derived metrics, optionally, determining the bytecode function based on the metric calculation tasks in the target execution chain includes: parsing the expressions corresponding to the metric calculation tasks in the target execution chain to obtain an abstract syntax tree; compiling the expressions into bytecode classes based on the abstract syntax tree; and caching the bytecode classes in a memory cache pool to obtain the bytecode function.
[0068] Optionally, the target execution chain also stores the expressions corresponding to the indicator calculation tasks. These expressions can be parsed to generate an abstract syntax tree (AST). An AST is a tree-like representation of the expression, where nodes represent operators, functions, variables, and other syntactic components, and leaf nodes are constants or variable references. A bytecode class is a Java class generated through dynamic compilation. This class contains one or more static methods that can receive input parameters, execute expression logic, and return the calculation result. A lightweight compiler can be used to convert the AST into a Java source code string and then compile the source code string into a bytecode class. A memory cache pool is used to cache compiled bytecode class objects. Bytecode functions are static methods in bytecode classes that are cached in memory and can be directly called.
[0069] In summary, by parsing the expressions corresponding to the calculation tasks of each indicator in the target execution chain, an abstract syntax tree is obtained; based on the abstract syntax tree, the expressions are compiled into bytecode classes; and the bytecode classes are cached in the memory cache pool to obtain bytecode functions, which improves the flexibility of calculating derived indicators.
[0070] To improve the flexibility of calculating derived indicators, optionally, determining the computational context corresponding to the dimension set based on the dimension set includes: generating a grouping key for a database query based on the dimension set, and extracting the original data corresponding to the grouping key from the target database, wherein the original data includes at least the original indicator values; generating a multidimensional mapping structure with dimension combinations as keys and original indicator values as keys based on the grouping key and the original data, wherein the dimension combination refers to the result after instantiating the dimension set based on the original data; and determining the computational context based on the multidimensional mapping structure.
[0071] Optionally, the grouping key refers to the column combination of the GROUP BY clause in the database query language. It can extract the finest-grained raw data (which may include field names and raw indicator values) corresponding to the grouping key from the target database. The multidimensional mapping structure refers to a nested key-value structure, in which the key name is composed of dimension combinations and the key value is the raw indicator value. The multidimensional mapping structure and dimension set are encapsulated to obtain the calculation context.
[0072] In summary, by generating grouping keys for database queries based on the dimension set and extracting the original data corresponding to the grouping keys from the target database (where the original data includes at least the original indicator values), a multidimensional mapping structure is generated based on the grouping keys and the original data, with dimension combinations as keys and original indicator values as keys. Here, dimension combinations refer to the result of instantiating the dimension set based on the original data. The computational context is determined based on the multidimensional mapping structure, which improves the flexibility of calculating derived indicators.
[0073] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0074] Example 2
[0075] This application also provides an indicator processing device. It should be noted that the indicator processing device of this application can be used to execute the indicator processing method provided in this application. The indicator processing device provided in this application is described below.
[0076] According to an embodiment of this application, an apparatus for implementing the above-described index processing method is also provided, such as... Figure 3 As shown, the device includes:
[0077] The configuration parsing unit 301 is used to receive the indicator configuration table and parse the indicator configuration table to obtain a weighted indicator calculation dependency topology graph. The indicator configuration table includes at least multiple derived indicators and the expression, dimension set and dependency relationship corresponding to each derived indicator.
[0078] The execution chain generation unit 302 is used to generate a target execution chain based on the indicator calculation dependency topology graph. The target execution chain includes multiple nodes, and the node information of each node includes at least the indicator calculation task.
[0079] The function determination unit 303 is used to determine the bytecode function based on the calculation tasks of each indicator in the target execution chain, and to determine the calculation context corresponding to the dimension set based on the dimension set.
[0080] The result acquisition unit 304 is used to call bytecode functions based on the target execution chain and computation context in order to obtain the target results corresponding to multiple derived indicators using bytecode functions.
[0081] The indicator processing apparatus provided in this application embodiment receives an indicator configuration table through a configuration parsing unit 301 and parses the indicator configuration table to obtain a weighted indicator calculation dependency topology graph. The indicator configuration table includes at least multiple derived indicators and their corresponding expressions, dimension sets, and dependencies. An execution chain generation unit 302 generates a target execution chain based on the indicator calculation dependency topology graph. The target execution chain includes multiple nodes, and each node's information includes at least the indicator calculation task. A function determination unit 303 determines the bytecode function based on each indicator calculation task in the target execution chain and determines the calculation context corresponding to the dimension set. A result acquisition unit 304 calls the bytecode function according to the target execution chain and the calculation context to obtain the target results corresponding to multiple derived indicators using the bytecode function. This solves the problem of poor flexibility in calculating derived indicators in related technologies, thereby improving the flexibility of calculating derived indicators.
[0082] Optionally, in the indicator processing apparatus provided in this application embodiment, the configuration parsing unit 301 includes: an information extraction module, used to extract derived indicators, expressions, dimension sets, and dependencies from the indicator configuration table; a supplementary information determination module, used to determine variable reference relationships and built-in function reference relationships based on the expressions, and generate dependency supplementary information based on the variable reference relationships and built-in function reference relationships; a topology graph generation module, used to supplement the dependencies based on the dependency supplementary information to determine the target dependency relationship, and use the derived indicators as nodes and the target dependency relationship as edges to generate an initial dependency topology graph; and a weight labeling module, used to label the nodes in the initial dependency topology graph with weights to obtain a weighted indicator calculation dependency topology graph.
[0083] Optionally, in the index processing apparatus provided in this application embodiment, the execution chain generation unit 302 includes: a dependency edge determination module, used to determine a preset connected component in the index calculation dependency topology graph, and determine cyclic dependency edges based on the preset connected component; an acyclic graph generation module, used to disconnect the cyclic dependency edges according to the weight, to obtain an acyclic graph corresponding to the index calculation dependency topology graph; an arrangement result acquisition module, used to arrange all nodes in the acyclic graph in order to obtain an arrangement result; and a target execution chain determination module, used to determine the target execution chain based on the arrangement result.
[0084] Optionally, in the indicator processing device provided in this application embodiment, the target execution chain determination module includes: a merging decision submodule, used to combine every two adjacent nodes in the arrangement result to obtain multiple candidate groups, and input the multiple candidate groups into the merging decision model respectively, and output a merging suggestion matrix corresponding to the multiple candidate groups according to the merging decision model, wherein the merging suggestion matrix is used to represent the probability value of merging every two adjacent nodes; and a node merging submodule, used to determine the target merging threshold according to the business type corresponding to the indicator configuration table, and merge the nodes in the arrangement result according to the merging suggestion matrix and the target merging threshold to obtain the target execution chain.
[0085] Optionally, in the indicator processing apparatus provided in this application embodiment, the apparatus further includes: a sample acquisition unit, used to extract historical task execution information from the target log and determine multiple candidate sample groups based on the historical task execution information, wherein each candidate sample group includes two sample nodes; a label determination unit, used to determine the merging benefit of each candidate sample group and determine the merging label of the candidate sample group based on the merging benefit and the data source of the sample nodes; and a model training unit, used to train a preset neural network model based on the multiple candidate sample groups and the merging label of each candidate sample group to obtain a merging decision model.
[0086] Optionally, in the index processing apparatus provided in this application embodiment, the function determination unit 303 includes: a syntax parsing module, used to perform syntax parsing on the expressions corresponding to each index calculation task in the target execution chain to obtain an abstract syntax tree; a compilation module, used to compile the expressions into bytecode classes based on the abstract syntax tree; and a caching module, used to cache the bytecode classes in a memory cache pool to obtain bytecode functions.
[0087] Optionally, in the indicator processing apparatus provided in this application embodiment, the function determination unit 303 includes: a raw data extraction module, used to generate a grouping key for a database query based on a dimension set, and extract raw data corresponding to the grouping key from the target database, wherein the raw data includes at least raw indicator values; a mapping structure generation module, used to generate a multidimensional mapping structure with dimension combinations as key names and raw indicator values as key values based on the grouping key and the raw data, wherein the dimension combination refers to the result after instantiating the dimension set based on the raw data; and a context determination module, used to determine the computational context based on the multidimensional mapping structure.
[0088] It should be noted that the configuration parsing unit 301, execution chain generation unit 302, function determination unit 303, and result acquisition unit 304 mentioned above correspond to steps S201 to S204 in Embodiment 1. The instances and application scenarios implemented by the units and corresponding steps are the same, but are not limited to the content disclosed in Embodiment 1. It should be noted that the above modules or units can be hardware or software components stored in memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). The above modules can also run as part of the device in the computer terminal 10 provided in Embodiment 1.
[0089] Example 3
[0090] Embodiments of this application may provide an electronic device. Figure 4 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 4 As shown, the electronic device may include: one or more ( Figure 4 (Only one is shown) Processor 402, memory 404, memory controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.
[0091] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and apparatus in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the above-described methods. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0092] The processor can access information and applications stored in memory via a transmission device to perform the following steps: receiving an indicator configuration table and parsing it to obtain a weighted indicator calculation dependency topology graph, wherein the indicator configuration table includes at least multiple derived indicators and the corresponding expression, dimension set, and dependency relationship for each derived indicator; generating a target execution chain based on the indicator calculation dependency topology graph, wherein the target execution chain includes multiple nodes, and the node information of each node includes at least the indicator calculation task; determining the bytecode function based on each indicator calculation task in the target execution chain, and determining the calculation context corresponding to the dimension set based on the dimension set; and calling the bytecode function according to the target execution chain and the calculation context to obtain the target results corresponding to multiple derived indicators using the bytecode function.
[0093] The processor can also access information and applications stored in memory via a transmission device to perform the following steps: extracting derived metrics, expressions, dimension sets, and dependencies from the metric configuration table; determining variable reference relationships and built-in function reference relationships based on the expressions, and generating dependency supplementary information based on the variable reference relationships and built-in function reference relationships; supplementing the dependencies based on the dependency supplementary information to determine the target dependencies, and generating an initial dependency topology graph with derived metrics as nodes and target dependencies as edges; and weighting the nodes in the initial dependency topology graph to obtain a weighted metric calculation dependency topology graph.
[0094] The processor can also call the information and application programs stored in the memory through the transmission device to perform the following steps: determine the preset connected components in the index calculation dependency topology graph, and determine the cyclic dependent edges based on the preset connected components; disconnect the cyclic dependent edges according to the weights to obtain the acyclic graph corresponding to the index calculation dependency topology graph; arrange all nodes in the acyclic graph in order to obtain the arrangement result; and determine the target execution chain based on the arrangement result.
[0095] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: combine every two adjacent nodes in the permutation result to obtain multiple candidate groups, and input the multiple candidate groups into the merging decision model respectively. Based on the merging decision model, output the merging suggestion matrix corresponding to the multiple candidate groups. The merging suggestion matrix is used to represent the probability value of merging every two adjacent nodes; determine the target merging threshold according to the business type corresponding to the indicator configuration table, and merge the nodes in the permutation result according to the merging suggestion matrix and the target merging threshold to obtain the target execution chain.
[0096] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: extract historical task execution information from the target log, and determine multiple candidate sample groups based on the historical task execution information, wherein each candidate sample group includes two sample nodes; determine the merging benefit of each candidate sample group, and determine the merging label of the candidate sample group based on the merging benefit and the data source of the sample nodes; train a preset neural network model based on multiple candidate sample groups and the merging label of each candidate sample group to obtain a merging decision model.
[0097] The processor can also call the information and application programs stored in the memory through the transmission device to perform the following steps: perform syntax parsing on the expressions corresponding to each index calculation task in the target execution chain to obtain an abstract syntax tree; compile the expressions into bytecode classes based on the abstract syntax tree; cache the bytecode classes in the memory cache pool to obtain bytecode functions.
[0098] The processor can also invoke information and applications stored in memory via a transmission device to perform the following steps: generating a grouping key for a database query based on the dimension set, and extracting the original data corresponding to the grouping key from the target database, wherein the original data includes at least the original index values; generating a multidimensional mapping structure with dimension combinations as key names and original index values as key values based on the grouping key and the original data, wherein the dimension combination refers to the result after instantiating the dimension set based on the original data; and determining the computational context based on the multidimensional mapping structure.
[0099] This application provides a scheme for index processing. By receiving and parsing an index configuration table, a weighted index calculation dependency topology graph is obtained. The index configuration table includes at least multiple derived indices and their corresponding expressions, dimension sets, and dependencies. A target execution chain is generated based on the index calculation dependency topology graph. This target execution chain includes multiple nodes, and each node's information includes at least an index calculation task. Bytecode functions are determined based on each index calculation task in the target execution chain, and a calculation context corresponding to the dimension set is determined based on the dimension set. The bytecode functions are called according to the target execution chain and the calculation context to obtain the target results corresponding to multiple derived indices. This solves the technical problem of poor flexibility in calculating derived indices in the prior art.
[0100] Those skilled in the art will understand that Figure 4 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones, tablets, handheld computers, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 4 This does not limit the structure of the aforementioned electronic device. For example, electronic devices may also include components that are more... Figure 4 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 4 The different configurations shown.
[0101] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0102] Example 4
[0103] Embodiments of this application also provide a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the index processing method provided in Embodiment 1.
[0104] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.
[0105] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: receiving an indicator configuration table and parsing the indicator configuration table to obtain a weighted indicator calculation dependency topology graph, wherein the indicator configuration table includes at least multiple derived indicators and the expression, dimension set, and dependency relationship corresponding to each derived indicator; generating a target execution chain based on the indicator calculation dependency topology graph, wherein the target execution chain includes multiple nodes, and the node information of each node includes at least the indicator calculation task; determining bytecode functions according to each indicator calculation task in the target execution chain, and determining the calculation context corresponding to the dimension set according to the dimension set; calling the bytecode functions according to the target execution chain and the calculation context to obtain the target results corresponding to multiple derived indicators using the bytecode functions.
[0106] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: extracting derived metrics, expressions, dimension sets, and dependencies from the metric configuration table; determining variable reference relationships and built-in function reference relationships based on the expressions, and generating dependency supplementary information based on the variable reference relationships and built-in function reference relationships; supplementing the dependencies based on the dependency supplementary information to determine the target dependency relationship, and generating an initial dependency topology graph by using derived metrics as nodes and the target dependency relationship as edges; and weighting the nodes in the initial dependency topology graph to obtain a weighted metric calculation dependency topology graph.
[0107] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: determining a preset connected component in the index calculation dependency topology graph, and determining cyclic dependent edges based on the preset connected component; disconnecting the cyclic dependent edges according to the weights to obtain an acyclic graph corresponding to the index calculation dependency topology graph; arranging all nodes in the acyclic graph in sequence to obtain an arrangement result; and determining the target execution chain based on the arrangement result.
[0108] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: combining every two adjacent nodes in the permutation result to obtain multiple candidate groups, inputting the multiple candidate groups into the merging decision model respectively, outputting a merging suggestion matrix corresponding to the multiple candidate groups according to the merging decision model, wherein the merging suggestion matrix is used to represent the probability value of merging every two adjacent nodes; determining the target merging threshold according to the business type corresponding to the indicator configuration table, and merging the nodes in the permutation result according to the merging suggestion matrix and the target merging threshold to obtain the target execution chain.
[0109] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: extracting historical task execution information from the target log, and determining multiple candidate sample groups based on the historical task execution information, wherein each candidate sample group includes two sample nodes; determining the merging benefit of each candidate sample group, and determining the merging label of the candidate sample group based on the merging benefit and the data source of the sample nodes; training a preset neural network model based on the multiple candidate sample groups and the merging label of each candidate sample group to obtain a merging decision model.
[0110] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: parsing the expressions corresponding to each index calculation task in the target execution chain to obtain an abstract syntax tree; compiling the expressions into bytecode classes based on the abstract syntax tree; and caching the bytecode classes in a memory cache pool to obtain bytecode functions.
[0111] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: generating a grouping key for a database query based on a set of dimensions, and extracting original data corresponding to the grouping key from the target database, wherein the original data includes at least original index values; generating a multidimensional mapping structure with dimension combinations as key names and original index values as key values based on the grouping key and the original data, wherein the dimension combination refers to the result after instantiating the set of dimensions based on the original data; and determining the computational context based on the multidimensional mapping structure.
[0112] This application also provides a computer program product that, when executed on a data processing device, is suitable for performing index processing method steps.
[0113] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0114] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0115] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0116] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0117] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0118] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0119] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. An indicator processing method characterized by, include: Receive the indicator configuration table and parse the indicator configuration table to obtain a weighted indicator calculation dependency topology graph, wherein the indicator configuration table includes at least a number of derived indicators and the expression, dimension set and dependency relationship corresponding to each derived indicator; The target execution chain is generated based on the topology graph of the indicator calculation, wherein the target execution chain includes multiple nodes, and the node information of each node includes at least the indicator calculation task; The bytecode function is determined based on the indicator calculation tasks in the target execution chain, and the calculation context corresponding to the dimension set is determined based on the dimension set. The bytecode function is invoked according to the target execution chain and the computation context to obtain the target results corresponding to the multiple derived metrics using the bytecode function.
2. The method of claim 1, wherein, Parsing the indicator configuration table yields a weighted indicator calculation dependency topology graph, including: Extract the derived metrics, the expression, the dimension set, and the dependency relationships from the metric configuration table; The variable reference relationships and built-in function reference relationships are determined based on the expression, and dependency supplementary information is generated based on the variable reference relationships and the built-in function reference relationships; The dependency relationship is supplemented based on the dependency supplement information to determine the target dependency relationship, and the derived index is used as a node and the target dependency relationship is used as an edge to generate an initial dependency topology graph; The nodes in the initial dependency topology graph are labeled with weights to obtain the weighted index calculation dependency topology graph.
3. The method of claim 1, wherein, The calculation of the target execution chain based on the aforementioned metrics and the dependency topology graph includes: The calculation of the index depends on a preset connected component in the topology graph, and the cyclic dependent edges are determined based on the preset connected component. Based on the weights, the cyclic dependent edges are disconnected to obtain an acyclic graph corresponding to the topology graph of the index calculation dependency; Arrange all nodes in the acyclic graph in order to obtain the arrangement result; The target execution chain is determined based on the arrangement result.
4. The method of claim 3, wherein, The target execution chain is determined based on the arrangement result, including: The arrangement results are combined with each pair of adjacent nodes to obtain multiple candidate groups. The multiple candidate groups are then input into the merging decision model. The merging decision model outputs a merging suggestion matrix corresponding to the multiple candidate groups. The merging suggestion matrix is used to represent the probability value of merging each pair of adjacent nodes. The target merging threshold is determined based on the business type corresponding to the indicator configuration table, and the nodes in the arrangement result are merged according to the merging suggestion matrix and the target merging threshold to obtain the target execution chain.
5. The method of claim 4, wherein, The training steps for the merged decision model include: Historical task execution information is extracted from the target log, and multiple candidate sample groups are determined based on the historical task execution information, wherein each candidate sample group includes two sample nodes; Determine the merge payoff for each candidate sample group, and determine the merge label for the candidate sample group based on the merge payoff and the data source of the sample node; The preset neural network model is trained based on the multiple candidate sample groups and the merged label of each candidate sample group to obtain the merged decision model.
6. The method of claim 1, wherein, The bytecode functions determined based on the index calculation tasks in the target execution chain include: The expressions corresponding to each of the indicator calculation tasks in the target execution chain are parsed to obtain an abstract syntax tree; The expression is compiled into a bytecode class based on the abstract syntax tree. The bytecode class is cached in a memory cache pool to obtain the bytecode function.
7. The method according to claim 1, characterized in that, Determining the computational context corresponding to the dimension set based on the dimension set includes: Generate a grouping key for the database query based on the set of dimensions, and extract the original data corresponding to the grouping key from the target database, wherein the original data includes at least the original indicator values; A multidimensional mapping structure is generated based on the grouping key and the original data, with the dimension combination as the key name and the original index value as the key value, wherein the dimension combination refers to the result after the dimension set is instantiated based on the original data; The computational context is determined based on the multidimensional mapping structure.
8. An index processing device, characterized in that, include: A configuration parsing unit is configured to receive an indicator configuration table and parse the indicator configuration table to obtain a weighted indicator calculation dependency topology graph, wherein the indicator configuration table includes at least a number of derived indicators and the expression, dimension set and dependency relationship corresponding to each derived indicator; An execution chain generation unit is used to generate a target execution chain based on the indicator calculation dependency topology graph, wherein the target execution chain includes multiple nodes, and the node information of each node includes at least the indicator calculation task; The function determination unit is used to determine the bytecode function based on each of the indicator calculation tasks in the target execution chain, and to determine the calculation context corresponding to the dimension set based on the dimension set. The result acquisition unit is used to call the bytecode function according to the target execution chain and the computing context, so as to obtain the target results corresponding to the multiple derived indicators using the bytecode function.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored executable program, wherein, when the executable program is executed, it controls the device on which the computer-readable storage medium is located to perform the index processing method according to any one of claims 1 to 7.
10. An electronic device, characterized in that, include: Memory, which stores executable programs; A processor for running the program, wherein the program executes the index processing method according to any one of claims 1 to 7 when it runs.
11. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the steps of the index processing method according to any one of claims 1 to 7.