Variable data processing method and device, computer equipment and storage medium
By receiving variable acquisition requests, the target execution statement is queried and converted into logical relationship information representation and executable program code, which are directly executed in local memory. This solves the problem of low variable data processing efficiency in the existing technology and achieves efficient data processing. .
Patent Information
- Application Number
- CN202410359654.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-27
- Publication Date
- 2024-09-17
AI Technical Summary
Existing variable data processing methods cannot efficiently process variable data due to complex processes, resulting in low efficiency and inability to meet the needs of large amounts of data processing.
By receiving variable acquisition requests, the target execution statement is queried and converted into logical relationship information representation, and further converted into executable program code. The data to be processed is obtained from the preset data source and executed in local memory, reducing the impact on third-party caches. Dependencies reduce interactions between systems.
It improves the efficiency of variable data processing, reduces interactions between systems, and directly loads data into local memory, improving the efficiency of the data processing process.
Smart Images

Figure CN118656388A
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and in particular to a variable data processing method, apparatus, computer equipment, storage medium and computer program product. Background Art
[0002] With the booming economy, calculations on large amounts of variable data are more or less required in various fields.
[0003] At present, variable data is generally processed by using a distributed streaming computing engine method. Specifically, when a user receives a variable calculation request, the user parses the data identifier, user data dimension information, and SQL (Structured Query Language) statement parameter information to be calculated in the variable calculation request. Based on the parsed information, the data corresponding to the data identifier is captured from the data source of the third-party server, and the obtained data is pushed to the third-party cache. The data is then pulled from the third-party cache to the local memory of the server and a memory table is formed. Then, all variable SQL statements related to the user data dimension are obtained from the variable pool, and combined with SQL parameters into an executable SQL statement. The executable SQL statement is executed and runs on the memory table to output the calculation result value.
[0004] However, the above method cannot efficiently process variable data due to its complex process and large amount of data processing. A more efficient variable data processing method is urgently needed. Summary of the invention
[0005] Based on this, it is necessary to provide an efficient variable data processing method, device, computer equipment, computer-readable storage medium and computer program product to address the above technical problems.
[0006] In a first aspect, the present application provides a variable data processing method, comprising:
[0007] receiving a variable acquisition request, wherein the variable acquisition request includes a variable name;
[0008] Based on the variable name, query the target execution statement of the variable name, and convert the target execution statement into a corresponding logical relationship information representation;
[0009] Converting the logical relationship information representation into an executable program code, acquiring the data to be processed from a preset data source based on the executable program code, and loading the data to be processed into a local memory;
[0010] The executable program code is executed on the data to be processed in the local memory to obtain an execution result of the data to be processed, and the execution result is used as the target variable information of the variable name.
[0011] In a second aspect, the present application also provides a variable data processing device, comprising:
[0012] A request acquisition module, used for receiving a variable acquisition request, wherein the variable acquisition request includes a variable name;
[0013] A logic representation module, used to query a target execution statement of the variable name based on the variable name, and convert the target execution statement into a corresponding logic relationship information representation;
[0014] A data loading module, used to convert the logical relationship information representation into an executable program code, obtain the data to be processed from a preset data source based on the executable program code, and load the data to be processed into a local memory;
[0015] The data processing module is used to execute the executable program code on the data to be processed in the local memory, obtain the execution result of the data to be processed, and use the execution result as the target variable information of the variable name.
[0016] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0017] receiving a variable acquisition request, wherein the variable acquisition request includes a variable name;
[0018] Based on the variable name, query the target execution statement of the variable name, and convert the target execution statement into a corresponding logical relationship information representation;
[0019] Converting the logical relationship information representation into an executable program code, acquiring the data to be processed from a preset data source based on the executable program code, and loading the data to be processed into a local memory;
[0020] The executable program code is executed on the data to be processed in the local memory to obtain an execution result of the data to be processed, and the execution result is used as the target variable information of the variable name.
[0021] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0022] receiving a variable acquisition request, wherein the variable acquisition request includes a variable name;
[0023] Based on the variable name, query the target execution statement of the variable name, and convert the target execution statement into a corresponding logical relationship information representation;
[0024] Converting the logical relationship information representation into an executable program code, acquiring the data to be processed from a preset data source based on the executable program code, and loading the data to be processed into a local memory;
[0025] The executable program code is executed on the data to be processed in the local memory to obtain an execution result of the data to be processed, and the execution result is used as the target variable information of the variable name.
[0026] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0027] receiving a variable acquisition request, wherein the variable acquisition request includes a variable name;
[0028] Based on the variable name, query the target execution statement of the variable name, and convert the target execution statement into a corresponding logical relationship information representation;
[0029] Converting the logical relationship information representation into an executable program code, acquiring the data to be processed from a preset data source based on the executable program code, and loading the data to be processed into a local memory;
[0030] The executable program code is executed on the data to be processed in the local memory to obtain an execution result of the data to be processed, and the execution result is used as the target variable information of the variable name.
[0031] The above-mentioned variable data processing method, device, computer equipment, storage medium and computer program product query the target execution statement of the variable name according to the variable name in the variable acquisition request, and convert the target execution statement into the logical relationship information representation of the target execution statement; then by converting the logical relationship information representation into an executable program code, and then based on the executable program code, obtain the data to be processed from the preset data source, execute the executable program code on the data to be processed in the local memory, obtain the execution result of the data to be processed, and use the execution result as the target variable information of the variable name. In the whole process, by obtaining the variable name, the corresponding target execution statement is efficiently queried, and the target execution statement is converted into the logical relationship information representation, which speeds up the efficiency of conversion into the executable program code. Further, by executing the executable program code, the data to be processed can be directly loaded into the local memory, without relying on the third-party cache to load the data to be processed from the data source of the third-party server into the local memory, reducing the interaction between systems, and after executing the executable program code on the data to be processed, the execution result of the data to be processed can be used as the target variable information of the variable name, which improves the efficiency of obtaining variable data in the variable data processing process. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0033] Figure 1 An application environment diagram of a variable data processing method in an embodiment;
[0034] Figure 2 A schematic diagram of a flow chart of a variable data processing method in one embodiment;
[0035] Figure 3 A schematic diagram of a process of converting a target SQL statement into an abstract syntax tree in one embodiment;
[0036] Figure 4 A schematic diagram of the structure of an abstract syntax tree representing preliminary logical relationship information in an embodiment;
[0037] Figure 5 A schematic diagram of the structure of an abstract syntax tree representing logical relationship information that satisfies a logical sequence rule in one embodiment;
[0038] Figure 6A schematic diagram of the structure of an abstract syntax tree corresponding to the logical relationship information before and after conversion based on cost optimization in one embodiment;
[0039] Figure 7 is a flow chart of a variable data processing method in another embodiment;
[0040] Figure 8 A schematic flow chart of a variable data processing method in yet another embodiment;
[0041] Fig. 9 is a structural block diagram of a variable data processing device in one embodiment;
[0042] Fig.10 is an internal structure diagram of a computer device in one embodiment;
[0043] Fig.11 FIG. 4 is a diagram showing the internal structure of a computer device in another embodiment. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0045] At present, in computer-related fields, especially in the field of Internet finance, a large amount of user variable information is often processed. For example, a risk control model can be used to process user variable information to obtain risk data of user variable information to evaluate users. Among them, user variable information can be calculated based on data of various dimensions of users. For example, user variable information can be the gender of user with ID A, or the age of user with ID A, etc.
[0046] The method of obtaining user variable data at present is: first store each dimension data of the user in a database, wherein the database may include but is not limited to databases such as MySQL, Oracle, Hbase, Redis, and then adopt traditional software development method or SAS system (Statistics Analysis System, data analysis system) to develop variable logic and calculate. For traditional software development method, in the process of variable calculation, it is necessary to go through multiple stages such as demand proposal, analysis and design, development, testing, production release, and the development cycle is long, and communication, development and maintenance costs are all relatively high, and it is far from meeting the development needs of a large number of newly added variables. If SAS system is used to calculate variables, it is also faced with the problems of non-scalability and insufficient computing power of stand-alone version. Therefore, traditional software development method or SAS system processing method cannot efficiently realize obtaining variable data.
[0047] Furthermore, taking the currently popular distributed streaming computing engine method for obtaining variable data as an example, specifically, the distributed streaming computing engine includes: a data source configuration module, a variable definition module, and a variable computing module.
[0048] In the data source configuration module, users can configure the data sources that various variables rely on for calculation;
[0049] In the variable definition module, users can use SQL (Structured Query Language) to develop various variables;
[0050] In the variable calculation module, the user receives a variable calculation request, parses the data identifier, user data dimension information, and SQL statement parameter information to be calculated in the variable calculation request, and based on the parsed information, grabs data from the data source of the third-party server and pushes it to the third-party cache. Then, according to the data structure information when the data source is configured, pulls data from the third-party cache, and uses the Apache Calcite dynamic data management framework to build the pulled data into the local memory of the server and form a memory table. Then, all variable SQL statements related to the user data dimension are obtained from the variable pool, and combined with SQL parameters into an executable SQL statement. By executing the executable SQL statement, it runs on the memory table and outputs the calculation result value, and assigns the calculated result value to the variable that needs to be calculated.
[0051] However, in the above solution, "grabbing data from the data source of the third-party server, pushing it to the third-party cache, and then pulling data from the third-party cache according to the data structure information when the data source is configured", it requires multiple interactions between systems, which is relatively complicated and cannot achieve efficient processing of variable data.
[0052] To this end, the present application provides a variable data processing method, which queries the target execution statement of the variable name according to the variable name in the variable acquisition request, and converts the target execution statement into a logical relationship information representation of the target execution statement; and then converts the logical relationship information representation into an executable program code, and then based on the executable program code, obtains the data to be processed from a preset data source, so that the data to be processed can be directly loaded into the local memory without relying on a third-party high-speed cache, which is conducive to reducing the interaction between systems, and after executing the executable program code on the data to be processed, the execution result of the data to be processed is used as the target variable information of the variable name, thereby improving the efficiency of the variable data processing process.
[0053] The variable data processing method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. Among them, the terminal 102 can be but is not limited to various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.
[0054] The caller's terminal and server can both independently execute the variable data processing method provided in the embodiments of the present application.
[0055] For example, the caller's terminal obtains and receives a variable acquisition request initiated by the caller, where the variable acquisition request includes a variable name; based on the variable name, a target execution statement of the variable name is queried, and the target execution statement is converted into a corresponding logical relationship information representation; the logical relationship information representation is converted into an executable program code, and based on the executable program code, the data to be processed is obtained from a preset data source, and the data to be processed is loaded into the local memory of the terminal; the executable program code is executed on the data to be processed in the local memory to obtain an execution result of the data to be processed, and the execution result is used as the target variable information of the variable name, and the target variable information is displayed to the caller.
[0056] For another example, the caller's server obtains and receives a variable acquisition request, which includes a variable name; based on the variable name, a target execution statement of the variable name is queried, and the target execution statement is converted into a corresponding logical relationship information representation; the logical relationship information representation is converted into an executable program code, and based on the executable program code, the data to be processed is obtained from a preset data source, and the data to be processed is loaded into the local memory of the terminal; the executable program code is executed on the data to be processed in the local memory to obtain an execution result of the data to be processed, and the execution result is used as the target variable information of the variable name.
[0057] The caller's terminal and server may also collaboratively execute the variable data processing method provided in the embodiments of the present application.
[0058] For example, the caller writes the variable name of the target variable information to be obtained in the caller's terminal, and generates a variable acquisition request in the terminal based on the variable name. The caller's terminal sends the variable acquisition request to the server for data processing; the server receives the variable acquisition request and extracts the variable name in the variable acquisition request; based on the variable name, the target execution statement of the variable name is queried, and the target execution statement is converted into the logical relationship information representation corresponding to the target execution statement; the logical relationship information representation is converted into an executable program code, and based on the executable program code, the data to be processed is obtained from the preset data source, and the data to be processed is loaded into the local memory of the terminal 102; the server executes the executable program code on the data to be processed in the local memory, obtains the execution result of the data to be processed, and uses the execution result as the target variable information of the variable name. Further, the target variable information of the variable name will be pushed to the terminal to be displayed to the caller.
[0059] The preset data source is a third-party data source. For example, it may be four data sources such as Hbase, Redis, MySQL, and a third-party service. More data sources may also be pre-connected according to actual needs.
[0060] In one embodiment, Figure 2 As shown, a variable data processing method is provided, which is applied to Figure 1 Take the computer device in the example, the computer device can be a terminal or a server. Figure 2 , the variable data processing method includes the following steps:
[0061] Step S202: receiving a variable acquisition request.
[0062] The variable acquisition request includes the variable name, i.e., the variable name of the target variable information to be acquired, and the variable name needs to meet the pre-set variable name naming specifications. For example, the variable name supports letters, numbers, and underscores, but does not support text, etc. In addition, the allowed length range of the variable name can also be preset. For example, when processing corporate data, the variable name can be "CompanyName" or "CompanyTime", etc.
[0063] Specifically, the computer device may receive a variable acquisition request, parse the variable acquisition request to extract a variable name in the variable acquisition request, and then query a target execution statement corresponding to the variable name from a pre-configured variable pool based on the variable name.
[0064] In one embodiment, before receiving a variable acquisition request, a preprocessing operation needs to be performed, and the preprocessing operation includes a data source configuration phase and a variable definition phase. Among them, the preset data source can be preconfigured in the data source configuration phase, and the variable pool can be preconfigured in the variable definition phase.
[0065] During the configuration stage of the data source, the data used to obtain variables is multi-dimensional, and the data sources of different dimensions are different. On this basis, this application supports the configuration of different data sources, including but not limited to accessing MySQL, Redis, Hbase, third-party interfaces and other data sources to obtain data related to variable calculation in the data source.
[0066] Furthermore, the configuration of the data source is implemented based on the unified data source configuration center. In the unified data source configuration center, you can define the data source acquisition method and the composition of structured data. When defining a table in a data source, if some request fields for accessing the data source must be passed, set the field as the index of the table. In the subsequent variable definition stage, it will also be verified that the where condition in the variable execution statement must contain the index field of the table to ensure the correctness of the data returned by the data source.
[0067] In the variable definition stage, relevant development or business personnel are required to pre-set the variable name of the variable, and use computer language to write the calculation logic for obtaining the variable information corresponding to the variable name, that is, the target execution statement. In practical applications, the computer language is generally the SQL language. In other words, the target execution statement written in computer language is an SQL statement, and the SQL statement in this application needs to conform to the SQL syntax of the query engine. Among them, the query engine can provide standard SQL language, multiple query optimization capabilities, and can expand standard SQL at the same time, and the query engine also supports custom functions for implementing complex business logic.
[0068] After the relevant development or business personnel have written the target execution statement, the target execution statement is verified to obtain the verification result. If the verification result indicates that the verification has passed, the target execution statement is saved. If the verification result indicates that the verification has failed, the target execution statement needs to be rewritten. Specifically, verifying the target execution statement refers to verifying the syntax of the target execution statement, including verifying whether the table name, field name, function name, data type, etc. of the target execution statement are correct, and whether the statement of the target execution statement complies with the syntax specifications used. Therefore, before defining the variables, the table field names and functions of the metadata table are pre-defined and loaded into the SQL engine, and the target execution statement is verified based on the pre-defined data in the SQL engine. If the table field names and functions used in the target execution statement do not exist, or the target execution statement does not meet the SQL syntax usage specifications, the verification fails.
[0069] Furthermore, the target execution statement that has passed the verification is saved, and the verification data is processed using the target execution statement. When the execution result obtained is consistent with the actual execution result of the verification data, the target execution statement is pushed to the variable pool, waiting for subsequent variable data processing. In addition, the target execution statement of the variable name is pre-written and pushed to the variable pool, so that when the variable data is processed, the target execution statement of the variable name can be efficiently queried based on the variable name, thereby improving the efficiency of variable data processing.
[0070] Step 204: Based on the variable name, search for a target execution statement of the variable name, and convert the target execution statement into a logical relationship information representation corresponding to the target execution statement.
[0071] Among them, the logical relationship information representation is to convert the SQL statement into a plan of a series of logical operations, that is, the logical plan at the relational algebra level. In other words, the logical relationship information representation is to express the target execution statement with a logical relationship expression at the relational algebra level. It considers the logical structure and operation order of the query, but does not consider the physical storage and execution method.
[0072] Specifically, the pre-configured variable pool includes each variable execution statement and the variable name required when querying each variable execution statement. Therefore, the computer device can query the variable acquisition request based on the variable name. Then convert the target execution statement into the logical relationship information representation corresponding to the target execution statement. For example, the computer device can obtain the abstract syntax structure of the target execution statement, and then input the abstract syntax tree into the logical relationship generator, and generate the required logical relationship information representation through the logical relationship generator, wherein the abstract syntax structure can be represented in the form of a tree structure, so that the logic of the syntax structure is more obvious, thereby making it easier to generate the logical relationship information representation; the logical relationship information representation will first be converted into the initial version of the logical plan converted from the target execution statement, and then after certain optimization processing, the final logical relationship information representation can be obtained.
[0073] Step 206: convert the logical relationship information representation into an executable program code, obtain the data to be processed from a preset data source based on the executable program code, and load the data to be processed into a local memory.
[0074] The executable program code is a code that can be directly executed by a computer, including but not limited to executable JAVA code. The data to be processed is the data that needs to be processed corresponding to the executable program code, and can be represented in the form of a data table or the like.
[0075] Specifically, the logical relationship information representation is an information representation at the relational algebra level, which cannot be directly executed and needs to be converted into an executable program code that can be directly executed by a computer. For example, the logical relationship information representation can first be converted into a physical execution information representation that supports actual execution by a computer. The physical execution information representation is the physical operation sequence used by the computer to complete a specific query, and then the physical execution information representation is represented in the form of an executable program code.
[0076] After the computer device converts the logical relationship information representation into executable program code, the computer device instantiates the executable code into an object and directly executes the executable program code to obtain the data to be processed corresponding to the executable program code from different preset data sources, and loads the data to be processed into the local memory to form a local memory table.
[0077] Step 208, executing the executable program code on the data to be processed in the local memory, obtaining the execution result of the data to be processed, and using the execution result as the target variable information of the variable name.
[0078] The target variable information is the return field of the target execution statement. The target variable information can be structured information, such as numerical information, or unstructured information.
[0079] Specifically, by executing the executable program code on the data to be processed in the local memory, the execution result of the data to be processed is obtained. And the execution result of the data to be processed is used as the target variable information of the variable name. For example, if the data to be processed is Table A, which contains the student numbers of Class A and the genders corresponding to the student numbers, the executable program code indicates that the gender corresponding to the student with student number 1 needs to be queried from Table A. After executing the executable program code on Table A, the gender information corresponding to the student with student number 1 can be directly obtained as female, and female is used as the target variable information of the student with student number 1.
[0080] In the above variable data processing method, according to the variable name in the variable acquisition request, the target execution statement of the variable name is queried, and the target execution statement is converted into the logical relationship information representation of the target execution statement; then, by converting the logical relationship information representation into an executable program code, based on the executable program code, the data to be processed is obtained from the preset data source, and the data to be processed is loaded into the local memory, and the executable program code is executed on the data to be processed in the local memory to obtain the execution result of the data to be processed, and the execution result is used as the target variable information of the variable name. In the whole process, by obtaining the variable name, the corresponding target execution statement is efficiently queried, and the target execution statement is converted into the logical relationship information representation, the efficiency of conversion into the executable program code is accelerated, and further, by executing the executable program code, the data to be processed can be directly loaded into the local memory, without relying on the third-party cache to load the data to be processed from the data source of the third-party server into the local memory, reducing the interaction between systems, and after the executable program code is executed on the data to be processed, the execution result of the data to be processed can be used as the target variable information of the variable name, which improves the efficiency of obtaining variable data in the variable data processing process.
[0081] In one embodiment, converting the target execution statement into a corresponding logical relationship information representation includes:
[0082] Acquire the grammatical structure of the target execution statement; convert the grammatical structure into an abstract syntax tree of the target execution statement; call a logic relationship generation tool to convert the abstract syntax tree into a logic relationship information representation of the target execution statement.
[0083] Among them, the grammatical structure of the target execution statement includes the syntactic information in the target execution statement, etc. The abstract syntax tree is a data structure used to describe the code structure. It is a tree representation of the grammatical structure of the target execution statement after converting the grammatical structure of the target execution statement into an abstract syntax structure. Each node on the tree represents a grammatical structure of the target execution statement. The reason why it is an abstract syntax structure is that the abstract syntax tree does not represent every detail that appears in the real syntax structure. For example, details such as colons, brackets and semicolons will not appear in the abstract syntax tree. For example, nested brackets can be hidden in the tree structure and are not represented in the form of nodes.
[0084] Specifically, in order to convert the target execution statement into an executable program code that can directly obtain the data to be processed from the preset data source, first, the target execution statement must be converted into an abstract syntax tree of the target execution statement. The specific steps can be executed by the JavaCC compiler, including: obtaining the grammatical structure of the target execution statement; converting the grammatical structure into an abstract syntax tree of the target execution statement.
[0085] In detail, the grammatical structure of the target execution statement is obtained. The grammatical structure of the target execution statement may include various syntactic information, such as declaration statements, assignment statements, operation statements, etc. Different statements may be used as different grammatical structures, and the grammatical structure of the target execution statement is converted into an abstract grammatical structure, and then the abstract grammatical structure is represented in a tree form. Further, the grammatical structure is converted into an abstract syntax tree of the target execution statement. After the target execution statement is converted into the abstract syntax tree of the target execution statement, the abstract syntax tree is converted into the logical relationship information representation of the target execution statement, that is, the target execution statement is replaced by a logical relationship expression at the relational algebra level.
[0086] In one embodiment, the abstract syntax tree is converted into the logical relationship information representation of the target execution statement by calling a logical relationship generation tool to convert the nodes of the abstract syntax tree one by one.
[0087] Generally, the logical relationship generation tool includes but is not limited to the default org.apache.calcite.sql2rel.SqlToRelConverter converter of calcite. For example, the specific calling process of the converter includes: convertQuery, convertQueryRecursive, convertSelect, convertSelectImpl, convertFrom & convertWhere & convertSelectList. That is, the filter node Query can be converted first, and then the recursive node QueryRecursive can be converted, and then the selection node, from node, where node and selectlist node can be converted.
[0088] In this embodiment, by first converting the target execution statement into an abstract syntax tree and then converting the abstract syntax tree into a logical relationship information representation, the computer device can have a deeper understanding of the structure and semantics of the code in the target execution statement, so as to more accurately and efficiently convert the target execution statement into a logical relationship information representation, thereby laying the foundation for the subsequent conversion of the logical relationship information representation into executable program code.
[0089] In one embodiment, obtaining the grammatical structure of the target execution statement includes:
[0090] Acquire a grammar rule template file and a grammar rule customization file of a variable execution statement; combine the grammar rule template file and the grammar rule customization file to obtain a grammar rule file of the variable execution statement; input the grammar rule file into a preset compiler, and the preset compiler generates a grammar parsing class of the variable execution statement in the preset compiler based on the grammar rule file; use the grammar parsing class in the preset compiler to parse the grammar of the target execution statement to obtain the grammatical structure of the target execution statement.
[0091] The grammar rule template file in this application is the grammar execution rule of the variable execution statement set in advance, and the grammar rule custom file is the grammar execution rule of the newly added variable execution statement. The preset compiler is a compiler that parses the grammar of the variable execution statement.
[0092] The grammar rule template file in the present application can be a template Parser.jj file, and the grammar rule custom file can be a compoundIdentifier.ftl file and a parserImpls.ftl file. And in the template Parser.jj file, the contents of the compoundIdentifier.ftl file and the parserImpls.ftl file are referenced. Furthermore, the compoundIdentifier.ftl file and the parserImpls.ftl file are extension files, in which custom variable execution statement grammar rules can be added. The grammar rule file in the present application can be a Parser.jj file.
[0093] Specifically, this application uses the JavaCC compiler to convert the target execution statement into an abstract syntax tree. When using the JavaCC compiler, it is necessary to provide the JavaCC compiler with a grammar rule file that describes the lexical and grammatical meaning of the variable execution statement, namely the Parser.jj file. In the Parser.jj file, there are not only pre-set grammar rule templates, but also grammar rules added by users.
[0094] Furthermore, in this application, FMPP (freemarker preprocessor, template generator) is used to generate the Parser.jj file, wherein FMPP is a template generator using the template engine freemarker as a template, and the specific generation process of the Parser.jj file includes: obtaining the grammar rule template file and the grammar rule custom file of the variable execution statement, that is, obtaining the template Parser.jj file, the compoundIdentifier.ftl file, and the parserImpls.ftl file. In the template Parser.jj file, the contents of the compoundIdentifier.ftl file and the parserImpls.ftl file are referenced. And the template Parser.jj file cannot be directly input into the JavaCC compiler, and needs to be processed by FMPP to combine the grammar rule template file and the grammar rule custom file to generate a usable Parser.jj file before the Parser.jj file can be input into the JavaCC compiler.
[0095] When combining the grammar rule template file with the grammar rule custom file to obtain the grammar rule file for executing the statement, the config.fmpp configuration file is also required. config.fmpp is the configuration file of FMPP, which is used to specify the category of the grammar rule custom file. For example, in this application, config.fmpp can specify the grammar rule custom file as the compoundIdentifier.ftl file and the parserImpls.ftl file. By changing or adding a new SQL grammar in the configuration file, FMPP will generate the corresponding Parser.jj file without copying the entire Parser.jj file for modification when expanding.
[0096] The grammar rule Parser.jj file is input into the JavaCC compiler. Based on the input Parser.jj file, the JavaCC compiler generates a grammar parsing class for variable execution statements internally. The grammar parsing class is the SqlParserImpl class inherited from SqlAbstractParserImpl. That is, SqlAbstractParserImpl is an abstract class in Sql format for parsing variable execution statements, and SqlParserImpl is the class in the JavaCC compiler that is actually responsible for parsing variable execution statements and generating an abstract syntax tree. That is to say, when the target execution statement is input into the JavaCC compiler that generates the grammar parsing class, the JavaCC compiler can parse the grammar of the target execution statement through the grammar parsing class of the variable execution statement, thereby obtaining the grammar structure of the target execution statement, and then constructing the abstract syntax tree of the target execution statement based on the grammar structure.
[0097] In this embodiment, after obtaining the grammar rule file of the variable execution statement, the grammar rule file is converted into the grammar parsing class of the variable execution statement, so as to accurately parse the grammar of the target execution statement through the grammar parsing class, and obtain the accurate grammar structure of the target execution statement. The grammar rule file of the variable execution statement obtained includes the grammar rule file and the grammar rule custom file, which is highly flexible, so that the range of grammar rules relied on during parsing is more abundant, and the accuracy of parsing by the grammar rule file is improved.
[0098] In one embodiment, if the target execution statement is a target SQL statement, the method for converting the target SQL statement into an abstract syntax tree is as follows: Figure 3As shown. Specifically, obtain the template Parser.jj file of the SQL statement, the extension file compoundIdentifier.ftl, the extension file parserImpls.ftl and the configuration file config.fmpp of FMPP, wherein the extension file is a file of custom grammar rules newly added by the user, and the extension files specified in the configuration file of FMPP include the compoundIdentifier.ftl file and the parserImpls.ftl file. On the basis of the configuration file config.fmpp of FMPP, FMPP is used to combine the template Parser.jj file, the extension file compoundIdentifier.ftl and the extension file parserImpls.ftl to generate the Parser.jj file that can be used to describe the SQL grammar, and the JavaCC compiler is used to process the Parser.jj file to generate the SqlParserImpl class inherited from SqlAbstractParserImpl, and the SqlParserImpl class processes the target SQL statement to obtain the grammatical structure of the target SQL statement.
[0099] In one embodiment, calling a logic relationship generation tool to convert an abstract syntax tree into a logic relationship information representation of a target execution statement includes:
[0100] Obtain preset template data of the abstract syntax tree; determine the fields and data types of the abstract syntax tree; when the fields meet the optional fields, the data types meet the optional data types, and the abstract syntax tree meets the statement specification rules, call the logical relationship generation tool to convert the abstract syntax tree into the logical relationship information representation of the target execution statement.
[0101] The preset template data includes optional fields, optional data types and statement specification rules of the abstract syntax tree.
[0102] Specifically, the target execution statement is converted into an abstract syntax tree of the target execution statement. The abstract syntax tree obtained at this time is an unverified abstract syntax tree, and it needs to undergo syntax verification before the verified abstract syntax tree can be converted into a logical relationship information representation of the target execution statement.
[0103] During syntax verification, first, you need to obtain the preset template data of the abstract syntax tree. The preset template data of the abstract syntax tree is essentially the preset template data of the target execution statement. It should be noted that syntax verification will be performed twice in this application. The first time is in the initial variable definition stage. When the variable execution statement of the variable name is written and saved, the syntax of the variable execution statement will be verified; the second time is after the target execution statement is converted into the abstract syntax tree of the target execution statement. The syntax of the abstract syntax tree is verified. The means of the two verifications are the same, but the application scenarios are different.
[0104] Determine the fields and data types of the abstract syntax tree. When the fields of the abstract syntax tree satisfy the optional fields, the data types of the abstract syntax tree satisfy the optional data types, and the abstract syntax tree conforms to the statement specification rules, the abstract syntax tree can be converted into the logical relationship information representation of the target execution statement. If there are fields of the abstract syntax tree that do not satisfy the optional fields, the data types of the abstract syntax tree do not satisfy the optional data types, and the abstract syntax tree does not conform to at least one of the statement specification rules, it is considered that the abstract syntax tree has not passed the verification and the abstract syntax tree cannot be converted into the logical relationship information representation of the target execution statement.
[0105] In one embodiment, the preset template data includes optional fields, optional data types and statement specification rules of the abstract syntax tree, and the optional fields include optional table names, optional function names and optional field names. The table name, function name and field name of the abstract syntax tree are determined, that is, when the table name of the abstract syntax tree satisfies the optional field, the function name of the abstract syntax tree satisfies the optional data type, and the field name of the abstract syntax tree satisfies the optional field name, it is considered that the field of the abstract syntax tree satisfies the optional field of the abstract syntax tree.
[0106] In the above embodiment, a comprehensive verification of the abstract syntax tree is implemented through a multi-dimensional verification method. For example, it is checked whether the table name, field name, function name, data type, etc. of the abstract syntax tree are correct, and whether the abstract syntax tree complies with the statement specification rules, so that the grammatical structure in the final abstract syntax tree is accurate, avoiding the interference of the erroneous grammatical structure on the subsequent variable data processing. For example, based on the erroneous abstract syntax structure, the conversion obtains the erroneous logical relationship information representation, and then obtains the erroneous executable program code, and the accurate target variable information cannot be obtained.
[0107] In one embodiment, calling a logic relationship generation tool to convert an abstract syntax tree into a logic relationship information representation of a target execution statement includes:
[0108] Determine each execution node in the abstract syntax tree; call the logic relationship generation tool, use different logical relationship expression information to replace the execution syntax information and execution field information in the abstract syntax tree, and obtain the logical relationship information representation of the target execution statement.
[0109] Among them, the abstract syntax tree is an abstract syntax structure represented in a tree form. Therefore, the abstract syntax tree will have various execution nodes, and each execution node can be regarded as a syntax structure. The execution node includes execution syntax information and execution field information. The execution syntax information includes but is not limited to function expressions, etc. The execution field information refers to the specific processing field of the execution syntax information. For example, there is a target execution statement for querying gender: select gender fromSALES.EMPS where name = 'Fred', where "select", "from", etc. can be regarded as execution syntax information, and the "gender" gender field, the "name" name field, etc. can be regarded as execution field information to be processed by the execution syntax information.
[0110] Specifically, the execution syntax information and execution field information of each execution node in the abstract syntax tree are obtained, and the logical relationship generation tool is called to replace the execution syntax information and execution field information in the abstract syntax tree with different logical relationship expression information, wherein one logical relationship expression corresponds to one execution node. The logical relationship expression information includes but is not limited to logical relationship expression information including LogicalProject and LogicalFilter.
[0111] Let's take the target execution statement: select gender from SALES.EMPS where name = 'Fred' as an example. SALES is the database name in the preset data source, and EMPS is the table name. The first four fields in EMPS are: id, name, age, and gender. Convert the target execution statement into an abstract syntax tree, and then convert the abstract syntax tree into a logical relationship information representation. The final logical relationship information representation is as follows:
[0112] LogicalProject(GENDER=[$3])
[0113] LogicalFilter(condition=[=($1,'Fred')])
[0114] LogicalTableScan(table=[[SALES,EMPS]]).
[0115] in:
[0116] I. In the logical relationship expression information LogicalProject (GENDER=[$3]), LogicalProject is a selection syntax operation, that is, LogicalProject is used to replace the selection syntax operation. Since the gender field is the third field in the EMPS table, $3 is used to replace the gender field.
[0117] Ii. In the logical relationship expression information LogicalFilter (condition=[=($1,'Fred')]), LogicalFilter is a filtering syntax operation, that is, LogicalFilter is used to replace the filtering syntax operation, and the comparison condition =(1,'Fred') is used to replace the specific field to be filtered, where 1 is the position of name in the table.
[0118] Iii. In the logical relationship expression information LogicalTableScan (table=[[SALES, EMPS]]), LogicalTableScan is a scanning syntax operation, which scans the EMPS table in the SALES database. That is, LogicalTableScan is used to replace the scanning syntax operation, and table=[[SALES, EMPS]] is used to replace the specific field information to be scanned.
[0119] In the above embodiment, by replacing the execution syntax information and execution field information in each execution node in the abstract syntax tree with different logical relationship expression information, the logical order of the target execution statement during the execution process can be more clearly characterized, making the conversion of the target execution statement into executable program code more efficient, thereby achieving efficient variable data acquisition.
[0120] In one embodiment, before converting the logical relationship information representation into executable program code, the method further includes:
[0121] At least one optimization execution means is executed on the logical relationship information representation to obtain an optimized logical relationship information representation.
[0122] Among them, the optimization execution means include rule optimization and cost optimization. Rule optimization means optimizing the logical relationship information according to the preset optimization rules, and there is no need to retain the optimized logical relationship information representation, and its optimization rules are unique. Cost optimization means converting the logical relationship information representation multiple times, generating multiple converted logical relationship information representations, retaining the original logical relationship information representation, and selecting the most appropriate logical relationship information representation from all logical relationship information based on cost information.
[0123] Specifically, when the abstract syntax tree is converted into a logical relationship information representation, the obtained logical relationship information representation is a preliminary logical relationship information representation, which needs to be further optimized to obtain a more efficient logical relationship information representation. The optimization of the logical relationship information representation is performed in the query optimizer module. Among them, the query optimizer is the core module of the traditional database and the core module of the big data computing engine. Open source big data engines such as Spark and Hive have their own query optimizers.
[0124] Executing at least one optimization execution means on the logical relationship information representation to obtain the optimized logical relationship information representation means that the rule optimization or cost optimization can be executed on the logical relationship information representation alone, or the rule optimization and cost optimization can be executed on the logical relationship information representation at the same time. However, the logical relationship information representation before optimization and the logical relationship information representation after optimization only change in the logical order, and the returned result does not change.
[0125] In the above embodiment, by adopting at least one rule optimization and cost optimization method to optimize the logical relationship information representation, data redundancy can be reduced, so that the subsequent processing of the data to be processed using the executable program code converted from the logical relationship information representation can be more efficient.
[0126] In one embodiment, performing at least one optimization execution means on the logical relationship information representation to obtain an optimized logical relationship information representation includes:
[0127] When the optimization execution means includes rule optimization, a preset logical sequence rule of the logical relationship information representation is obtained; the preset logical sequence rule is used to optimize the logical sequence of the logical relationship information representation to a logical relationship information representation that satisfies the logical sequence rule, and the logical relationship information representation that satisfies the logical sequence rule is used as the optimized logical relationship information representation.
[0128] Among them, there is a certain order in the logical relationship information representation, and the preset logical order rule is a pre-set optimization rule. Rule optimization refers to converting a logical relationship expression into another logical relationship expression according to the preset logical order rule, and the original logical relationship expression will be pruned.
[0129] Specifically, when the logical relationship information is represented by rule optimization, the pre-set logical order rules of the logical relationship information representation are obtained, and the rule optimization is performed on the logical relationship information representation to convert the logical order of the logical relationship information representation into a logical relationship information representation that satisfies the logical order rules. It should be noted that the rule optimization includes a set of logical order rules with a strict order. For the same target execution statement, no matter how the initial logical relationship information representation is, the logical relationship information representation finally generated is consistent.
[0130] For example, there is a target execution statement: select t1.age, t2.birthday from t1 joint2 on t1.id = t2.id where t1.name='zhangsan', that is, to query the age and birthday of the person whose name is Zhangsan.
[0131] The abstract syntax tree representing the initial logical relationship information is as follows: Figure 4 As shown, Scan: t1 represents scanning the t1 table; Scan: t2 represents scanning the t2 table; Join: t1.id=t2.id represents comparing the id in the t1 table with the id in the t2 table, and associating the t1 table and the t2 table according to the corresponding id; Fiter: t1.name='zhangsan' represents filtering out the data with the name Zhangsan in the t1 table from the associated table of t1 and t2; Project: t1.age.t2.birthday represents querying the age of the user with the name zhangsan from the t1 table in the filtered data, and querying the birthday of the user with the name zhangsan from the t2 table in the filtered data.
[0132] Depend on Figure 4 It can be concluded that the logical order is to scan the t1 table and the t2 table, associate the t1 table and the t2 table according to the id in the t1 table and the t2 table, and then filter out the data in the associated table where the name is zhangsan='zhangsan', so as to query the age of the user whose name is zhangsan in the t1 table, and query the birthday of the user whose name is 'zhangsan' in the t2 table.
[0133] When the preset logical order rule is used to optimize the logical order of the logical relationship information representation to the logical relationship information representation that satisfies the logical order rule, the abstract syntax tree of the logical relationship information representation that satisfies the logical order rule is as follows: Figure 5As shown, Scan: t1 represents scanning the t1 table; Scan: t2 represents scanning the t2 table; Fiter: t1.name='zhangsan' represents filtering out the data with the name Zhangsan from the t1 table; Join: t1.id=t2.id represents comparing the data with the name Zhangsan filtered out from the t1 table with the id in the t2 table, and associating the data filtered out from the t1 table with the t2 table according to the corresponding id; Project: t1.age.t2.birthday represents querying the age of the user with the name zhangsan from the t1 table, and querying the birthday of the user with the name zhangsan from the t2 table.
[0134] Depend on Figure 5 It can be seen that the logical order is: find the data in table t1 and table t2 respectively, then filter the data in table t1 with the name zhangsan, and then associate the filtered data in table t1 with table t2 to query his age and birthday. Figure 4 and Figure 5 ,It can be seen that the execution efficiency of the optimized logical relationship information ,representation is significantly higher.
[0135] In the above embodiment, by adopting preset logical sequence rules, the logical order of the logical relationship information representation can be accurately optimized to a logical relationship information representation that satisfies the logical sequence rules. Moreover, since the logical sequence rules are set in advance, the logical relationship information representation can be directly optimized when obtaining a preliminary logical relationship information representation, thereby improving the optimization efficiency.
[0136] In one embodiment, performing at least one optimization execution means on the logical relationship information representation to obtain an optimized logical relationship information representation includes:
[0137] When the optimization execution means includes cost optimization, the logical relationship information representation is converted to obtain the converted logical relationship information representation, and the logical relationship information representation is saved; a first execution cost of the logical relationship information representation and a second execution cost of the converted logical relationship information representation are calculated through a preset cost acquisition model; the minimum execution cost between the first execution cost and the second execution cost is determined, and a target logical relationship information representation with the minimum execution cost is determined; the target logical relationship information representation is used as the optimized logical relationship information representation.
[0138] Specifically, when cost optimization is used to optimize the logical relationship information representation, the logical relationship expression is generated into another relationship expression after the optimization rule, and the original logical relationship information representation is retained. The logical relationship information representation can be converted multiple times to obtain the logical relationship information representation after multiple conversions. Then, through the preset cost acquisition model, the first execution cost of the logical relationship information representation and the second execution cost of the converted logical relationship information representation are calculated from the dimensions of data volume, CPU, memory, I / O, etc.
[0139] Compare the calculated first execution cost and the second execution cost. If the first execution cost is greater than the second execution cost, the logical relationship information representation corresponding to the second execution cost is used as the target logical relationship information representation, that is, the optimized logical relationship information representation; if the first execution cost is less than the second execution cost, the logical relationship information representation corresponding to the first execution cost is used as the target logical relationship information representation, that is, the optimized logical relationship information representation.
[0140] For example, there is a target execution statement: select t1.age, t2.birthday, t3. addressfrom t1 join t2 on t1.id = t2.id join t1.id=t3.id where t1.name='zhangsan'. That is, query the age, birthday and address of Zhangsan.
[0141] Assume that there are 1,000 records in table t1, 100 records in table t2, and 10 records in table t3. Then t1join t2 returns 10,000 records, and t2join t3 returns 200 records. The corresponding abstract syntax tree of the logical relationship information before and after the conversion is as follows: Figure 6 As shown, Figure 6 The middle left picture is the abstract syntax tree corresponding to the logical relationship information representation before conversion. Figure 6 The middle right picture is the abstract syntax tree corresponding to the converted logical relationship information representation.
[0142] against Figure 5, Scan: t1 represents scanning the t1 table; Scan: t2 represents scanning the t2 table; Scan: t3 represents scanning the t3 table; Filter: t1.name='Zhangsan' represents filtering out the data with the name Zhangsan from the t1 table; Join: t2.id= t3.id represents associating the t2 table with the t3 table according to the ids in the t2 table and the t3 table; Join: t1.id= t3.id represents associating the associated table with the filtered data in the t1 table according to the id to obtain the final associated t1t2t3 table; Project: t1.age, t2.birthday, t3.address represents querying the age of Zhangsan from the t1 table, the birthday of Zhangsan from the t2 table, and the address of Zhangsan from the t3 table in the final associated t1t2t3 table.
[0143] against Figure 6 , Scan: t1 represents scanning the t1 table; Scan: t2 represents scanning the t2 table; Scan: t3 represents scanning the t3 table; Filter: t1.name='Zhangsan' represents filtering out the data with the name Zhangsan from the t1 table; Join: t1.id= t2.id represents associating the filtered data in the t1 table with the t2 table according to the id; Join: t1.id= t3.id represents further associating the data in the associated table with the data in the t3 table according to the id to obtain the final associated t1t2t3 table; Project: t1.age, t2.birthday, t3.address represents querying the age of the person with the name Zhangsan from the t1 table, the birthday of the person with the name Zhangsan from the t2 table, and the address of the person with the name Zhangsan from the t3 table in the final associated t1t2t3 table.
[0144] If the logical relationship information representation before conversion adopts the method of (t1 join t2) join t3, then 1000 * 100 + 10000 * 10 = 200000 cycles need to be executed. If the logical relationship information representation after conversion adopts the method of (t2 join t3) join t1, then 100 * 10 + 200 * 1000 = 200100 cycles need to be executed. It can be seen that the logical relationship information representation after conversion is a logical relationship information representation with lower cost, so the logical relationship information representation after conversion is taken as the optimized logical relationship information representation.
[0145] In the above embodiment, the execution cost of the logical relationship information representation before and after the conversion is calculated through a preset cost acquisition model, and the execution costs of the logical relationship information representation before and after the conversion are compared, and the logical relationship information representation with the minimum execution cost is used as the target logical relationship information representation. Since the target logical relationship information representation is the logical relationship information representation with the minimum execution cost, after the target logical relationship information representation is converted into an executable program code, the query cost based on the executable program code is also lower, and the query efficiency is greatly improved.
[0146] In one embodiment, when the optimization execution means includes rule optimization and cost optimization, a preset logical sequence rule of the logical relationship information representation can be obtained; the preset logical sequence rule is used to optimize the logical sequence of the logical relationship information representation to a logical relationship information representation that satisfies the logical sequence rule, and the logical relationship information representation before the conversion is retained. Then, the execution cost of the logical relationship information representation before and after the conversion is calculated through a preset cost acquisition model, so that the logical relationship information representation with the minimum execution cost is used as the target logical relationship information representation.
[0147] In one embodiment, Figure 7 As shown, step S206 includes:
[0148] S702, converting the logical relationship expression information in the logical relationship information representation into physical execution field information and physical function expression information.
[0149] The physical execution field information is the specific field information required for actual execution, and the physical function expression information is the physical relational expression of the execution function.
[0150] Specifically, if you want to convert the logical relationship information representation into executable program code, you first need to convert the logical relationship information representation into a physical execution information representation, which is the physical plan required for actual execution. Generally, to convert the logical relationship information representation into a physical execution information representation, you first need to convert the logical relationship expression information in the logical relationship information representation into physical execution field information and physical function expression information.
[0151] S704, obtaining a physical operator of the logical relationship expression information based on the physical execution field information and the physical function expression information.
[0152] Specifically, based on the physical execution field information and the physical function expression information obtained by conversion, several physical operators of the logical relationship expression information can be combined.
[0153] S706: Based on the physical operator, obtain the physical execution information representation of the target execution statement.
[0154] Specifically, several physical operators are combined to obtain a physical execution information representation of the target execution statement.
[0155] For example, the above target execution statement: select gender from SALES.EMPS where name = 'Fred'. Its physical execution information is represented as:
[0156] EnumerableCalc(
[0157] expr#0..9=[{inputs}],
[0158] expr#10=['Fred':VARCHAR],
[0159] expr#11=[=($t1,$t10)],
[0160] GENDER=[$t3],
[0161] $condition=[t11])
[0162] EnumerableTableScan(table=[[SALES,EMPS]])
[0163] in:
[0164] i.expr#0..9=[{inputs}]: The fields of the data table are mapped to 10 fields from 0 to 9 respectively. Here, it means that the 0th to 9th fields of the input parameter are the fields of the data table, for example: t0 represents id, t2 represents name, t3 represents age, t4 represents gender, and so on.
[0165] ii.expr#10=['Fred':VARCHAR]: indicates that the 10th field of the input parameter is 'Fred' in SQL.
[0166] iii.expr#11=[=($t1, $t10)]: Indicates that the 11th field of the input parameter is an equal function expression, referring to name = 'Fred', t1 is the name field, and t10 is the string of Fred as mentioned above.
[0167] iv.GENDER=[$t3]: Performs the select field operation, indicating that the gender in the output result is obtained from the t3 field in the calculation result.
[0168] v.$condition=[t11]: that is, the where operation. The where condition here is the t11 expression, that is, expr#11=[=($t1, $t10)], which means name = 'Fred'.
[0169] It can be seen that a logical relationship expression information is converted into at least one physical execution field information and physical function expression information. Comparing the logical relationship information representation and physical execution information representation of the target execution statement, it can be seen that LogicalProject (GENDER=[$3]) and LogicalFilter (condition=[=($1,'Fred')]) in the logical relationship information representation are merged into an EnumerableCalc physical operator, in which the EnumerableCalc physical operator carries at least one physical execution field information and physical function expression information. For example, expr#0..9=[{inputs}], expr#10=['Fred':VARCHAR], etc. are the field information of the input parameters, that is, the physical execution field information, and GENDER=[$t3] is the physical function expression information, indicating the selection function.
[0170] S708, using a preset executable code compiler to compile the physical execution information representation to obtain an executable program code of the target execution statement.
[0171] Specifically, the preset executable code compiler in the present application may be a janino compiler, and the physical execution information representation is compiled by the janino compiler to obtain the executable program code of the target execution statement. The executable program code of the target execution statement may be an executable java code. The executable java code is instantiated into an object.
[0172] S710, based on the executable program code, obtaining the data to be processed from the preset data source, and loading the data to be processed into the local memory.
[0173] In the above embodiment, the logical relationship expression information in the logical relationship information representation is converted into physical execution field information and physical function expression information; and then based on the physical execution field information and the physical function expression information, the physical operators of the logical relationship expression information are efficiently obtained, so that based on several physical operators, the physical execution information representation of the target execution statement is accurately obtained.
[0174] In one embodiment, based on the executable program code, obtaining the data to be processed from the preset data source includes:
[0175] The data query conditions in the executable program code are obtained; the data query conditions are pushed down to the preset data source, and the to-be-processed data satisfying the data query conditions are queried from the preset data source.
[0176] The data query condition is the condition corresponding to the where condition of the target execution statement in the executable program code. The where condition must contain the index field of the data table in the preset data source.
[0177] Specifically, the data query condition corresponding to the where condition in the executable program code is obtained, the data query condition is pushed down to the preset data source, and the to-be-processed data satisfying the data query condition is obtained from different preset data sources based on the data query condition.
[0178] Furthermore, when obtaining the logical relationship information representation, the logical relationship information representation can be extended to different data sources, so that the data to be processed that meets the data query conditions can be obtained from the connected data source in the future. This application supports access to four data sources: Hbase, Redis, MySQL, and third-party services. More data sources can also be accessed according to actual needs.
[0179] Furthermore, for different data sources, the process of querying the to-be-processed data that meets the data query conditions from the preset data source includes:
[0180] 1. Hbase data source, obtain data through the get and scan methods provided by the hbase java client, for example, get'n1:t1','rowkey1'.
[0181] 2. Redis data source, obtain data according to different data types of the redis server through the redis java client.
[0182] 3. Mysql data source, encapsulate the push-down conditions into SQL statements and use jdbc to access mysql to obtain data, for example, select * from t1.
[0183] 4. Rpc data source, request third-party services to obtain data.
[0184] In the above embodiment, by pushing the data query conditions to the preset data source, and querying the to-be-processed data satisfying the data query conditions from the preset data source, the to-be-processed data can be directly stored in the local memory, without relying on a third-party cache to extract the to-be-processed data from the data source to the local memory, and because there is no need to rely on a third-party cache, the hardware procurement cost and operation and maintenance cost of the third-party cache can be reduced, and the system stability can be improved. At the same time, it can also reduce the interaction between systems and improve application performance.
[0185] In a specific embodiment, Figure 8 As shown, the method of the present application can be applied to obtain target variable information in various fields. The variable data processing method of the present application includes the following steps:
[0186] S1. Preset data source configuration
[0187] The preset data sources in this application support MySQL, Redis, Hbase, third-party interfaces and other data sources. Index fields need to be set in the data tables in the data source.
[0188] S2. Variable definition and variable execution statement writing
[0189] First, set the variable name of the variable, and use SQL statements to write variable execution statements for the variable name, that is, SQL statements. Secondly, perform syntax verification on the SQL statement, that is, verify whether the table name, field name, function name, data type, etc. of the SQL statement are correct, and verify whether the SQL statement complies with the statement usage specifications. If the verification is successful, save the written SQL statement, and then use the verification data to verify the saved SQL statement. When the verification result is correct, push the SQL statement to the variable pool.
[0190] S3. Target variable information acquisition
[0191] This step is completed in a powerful variable calculation engine, which is an engine developed based on Apache Calcite and has the ability to obtain data across data sources.
[0192] S31 variable acquisition request reception
[0193] Receive a variable acquisition request and extract the variable name in the variable acquisition request, such as the gender of user M.
[0194] S32 target execution statement acquisition
[0195] The target execution statement to query the variable name from each variable execution statement in the variable pool is: select genderfrom SALES.EMPS where name = 'M'. Among them, SALES is the database name in the preset data source, and EMPS is the table name in the database.
[0196] S33 Conversion of logical relationship information representation
[0197] S331 Abstract Syntax Tree Construction
[0198] A. Obtain the Parser.jj file, a template for the execution statements of each variable, and obtain the config.fmpp configuration file of FMPP. In the config.fmpp file, specify the extension files as the compoundIdentifier.ftl file and the parserImpls.ftl file, where the extension files are user-defined files.
[0199] B. Use FMPP to combine the compoundIdentifier.ftl file, parserImpls.ftl file and template Parser.jj file to obtain the Parser.jj file of each variable execution statement. The Parser.jj file is the grammar rule file of the SQL compiler. The Parser.jj file contains the SQL grammar rules that pre-exist in the SQL compiler and also contains the user-defined rules.
[0200] C. Input the Parser.jj file into the SQL compiler, that is, JavaCC, to generate the SqlParserImpl class inherited from SqlAbstractParserImpl. Use the SqlParserImpl class in JavaCC to process the target execution statement and obtain the grammatical structure of the target execution statement.
[0201] D. Remove the colon, brackets, and semicolons in the syntax structure to obtain the abstract syntax structure of the target execution statement and represent it in the form of an abstract syntax tree. A node on the abstract syntax tree corresponds to an abstract syntax structure.
[0202] E. Verify the abstract syntax tree in a similar way to the verification of the written variable execution statement, including but not limited to checking whether the table name, field name, function name, data type, etc. of the abstract syntax tree are correct, and verifying whether the statements of the abstract syntax tree comply with the specifications.
[0203] S332 Preliminary logical relationship information representation conversion
[0204] The default org.apache.calcite.sql2rel.SqlToRelConverter converter of calcite converts the verified abstract syntax tree into a preliminary logical relationship information representation, that is, a preliminary logical plan. Specifically, by calling the converter, different logical relationship expression information can be used to replace the execution syntax information and execution field information in the abstract syntax tree. For example, the logical relationship expression information LogicalProject (GENDER=[$3]) can be used to replace the operation of selecting the gender field in the target execution statement; the logical relationship expression information LogicalFilter (condition=[=($1,'M')]) can be used to replace the operation of filtering the name field in the target execution statement; the logical relationship expression information LogicalTableScan (table=[[SALES, EMPS]]) can be used to replace the operation of scanning the table in the target execution statement.
[0205] That is to say, the logical relationship information of the above target execution statement can be expressed as:
[0206] LogicalProject(GENDER=[$3])
[0207] LogicalFilter(condition=[=($1,'M')])
[0208] LogicalTableScan(table=[[SALES,EMPS]]).
[0209] S333 Extended push-down logic relationship information representation
[0210] In addition, the preliminary logical relationship information representation can also be connected to each data source to expand the preliminary logical relationship information representation. Specifically, it can be completed using EnumerableAggregatelei'jia function and PushJoin. The data sources that support expansion are configured data sources, such as Hbase, Redis, MySQL, and Rpc data sources.
[0211] Optimization of S334 logical relationship information representation
[0212] The query optimizer module is used to optimize the above preliminary logical relationship information representation. Specifically, the optimization methods include rule optimization and cost optimization.
[0213] If it is rule optimization, it is necessary to optimize the logical order of the logical relationship information representation to a logical relationship information representation that satisfies the logical order rule according to the preset logical order rule, and not retain the original logical relationship information representation. And the logical relationship information representation that satisfies the logical order rule is used as the optimized logical relationship information representation.
[0214] If it is cost optimization, the logical relationship information representation needs to be converted according to each optimization rule to obtain each converted logical relationship information representation, and the original logical relationship information representation is retained. Finally, according to the preset cost acquisition model, the execution cost of each logical relationship information representation is calculated from the dimensions of data volume, CPU, memory, I / O, etc., and the logical relationship information representation with the lowest execution cost is selected. The logical relationship information representation with the lowest execution cost is used as the optimized logical relationship information representation.
[0215] S34 Physical execution information representation conversion
[0216] The logical relationship expression information in the optimized logical relationship information representation is converted into physical execution field information and physical function expression information; and based on the physical execution field information and the physical function expression information, they are merged into various physical operators, and the various physical operators are combined to obtain the physical execution information representation of the target execution statement.
[0217] For the above target execution statement, its physical execution information is represented as follows:
[0218] EnumerableCalc(
[0219] expr#0..9=[{inputs}],
[0220] expr#10=['Fred':VARCHAR],
[0221] expr#11=[=($t1,$t10)],
[0222] GENDER=[$t3],
[0223] $condition=[t11])
[0224] EnumerableTableScan(table=[[SALES,EMPS]])
[0225] It can be seen that in the above physical execution information representation, LogicalProject (GENDER=[$3]) and LogicalFilter (condition=[=($1,'Fred')]) are combined into an EnumerableCalc physical operator; and LogicalTableScan (table=[[SALES, EMPS]]) is used as an EnumerableTableScan physical operator. The brackets of the physical operator are its corresponding logical syntax, which consists of physical execution field information and physical function expression information. For example, expr#0..9=[{inputs}], expr#10=['Fred':VARCHAR], etc. are the field information of the input parameters, that is, the physical execution field information, and GENDER=[$t3] is the physical function expression information, indicating the selection function.
[0226] S35 executable program code conversion and execution
[0227] Use the Janino compiler or Java Code Generator to represent the physical execution information, compile it into executable Java code and instantiate it into an object.
[0228] According to the where condition in the Java code, query the EMPS table of the data to be processed that meets the where condition from the preset data source, and load the EMPS table into the local memory;
[0229] For example, for different data sources, the process of querying the to-be-processed data that meets the data query conditions from the preset data source includes:
[0230] 1. Hbase data source, obtain data through get and scan methods.
[0231] 2. Redis data source, through the redis java client, according to the different data types of the redis server, use methods such as get key to obtain data.
[0232] 3. Mysql data source, encapsulate the pushdown conditions into SQL statements and use jdbc to access mysql to obtain data, which can be select * from table name and other methods.
[0233] 4. Rpc data source uses http request to request third-party service to obtain data.
[0234] The Java code is executed on the EMPS table in the local memory, and the execution result of the EMPS table is obtained as female, and female is used as the gender information of M.
[0235] In one embodiment, the variable data processing method of the present application can be applied to the risk control variable calculation field of computer finance, that is, it can obtain variable information related to risk control variables and use a risk control model to detect the variable information.
[0236] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0237] Based on the same inventive concept, the embodiment of the present application also provides a variable data processing device for implementing the variable data processing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more variable data processing device embodiments provided below can refer to the limitations of the variable data processing method above, and will not be repeated here.
[0238] In an exemplary embodiment, Fig. 9 As shown, a variable data processing device is provided, including: a request acquisition module 902, a logic representation module 904, a data loading module 906 and a data processing module 908, wherein:
[0239] The request acquisition module 902 is used to receive a variable acquisition request, where the variable acquisition request includes a variable name;
[0240] A logic representation module 904, for searching a target execution statement of a variable name based on the variable name, and converting the target execution statement into a corresponding logic relationship information representation;
[0241] The data loading module 906 is used to convert the logical relationship information representation into an executable program code, obtain the data to be processed from a preset data source based on the executable program code, and load the data to be processed into a local memory;
[0242] The data processing module 908 is used to execute the executable program code on the data to be processed in the local memory, obtain the execution result of the data to be processed, and use the execution result as the target variable information of the variable name.
[0243] In one embodiment, the logic representation module 904 is further configured to:
[0244] Get the grammatical structure of the target execution statement;
[0245] Convert the grammatical structure into an abstract syntax tree of the target execution statement;
[0246] The logic relationship generation tool is called to convert the abstract syntax tree into the logic relationship information representation of the target execution statement.
[0247] In one embodiment, the logic representation module 904 is further configured to:
[0248] Get the grammar rule template file and grammar rule custom file of the variable execution statement;
[0249] The grammar rule template file and the grammar rule custom file are combined to obtain a grammar rule file of the variable execution statement;
[0250] Input the grammar rule file into the preset compiler, and the preset compiler generates a grammar parsing class of the variable execution statement in the preset compiler based on the grammar rule file;
[0251] The grammar parsing class in the preset compiler is used to parse the grammar of the target execution statement to obtain the grammatical structure of the target execution statement.
[0252] In one embodiment, the logic representation module 904 is further configured to:
[0253] Obtaining preset template data of an abstract syntax tree, wherein the preset template data includes optional fields, optional data types, and statement specification rules of the abstract syntax tree;
[0254] Determine the fields and data types of the abstract syntax tree;
[0255] When the field satisfies the optional field, the data type satisfies the optional data type, and the abstract syntax tree conforms to the statement specification rule, the logical relationship generation tool is called to convert the abstract syntax tree into the logical relationship information representation of the target execution statement.
[0256] In one embodiment, the logic representation module 904 is further configured to:
[0257] Determine each execution node in the abstract syntax tree, where the execution node includes execution syntax information and execution field information;
[0258] The logic relationship generation tool is called, and different logic relationship expression information is used to replace the execution syntax information and execution field information in the abstract syntax tree to obtain the logic relationship information representation of the target execution statement.
[0259] In one embodiment, a logic optimization module is further included, and the logic optimization module is used to:
[0260] At least one optimization execution means is executed on the logical relationship information representation to obtain an optimized logical relationship information representation, and the optimization execution means includes rule optimization and cost optimization.
[0261] In one embodiment, the logic optimization module is further configured to:
[0262] When the optimization execution means includes rule optimization, obtaining a preset logical sequence rule represented by the logical relationship information;
[0263] By using preset logical sequence rules, the logical sequence of the logical relationship information representation is optimized to a logical relationship information representation that satisfies the logical sequence rules, and the logical relationship information representation that satisfies the logical sequence rules is used as the optimized logical relationship information representation.
[0264] In one embodiment, the logic optimization module is further configured to:
[0265] In the case where the optimization execution means includes cost optimization, the logical relationship information representation is converted to obtain a converted logical relationship information representation, and the logical relationship information representation is saved;
[0266] Calculating a first execution cost represented by the logical relationship information and a second execution cost represented by the converted logical relationship information through a preset cost acquisition model;
[0267] Determine the minimum execution cost between the first execution cost and the second execution cost, and determine the target logical relationship information representation of the minimum execution cost;
[0268] The target logical relationship information representation is used as the optimized logical relationship information representation.
[0269] In one embodiment, the data loading module 906 is further used to:
[0270] Converting the logical relationship expression information in the logical relationship information representation into physical execution field information and physical function expression information;
[0271] Based on the physical execution field information and the physical function expression information, a physical operator of the logical relationship expression information is obtained;
[0272] Based on the physical operator, the physical execution information representation of the target execution statement is obtained;
[0273] The physical execution information representation is compiled using a preset executable code compiler to obtain the executable program code of the target execution statement.
[0274] In one embodiment, the data loading module 906 is further used to:
[0275] Obtaining data query conditions in executable program code;
[0276] The data query conditions are pushed down to the preset data source, and the data to be processed that meets the data query conditions is queried from the preset data source.
[0277] The above-mentioned variable data processing device queries the target execution statement of the variable name according to the variable name in the variable acquisition request, and converts the target execution statement into the logical relationship information representation of the target execution statement; then, by converting the logical relationship information representation into an executable program code, and then based on the executable program code, obtains the data to be processed from a preset data source, so that the data to be processed can be directly loaded into the local memory without relying on a third-party cache, which is conducive to reducing the interaction between systems, and after executing the executable program code on the data to be processed, the execution result of the data to be processed is used as the target variable information of the variable name, thereby improving the efficiency of the variable data processing process.
[0278] Each module in the above variable data processing device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0279] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Fig.10 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store target variable information. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a variable data processing method is implemented.
[0280] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Fig.11As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a variable data processing method is realized. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0281] Those skilled in the art will understand that Fig.10 or Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0282] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0283] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0284] In one embodiment, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0285] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0286] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0287] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0288] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A variable data processing method, characterized in that: The method comprises: receiving a variable acquisition request, wherein the variable acquisition request includes a variable name; Based on the variable name, query the target execution statement of the variable name, and convert the target execution statement into a corresponding logical relationship information representation; Converting the logical relationship information representation into an executable program code, acquiring the data to be processed from a preset data source based on the executable program code, and loading the data to be processed into a local memory; The executable program code is executed on the data to be processed in the local memory to obtain an execution result of the data to be processed, and the execution result is used as the target variable information of the variable name.
2. The method according to claim 1, characterized in that: The converting the target execution statement into a corresponding logical relationship information representation includes: Acquire the grammatical structure of the target execution statement; Converting the grammatical structure into an abstract syntax tree of the target execution statement; A logic relationship generation tool is called to convert the abstract syntax tree into a logic relationship information representation of the target execution statement.
3. The method according to claim 2, characterized in that The obtaining of the grammatical structure of the target execution statement includes: Get the grammar rule template file and grammar rule custom file of the variable execution statement; Combining the grammar rule template file with the grammar rule user-defined file to obtain a grammar rule file of a variable execution statement; Inputting the grammar rule file into a preset compiler, and having the preset compiler generate a grammar parsing class of the variable execution statement in the preset compiler based on the grammar rule file; The grammar parsing class in the preset compiler is used to parse the grammar of the target execution statement to obtain the grammatical structure of the target execution statement.
4. The method according to claim 2, characterized in that: The calling logic relationship generation tool converts the abstract syntax tree into the logic relationship information representation of the target execution statement, including: Acquire preset template data of the abstract syntax tree, wherein the preset template data includes optional fields, optional data types, and statement specification rules of the abstract syntax tree; Determine the fields and data types of the abstract syntax tree; When the field satisfies the optional field, the data type satisfies the optional data type, and the abstract syntax tree conforms to the statement specification rule, a logical relationship generation tool is called to convert the abstract syntax tree into a logical relationship information representation of the target execution statement.
5. The method according to claim 4, characterized in that The calling logic relationship generation tool converts the abstract syntax tree into the logic relationship information representation of the target execution statement, including: Determine each execution node in the abstract syntax tree, wherein the execution node includes execution syntax information and execution field information; A logic relationship generation tool is called, and different logic relationship expression information is used to replace the execution syntax information and the execution field information in the abstract syntax tree to obtain the logic relationship information representation of the target execution statement.
6. The method according to claim 1, characterized in that Before converting the logical relationship information representation into executable program code, the method further includes: At least one optimization execution means is executed on the logical relationship information representation to obtain an optimized logical relationship information representation, wherein the optimization execution means includes rule optimization and cost optimization.
7. The method according to claim 6, characterized in that The performing at least one optimization execution means on the logical relationship information representation to obtain an optimized logical relationship information representation includes: In the case where the optimization execution means includes rule optimization, obtaining a preset logical sequence rule represented by the logical relationship information; The preset logical sequence rule is adopted to optimize the logical sequence of the logical relationship information representation into a logical relationship information representation that satisfies the logical sequence rule, and the logical relationship information representation that satisfies the logical sequence rule is used as the optimized logical relationship information representation.
8. The method according to claim 6, characterized in that The performing at least one optimization execution means on the logical relationship information representation to obtain an optimized logical relationship information representation includes: In the case where the optimization execution means includes cost optimization, converting the logical relationship information representation to obtain a converted logical relationship information representation, and saving the logical relationship information representation; Calculating a first execution cost represented by the logical relationship information and a second execution cost represented by the converted logical relationship information by using a preset cost acquisition model; Determine a minimum execution cost between the first execution cost and the second execution cost, and determine a target logical relationship information representation of the minimum execution cost; The target logical relationship information representation is used as the optimized logical relationship information representation.
9. The method according to claim 1, characterized in that: The step of converting the logical relationship information representation into executable program code comprises: Converting the logical relationship expression information in the logical relationship information representation into physical execution field information and physical function expression information; Based on the physical execution field information and the physical function expression information, obtaining a physical operator of the logical relationship expression information; Based on the physical operator, obtaining a physical execution information representation of the target execution statement; The physical execution information representation is compiled using a preset executable code compiler to obtain the executable program code of the target execution statement.
10. The method according to claim 1, characterized in that The step of obtaining the data to be processed from a preset data source based on the executable program code includes: Obtaining data query conditions in the executable program code; The data query condition is pushed down to the preset data source, and the preset data source is queried for the data to be processed that meets the data query condition.
11. A variable data processing device, characterized in that: The device comprises: A request acquisition module, used for receiving a variable acquisition request, wherein the variable acquisition request includes a variable name; A logic representation module, used to query a target execution statement of the variable name based on the variable name, and convert the target execution statement into a corresponding logic relationship information representation; A data loading module, used to convert the logical relationship information representation into an executable program code, obtain the data to be processed from a preset data source based on the executable program code, and load the data to be processed into a local memory; The data processing module is used to execute the executable program code on the data to be processed in the local memory, obtain the execution result of the data to be processed, and use the execution result as the target variable information of the variable name.
12. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 10 are implemented.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
Citation Information
Patent Citations
Real-time risk control variable calculation method based on a distributed flow calculation engine
CN109799976A
Data source fusion calculation method, component and device
CN110647518A
Data query method and device, equipment and storage medium
CN114610747A
Index data acquisition method and device, computer equipment and storage medium
CN115220731A
Method for united query of multi-source heterogeneous database based on custom SQL (Structured Query Language) script
CN115269630A
Cited By
Data processing method and device based on dynamic code generation
CN120653258A
