A function registration method, apparatus, electronic device, and storage medium
By parsing and transforming the target function, the problem of low function registration efficiency is solved, and automated and efficient function registration is achieved.
Patent Information
- Application Number
- CN202310087804.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-20
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2043-01-20
AI Technical Summary
When the number of functions that need to be registered is too large, the existing technology requires each function to be written and registered manually, which results in low efficiency in function writing and registration.
By obtaining the initial function and its corresponding configuration file, the target expression is parsed and processed, and the initial parameter type of each parameter is converted to generate the target parameter type. The target function is then generated and registered to meet the function registration standard.
It can improve the efficiency of function registration without manual intervention, and generate and register functions that meet the standards.
Smart Images

Figure CN116088852B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a function registration method, apparatus, electronic device, and storage medium. Background Technology
[0002] Currently, users can write and register functions on the function registration platform through manual registration.
[0003] However, in the above method, when the number of functions to be registered is too large, each function needs to be written and registered manually, resulting in low efficiency in function writing and registration. Summary of the Invention
[0004] This application provides a function registration method, apparatus, electronic device, and storage medium, which solves the technical problem that when the number of functions to be registered is too large, each function needs to be manually written and registered, resulting in low efficiency in function writing and registration.
[0005] In a first aspect, this application provides a function registration method, comprising: obtaining an initial function and a configuration file corresponding to the initial function, the configuration file including the initial parameter type of each of the multiple parameters corresponding to the initial function; parsing the initial function to obtain a target expression, the target expression being used to characterize the operation rules of the initial function; converting the initial parameter type of each parameter to obtain the target parameter type of each parameter; generating a target function based on the target parameter type of each parameter and the target expression; and registering the target function.
[0006] Optionally, the electronic device stores a first correspondence, which includes multiple initial parameter types and target parameter types corresponding to each of the multiple initial parameter types. The conversion process of the initial parameter type of each parameter to obtain the target parameter type of each parameter may specifically include: determining the target parameter type of each parameter based on the initial parameter type of each parameter and the first correspondence.
[0007] Optionally, the aforementioned multiple parameters include input parameters and output parameters. Registering the target function may specifically include: parsing the target function to obtain its function name, the initial category name of the category to which the target function belongs, the target parameter type of the input parameter, and the target parameter type of the output parameter; sending a registration request to the target server, the registration request including the function name of the target function, the target category name corresponding to the target function, the target parameter type of the input parameter, and the target parameter type of the output parameter, wherein the target category name corresponding to the target function is the category name obtained after converting the initial category name of the category to which the target function belongs, and the registration request is used to request the target server to register the target function.
[0008] Optionally, the electronic device stores a second correspondence, which includes multiple initial category names and target category names corresponding to the multiple initial category names. Before sending a registration request to the target server, the function registration method further includes: determining the target category name corresponding to the target function based on the second correspondence and the initial category name of the category to which the target function belongs.
[0009] Secondly, this application provides a function registration apparatus, comprising: an acquisition module and a processing module; the acquisition module is configured to acquire an initial function and a configuration file corresponding to the initial function, the configuration file including the initial parameter type of each of the multiple parameters corresponding to the initial function; the processing module is configured to parse the initial function to obtain a target expression, the target expression being used to characterize the operation rules of the initial function; the processing module is further configured to convert the initial parameter type of each parameter to obtain the target parameter type of each parameter; the processing module is further configured to generate a target function based on the target parameter type of each parameter and the target expression; the processing module is further configured to register the target function.
[0010] Optionally, the electronic device stores a first correspondence, which includes multiple initial parameter types and target parameter types corresponding to each of the multiple initial parameter types. The function registration device further includes a determination module; the determination module is used to determine the target parameter type of each parameter based on the initial parameter type of each parameter and the first correspondence.
[0011] Optionally, the aforementioned parameters include input parameters and output parameters. Specifically, the processing module is used to parse the objective function to obtain the function name of the objective function, the initial category name of the category to which the objective function belongs, the target parameter type of the input parameter, and the target parameter type of the output parameter. The processing module is also specifically used to send a registration request to the target server. This registration request includes the function name of the objective function, the target category name corresponding to the objective function, the target parameter type of the input parameter, and the target parameter type of the output parameter. The target category name corresponding to the objective function is the category name obtained after converting the initial category name of the category to which the objective function belongs. This registration request is used to request the target server to register the objective function.
[0012] Optionally, the electronic device stores a second correspondence, which includes multiple initial category names and target category names corresponding to the multiple initial category names. The determining module is further configured to determine the target category name corresponding to the target function based on the second correspondence and the initial category name of the category to which the target function belongs.
[0013] Thirdly, this application provides an electronic device, including: a processor and a memory configured to store processor-executable instructions; wherein the processor is configured to execute the instructions to implement any of the optional function registration methods in the first aspect described above.
[0014] Fourthly, this application provides a computer-readable storage medium storing instructions that, when executed by an electronic device, enable the electronic device to perform any of the optional function registration methods described in the first aspect.
[0015] The function registration method, apparatus, electronic device, and storage medium provided in this application allow the electronic device to obtain an initial function and its corresponding configuration file. The electronic device then parses the initial function to obtain a target expression and converts the parameter types of each parameter to obtain the target parameter type for each parameter. Based on the target parameter type and target expression, a target function is generated and then registered. In this application, since the target parameter type of each parameter is a parameter type supported by the registered function, and the target expression characterizes the operation rules of the initial function, the electronic device converts the initial parameter type of each parameter to obtain the target parameter type, parses the initial function to obtain the target expression, and then generates and registers the function that meets the function registration standard, eliminating the need for manual registration and improving the efficiency of function registration. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.
[0017] Figure 1 A flowchart illustrating a function registration method provided in an embodiment of this application;
[0018] Figure 2 A flowchart illustrating another function registration method provided in this application embodiment;
[0019] Figure 3 A flowchart illustrating another function registration method provided in this application embodiment;
[0020] Figure 4 A flowchart illustrating another function registration method provided in this application embodiment;
[0021] Figure 5 This is a schematic diagram of the structure of a function registration device provided in an embodiment of this application;
[0022] Figure 6 This is a schematic diagram of another function registration device provided in an embodiment of this application. Detailed Implementation
[0023] The function registration method, apparatus, electronic device, and storage medium provided in the embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0024] The terms "first" and "second," etc., in the specification and drawings of this application are used to distinguish different objects, rather than to describe a specific order of objects. For example, "first correspondence" and "second correspondence" are used to distinguish different correspondences, rather than to describe a specific order of correspondences.
[0025] Furthermore, the terms “comprising” and “having”, and any variations thereof, used in the description of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may optionally include other steps or units not listed, or may optionally include other steps or units inherent to such processes, methods, products, or apparatus.
[0026] It should be noted that in the embodiments of this application, the words "exemplary" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of the words "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0027] The term "and / or" as used in this application includes using either one of two methods or using both methods simultaneously.
[0028] In the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0029] As described in the background art, in related technologies, when the number of functions to be registered is too large, each function needs to be manually written and registered, resulting in low efficiency in function writing and registration. Therefore, this application provides a function registration method, apparatus, electronic device, and storage medium. Since the target parameter type of each parameter is a parameter type supported by the registered function, and the target expression is used to characterize the operation rules of the initial function, the electronic device converts the initial parameter type of each parameter to obtain the target parameter type, parses the initial function to obtain the target expression, and then generates and registers the function that meets the function registration standard, without requiring manual registration, thus improving the efficiency of function registration.
[0030] The function registration method, apparatus, electronic device, and storage medium provided in this application are applied to a function registration scenario. When the electronic device obtains an initial function and the configuration file corresponding to the initial function, it can parse the initial function to obtain a target expression, and convert the initial parameter type of each parameter to obtain the target parameter type of each parameter. Then, based on the target parameter type and target expression of each parameter, a target function is generated and the target function is registered.
[0031] like Figure 1 As shown, the function registration method provided in this application embodiment may include S101-S105.
[0032] S101. The electronic device obtains the initial function and the configuration file corresponding to the initial function.
[0033] The configuration file includes the initial parameter type of each parameter in the multiple parameters corresponding to the initialization function.
[0034] It should be understood that the initial function corresponds to multiple parameters and the operational rules between these multiple parameters.
[0035] It is understandable that this configuration file is the configuration file corresponding to the initial function, and this configuration file is used to define the initial parameter type of each of the multiple parameters corresponding to the target function.
[0036] It should be understood that these multiple parameters may include input parameters and output parameters, and the output parameter can also be understood as the return value of the initial function.
[0037] It should be noted that the initialization function is a piece of code, and the configuration file is a text file that displays the initial parameter type of each of the multiple parameters in the form of text information.
[0038] For example, the initial parameter type can be date, timestamp, int, double, etc.
[0039] Optionally, the configuration file may also include the function name of the target function and the class name of the target function.
[0040] Optionally, the electronic device may acquire a JAR file containing the target function.
[0041] Optionally, the electronic device can obtain the initial function input by the user and the configuration file corresponding to the initial function.
[0042] Optionally, the electronic device can also receive an initial function and a configuration file corresponding to the initial function sent by other terminals.
[0043] S102. The electronic device performs analytical processing on the initial function to obtain the target expression.
[0044] The objective expression is used to characterize the operational rules of the initial function.
[0045] It should be understood that, since the objective function corresponds to multiple parameters and the operational rules between these multiple parameters, the electronic device can parse the operational rules of the initial function, i.e., the objective expression, from the initial function.
[0046] In this embodiment of the application, the operation rule of the initial function can also be understood as the business logic of implementing the initial function. For example, if the initial function is used to add two numbers, then the operation rule is to add the two input parameters to obtain an output parameter.
[0047] For example, the objective expression could be A+B=C.
[0048] It should be understood that the target expression may include operators such as +, -, *, or / .
[0049] Optionally, the target expression may also include conditional operators, such as >, <, =, ≥, or ≤.
[0050] Optionally, the electronic device may include a parser that can parse the initial function into a target expression.
[0051] S103. The electronic device performs a conversion process on the initial parameter type of each parameter to obtain the target parameter type of each parameter.
[0052] In this embodiment of the application, the initial parameter type of each parameter corresponding to the initial function may be different from the parameter type supported by the electronic device when registering the function. In this case, the electronic device can perform conversion processing on the initial parameter type of each parameter to obtain the parameter type supported by the registration function.
[0053] Optionally, the electronic device can register the initial function to different function registration platforms, such as Spark and Flink. These different function registration platforms support different parameter types, and the electronic device can convert the initial function type of each parameter to the parameter type supported by the function registration platform.
[0054] For example, the parameter type of parameter 1 corresponding to the initial function is int, and the electronic device can convert the parameter type of parameter 1 to integer.
[0055] Optionally, the electronic device may include an adapter that can convert the initial parameter type of each parameter to obtain the target parameter type of each parameter.
[0056] S104. The electronic device generates a target function based on the target parameter type and target expression for each parameter.
[0057] It should be understood that the objective function includes the multiple parameters and the operation rules between the multiple parameters. The electronic device can determine each parameter according to the parameter type of each parameter, and then generate the objective function according to each parameter and the operation rules corresponding to the initial function.
[0058] It is understandable that, since the target parameter type of each parameter is a parameter type supported when registering the function, the target function is a function that meets the function registration criteria.
[0059] Optionally, the objective function can be a UDF function or a UDAF function.
[0060] Optionally, the electronic device may include a converter that can convert the target expression into a target function based on the parameter type of each parameter.
[0061] S105. The electronic device registers the target function.
[0062] It is understandable that the objective function is a function that meets the function registration criteria, and the electronic device can register the objective function that meets the function registration criteria.
[0063] Specifically, the electronic device can register the function name, class name, input and output information, etc. of the target function to achieve the registration of the target function.
[0064] It should be understood that after the electronic device registers the target function, other users can call the target function to achieve the corresponding function.
[0065] Alternatively, the electronic device can also register the target function with the function registration interface of the function registration platform to complete the registration of the function.
[0066] Optionally, the electronic device may include a registrar, through which the electronic device can register the target function.
[0067] The technical solution provided by the above embodiments can bring at least the following beneficial effects: As shown in S101-S105, the electronic device can obtain the initial function and the configuration file corresponding to the initial function, then parse the initial function to obtain the target expression, and convert the parameter type of each parameter to obtain the target parameter type of each parameter. Based on the target parameter type and target expression of each parameter, a target function is generated, and then the target function is registered. In this application, since the target parameter type of each parameter is the parameter type supported by the registered function, and the target expression is used to characterize the operation rules of the initial function, the electronic device converts the initial parameter type of each parameter to obtain the target parameter type of each parameter, and after parsing the initial function to obtain the target expression, it generates and registers the function that meets the function registration standard, without the need for manual registration, thus improving the efficiency of function registration.
[0068] In one implementation of this application, the electronic device stores a first correspondence relationship, which includes multiple initial parameter types and target parameter types corresponding to each of the multiple initial parameter types, combined with... Figure 1 ,like Figure 2 As shown, the above-mentioned electronic device performs a conversion process on the initial parameter type of each parameter to obtain the target parameter type of each parameter, which may specifically include S1031.
[0069] S1031. The electronic device determines the target parameter type of each parameter based on the initial parameter type of each parameter and the first correspondence.
[0070] It is understandable that the initial parameter type includes all parameter types corresponding to the function, and these multiple initial parameter types may include the multiple target parameter types.
[0071] It should be understood that the target parameter type is a parameter type supported by the registration function.
[0072] Optionally, the electronic device can obtain the parameter types supported by the function registration platform, and then determine the parameter types supported by the function registration platform as the target parameter types.
[0073] Optionally, there may be multiple function registration platforms, and the electronic device can determine the correspondence between the parameter types supported by each function registration platform and the multiple initial parameter types.
[0074] Optionally, the electronic device can also obtain the target function registration platform for the initial function to be registered, and then the electronic device can determine the target parameter type of each parameter among the multiple parameters corresponding to the initial function according to the correspondence between the parameter types supported by the target function platform and the initial parameter type.
[0075] In one implementation of this application, the aforementioned multiple parameters include input parameters and output parameters, combined with Figure 1 ,like Figure 3 As shown, in one implementation of this application embodiment, the above-mentioned electronic device registration target function may specifically include S1051-S1052.
[0076] S1051. The electronic device performs parsing processing on the objective function to obtain the function name of the objective function, the initial category name of the category to which the objective function belongs, the target parameter type of the input parameters, and the target parameter type of the output parameters.
[0077] It is understandable that, since the objective function is generated by the electronic device based on the objective parameter type of each parameter and the objective expression, the electronic device can parse the objective function to obtain the objective parameter type of the input parameter and the objective parameter type of the output parameter.
[0078] In this embodiment of the application, the configuration file also includes the function name of the initial function and the initial category name of the category to which the initial function belongs, the function name of the target function is the function name of the initial function, and the initial category name of the category to which the target function belongs is the initial category name of the category to which the initial function belongs.
[0079] It should be understood that the electronic device can also parse the objective function to obtain the function name of the objective function and the initial category name of the category to which the objective function belongs.
[0080] S1052. The electronic device sends a registration request to the target server.
[0081] The registration request includes the function name of the target function, the target category name corresponding to the target function, the target parameter type of the input parameter, and the target parameter type of the output parameter. The target category name corresponding to the target function is the category name obtained by converting the initial category name of the category to which the target function belongs. The registration request is used to request the target server to register the target function.
[0082] It should be noted that the target server is the server corresponding to the target function registration platform, and the target function registration platform is the function registration platform to be registered for the initial function.
[0083] It is understandable that the initial category name of the category to which the objective function belongs is the initial category name of the category to which the initial function belongs. This initial category name may not meet the requirements of the function registration platform. In this case, the electronic device can convert the initial category name of the category to which the objective function belongs to obtain the target category name corresponding to the objective function.
[0084] In this embodiment of the application, the conversion of the initial category name of the category to which the target function belongs by the electronic device can also be understood as reflecting the initial category name of the category to which the target function belongs and instantiating it to obtain a class name, which is the target category name corresponding to the target function.
[0085] Optionally, the electronic device can obtain the target category name corresponding to the target function based on the Java reflection mechanism.
[0086] It should be understood that after the electronic device sends a registration request to the target server, the target server can register the target function.
[0087] Optionally, the electronic device can also store a registrar. The electronic device can configure a parsing standard for the registrar. Then, the registrar can parse the target function based on the parsing standard, obtain all the information of the target function, and then send all the information of the target function to the context of the relevant framework of the function registration platform and the registration interface of the underlying implementation of the relevant function in a pass-by-reference manner to complete the registration of the context.
[0088] In one implementation of this application, the electronic device stores a second correspondence, which includes multiple initial category names and target category names corresponding to the multiple initial category names, combined with... Figure 3 ,like Figure 4 As shown, before the aforementioned electronic device sends a registration request to the target server, the function registration method further includes S106.
[0089] S106. The electronic device determines the target category name corresponding to the target function based on the second correspondence and the initial category name of the category to which the target function belongs.
[0090] It should be understood that there is a one-to-one correspondence between the initial category name and the target category name. The electronic device can determine the target category name corresponding to the target function based on the second correspondence and the initial category name of the category to which the target function belongs.
[0091] This application embodiment can divide electronic devices and the like into functional modules according to the above method examples. For example, each function can be divided into its own functional module, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0092] When dividing each function into modules according to its corresponding function. Figure 5 A possible structural schematic diagram of the function registration device involved in the above embodiments is shown, such as... Figure 5 As shown, the function registration device 10 may include an acquisition module 101 and a processing module 102.
[0093] The acquisition module 101 is used to acquire the initial function and the configuration file corresponding to the initial function. The configuration file includes the initial parameter type of each parameter among the multiple parameters corresponding to the initial function.
[0094] The processing module 102 is used to parse the initial function to obtain the target expression, which is used to characterize the operation rules of the initial function.
[0095] The processing module 102 is also used to convert the initial parameter type of each parameter to obtain the target parameter type of each parameter.
[0096] The processing module 102 is also used to generate a target function based on the target parameter type of each parameter and the target expression.
[0097] The processing module 102 is also used to register the target function.
[0098] Optionally, the electronic device stores a first correspondence, which includes multiple initial parameter types and target parameter types corresponding to each of the multiple initial parameter types. The function registration device also includes a determination module 103.
[0099] The determination module 103 is used to determine the target parameter type of each parameter based on the initial parameter type of each parameter and the first correspondence.
[0100] Optionally, the above parameters include input parameters and output parameters.
[0101] The processing module 102 is specifically used to parse the objective function to obtain the function name of the objective function, the initial category name of the category to which the objective function belongs, the target parameter type of the input parameter, and the target parameter type of the output parameter.
[0102] The processing module 102 is further configured to send a registration request to the target server. The registration request includes the function name of the target function, the target category name corresponding to the target function, the target parameter type of the input parameter, and the target parameter type of the output parameter. The target category name corresponding to the target function is the category name obtained after converting the initial category name of the category to which the target function belongs. The registration request is used to request the target server to register the target function.
[0103] Optionally, the electronic device stores a second correspondence, which includes multiple initial category names and target category names corresponding to the multiple initial category names.
[0104] The determining module 103 is further configured to determine the target category name corresponding to the target function based on the second correspondence and the initial category name of the category to which the target function belongs.
[0105] When using integrated units, Figure 6 A possible structural schematic diagram of the function registration device involved in the above embodiments is shown. For example... Figure 6 As shown, the function registration device 20 may include a processing module 201 and a communication module 202. The processing module 201 can be used to control and manage the operation of the function registration device 20. The communication module 202 can be used to support communication between the function registration device 20 and other entities. Optionally, as... Figure 6 As shown, the function registration device 20 may further include a storage module 203 for storing the program code and data of the function registration device 20.
[0106] The processing module 201 can be a processor or a controller. The communication module 202 can be a transceiver, transceiver circuit, or communication interface, etc. The storage module 203 can be a memory.
[0107] In this configuration, when the processing module 201 is a processor, the communication module 202 is a transceiver, and the storage module 203 is a memory, the processor, transceiver, and memory can be connected via a bus. The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc.
[0108] It should be understood that in the various embodiments of this application, the order of the above-mentioned processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0109] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0110] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0111] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0112] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software programs, implementation can be, in whole or in part, in the form of a computer program product. This computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device containing one or more servers, data centers, etc., that can be integrated with the medium. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
[0113] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A function registration method, characterized in that, Applied to electronic devices, the method includes: Obtain the initial function and the corresponding configuration file for the initial function. The configuration file includes the initial parameter type of each parameter among multiple parameters corresponding to the initial function. The multiple parameters include input parameters and output parameters. The initial function is parsed to obtain a target expression, which characterizes the operation rules of the initial function; the target expression includes at least one of an operator and a conditional operator. The initial parameter type of each parameter is converted to obtain the target parameter type of each parameter; Based on the target parameter type and the target expression for each parameter, a target function is generated; the target function is a UDF function or a UDAF function. The objective function is parsed to obtain the function name of the objective function, the initial category name of the category to which the objective function belongs, the target parameter type of the input parameter, and the target parameter type of the output parameter; A registration request is sent to the target server. The registration request includes the function name of the target function, the target category name corresponding to the target function, the target parameter type of the input parameter, and the target parameter type of the output parameter. The target category name corresponding to the target function is the category name obtained after converting the initial category name of the category to which the target function belongs. The registration request is used to request the target server to register the target function.
2. The function registration method according to claim 1, characterized in that, The electronic device stores a first correspondence, which includes multiple initial parameter types and target parameter types corresponding to each of the multiple initial parameter types. The step of converting the initial parameter type of each parameter to obtain the target parameter type of each parameter includes: Based on the initial parameter type of each parameter and the first correspondence, the target parameter type of each parameter is determined.
3. The function registration method according to claim 1, characterized in that, The electronic device stores a second correspondence, which includes multiple initial category names and target category names corresponding to the multiple initial category names. Before sending a registration request to the target server, the method further includes: Based on the second correspondence and the initial category name of the category to which the objective function belongs, the target category name corresponding to the objective function is determined.
4. A function registration device, characterized in that, Applied to electronic devices, the function registration device includes: an acquisition module and a processing module; The acquisition module is used to acquire an initial function and a configuration file corresponding to the initial function. The configuration file includes the initial parameter type of each parameter among multiple parameters corresponding to the initial function. The multiple parameters include input parameters and output parameters. The processing module is used to parse the initial function to obtain a target expression, which is used to characterize the operation rules of the initial function; the target expression includes at least one of an operator and a conditional operator. The processing module is also used to convert the initial parameter type of each parameter to obtain the target parameter type of each parameter; The processing module is further configured to generate a target function based on the target parameter type of each parameter and the target expression; the target function is a UDF function or a UDAF function. The processing module is further configured to parse the objective function to obtain the function name of the objective function, the initial category name of the category to which the objective function belongs, the target parameter type of the input parameter, and the target parameter type of the output parameter; The processing module is further configured to send a registration request to the target server. The registration request includes the function name of the target function, the target category name corresponding to the target function, the target parameter type of the input parameter, and the target parameter type of the output parameter. The target category name corresponding to the target function is the category name obtained after converting the initial category name of the category to which the target function belongs. The registration request is used to request the target server to register the target function.
5. The function registration device according to claim 4, characterized in that, The electronic device stores a first correspondence relationship, which includes multiple initial parameter types and target parameter types corresponding to each of the multiple initial parameter types. The function registration device also includes a determination module. The determining module is used to determine the target parameter type of each parameter based on the initial parameter type of each parameter and the first correspondence.
6. The function registration device according to claim 4, characterized in that, The electronic device stores a second correspondence, which includes multiple initial category names and target category names corresponding to the multiple initial category names. The function registration device also includes a determination module. The determining module is further configured to determine the target category name corresponding to the target function based on the second correspondence and the initial category name of the category to which the target function belongs.
7. An electronic device, characterized in that, The electronic device includes: processor; A memory configured to store processor-executable instructions; The processor is configured to execute the instructions to implement the function registration method as described in any one of claims 1-3.
8. A computer-readable storage medium storing instructions thereon, characterized in that, When the instructions in the computer-readable storage medium are executed by an electronic device, the electronic device is able to perform the function registration method as described in any one of claims 1-3.
Citation Information
Patent Citations
Penetration system and method among multiple development languages based on dynamic analysis, medium and equipment
CN114489580A
Conversion file generation method and device, electronic equipment and storage medium
CN114579132A
Function conversion method and device, electronic equipment and storage medium
CN115033217A