Method and device for executing database operation instruction, equipment and storage medium
By receiving table operation instructions in the database system and determining the sub-operation set, and providing data to the AI server to obtain the AI model, the problems of complexity and inefficiency of AI-related processing operations in the prior art are solved, and a more efficient operation process is achieved.
Patent Information
- Application Number
- CN202311211296.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-08-31
- Filing Date
- 2023-09-19
- Publication Date
- 2025-02-28
AI Technical Summary
In existing database systems, AI-related processing requires users to input complex instructions, resulting in low operational efficiency.
By receiving table operation instructions, the corresponding sub-operation set is determined, including data processing operations and AI operations, data is provided to the AI server and model creation request is sent to obtain the trained AI model.
Users only need to enter simple table operation instructions to trigger complex operations, which improves operation efficiency and simplifies the creation and calling process of AI models.
Smart Images

Figure CN119537386A_ABST
Abstract
Description
[0001] This disclosure claims priority to Chinese patent application No. 202311117702.3 filed on August 31, 2023, with invention name “A database system and AI model training method”, the entire contents of which are incorporated by reference into this disclosure. Technical Field
[0002] The present disclosure relates to the field of computer technology, and in particular to a method, device, equipment and storage medium for executing database operation instructions. Background Art
[0003] Nowadays, artificial intelligence (AI) technology has been applied to various fields. AI-related processing is often involved in database systems, such as creating AI models, deleting AI models, etc. In database systems, AI-related processing is not just a simple data calculation process, but a complex processing process that combines database-related operations and AI-related operations. This complex processing process often requires users to enter a series of instructions to complete the execution. The command complexity is high, resulting in low operation efficiency. Summary of the invention
[0004] The present disclosure provides a method, apparatus, device and storage medium for executing database operation instructions, which can improve the operation efficiency of users.
[0005] In a first aspect, a method for executing a database operation instruction is provided, the method being applied to a database system, the method comprising: first receiving a first table operation instruction, wherein the first table operation instruction is used to add a column in a data table. Then, based on the first table operation instruction, a corresponding sub-operation set is determined, wherein the sub-operation set includes at least one data processing operation and at least one artificial intelligence (AI) operation, and at least one artificial intelligence (AI) operation includes obtaining an AI model based on training of data in a data table. Then, the data in the data table is provided to an AI server and a model creation request is sent to the AI server, wherein the model creation request is used to instruct the AI server to obtain an AI model based on training of data in the data table. Finally, the AI model is obtained.
[0006] The first table operation instructions are column addition instructions of the extended syntax, which trigger the creation of an AI model and train the AI model based on the first table operation instructions, and finally obtain a series of operations of the AI model. The obtained AI model includes the model algorithm type and model mathematical parameters of the AI model (this is the value after training), etc.
[0007] In this way, a series of complex operations including at least one AI operation and at least one data processing operation can be triggered to be automatically executed through table operation instructions. Users only need to input simple table operation instructions instead of a series of complex operation instructions, which can improve operation efficiency.
[0008] In one possible implementation, the first table operation instruction may include a first key field, and the first key field is used to define a column as a prediction column, and the prediction column is defined to record the reasoning result of the AI model. Based on the first key field, the first table operation instruction can be determined, and then the corresponding sub-operation set can be determined.
[0009] The first key field can be set to any field not used by the database operation instruction, and the first key field can be added at a specified position of the first table operation instruction.
[0010] In this way, the related processing logic of the above sub-operation set is triggered by identifying the first key field, which has simpler logic than other triggering methods and can improve processing efficiency.
[0011] In one possible implementation, after obtaining the trained AI model, an execution function of the AI model is further generated, and the execution function is used to call the AI model.
[0012] In this way, by calling the execution function to call the AI model, it is easier for the database server to perform AI operations.
[0013] In a possible implementation, a mapping relationship between columns of a data table and an AI model is recorded.
[0014] The database server maintains a table name-column name-function name mapping table for recording the correspondence between the execution function created by the column adding instruction of the extended syntax and the data table and column.
[0015] In this way, the AI model corresponding to the table operation instruction can be quickly determined through the mapping table, thereby improving the efficiency of the relevant operations on the AI model. Moreover, through a simple column addition instruction, a more complex sub-operation set can be triggered to execute, thereby improving the efficiency of the operation.
[0016] In a possible implementation manner, a column is added to the data table based on the first table operation instruction.
[0017] Based on the column adding instruction of the extended syntax, a corresponding column adding instruction of the general syntax is generated, and then a column is added to the data table.
[0018] In this way, a simple column adding instruction can trigger the execution of a more complex set of sub-operations, thereby improving operation efficiency.
[0019] In one possible implementation, when a call instruction to an execution function of an AI model is received, the corresponding processing may include: inputting the inference condition parameters in the call instruction into the AI model to obtain a first inference result, and feeding back the first inference result as a response to the call instruction.
[0020] In this way, direct function calls can simplify the instruction processing logic and improve the efficiency of the AI model reasoning process.
[0021] In one possible implementation, when a first field query instruction for a data table is received, the corresponding processing may include: based on the mapping relationship between the above-mentioned columns and the AI model, determining that the AI model needs to be used, and then inputting the query condition parameters in the first field query instruction into the AI model to obtain a second inference result, and feeding back the second inference result as a response to the first field query instruction.
[0022] If a row of data in the data table includes the query condition parameter, the field corresponding to the above column name in the row can be further determined. The field can be considered as the query target field of the above field query instruction, and the inference result can be added to the query target field.
[0023] If the query condition parameter is not included in any row of data in the data table, a new row can be created and the query condition parameter can be added in the row. Each query condition parameter includes a condition column name and a condition value. The field corresponding to the condition column name can be determined in the row and the corresponding condition value can be added to the field. In addition, the field corresponding to the column name of the prediction column in the row can be determined. The field can be considered as the query target field of the above field query instruction, and the inference result can be added to the query target field.
[0024] In this way, through the field query instruction, a series of complex operations including at least one AI operation and at least one data processing operation can be triggered to be automatically executed. The user only needs to enter a simple field query instruction instead of a series of complex operation instructions, which can improve the operation efficiency.
[0025] In one possible implementation, after obtaining the inference result of the AI model, the inference result of the AI model is recorded in the above prediction column.
[0026] In this way, a simple field query instruction can trigger the execution of a more complex set of sub-operations, thereby improving operational efficiency.
[0027] In one possible implementation, when a second field query instruction for a column of a data table is received, the corresponding processing may include: determining a target inference result from the column based on the query condition parameters in the second field query instruction, and then feeding back the target inference result as the query result of the second field query instruction.
[0028] In this way, if AI model inference has been performed based on the first field query instruction and the inference results have been filled in the data table, then when the second field query instruction with the same query condition parameters as the first field query instruction is executed subsequently, there is no need to perform AI model inference again, and data query can be simply performed, which can improve processing efficiency.
[0029] In a possible implementation, when the second table operation instruction is received, the AI model and / or the execution function of the AI model is deleted based on the mapping relationship between the column and the AI model. The second table operation instruction is used to delete a column in the data table.
[0030] The second table operation instruction may be a column deletion instruction of an extended syntax, which may include the first key field.
[0031] In this way, users only need to enter simple column deletion instructions to perform more complex query and deletion operations, which can improve operational efficiency.
[0032] In a possible implementation, the model creation request is further used to instruct the AI server to obtain data from a third-party storage service. The process of providing the data in the data table to the AI server may include: storing the data in the third-party storage service.
[0033] The third-party storage service may be an object storage service (OBS) or a dataset.
[0034] In addition, in addition to transmitting data through a third-party storage server, the corresponding data can also be transmitted directly.
[0035] In this way, the reliability of data transmission can be improved.
[0036] In a possible implementation, before receiving the first table operation instruction, a table creation process may be performed, including: receiving a table creation instruction, wherein the table creation instruction is used to create a data table, and a second key field corresponding to the target column is added to the table creation instruction. Create a data table, and determine indication information based on the second key field, wherein the indication information is used to indicate that the target column in the data table is used to store training calibration data. After determining the corresponding sub-operation set, the indication information is also provided to the AI server.
[0037] In this way, the training calibration data can be specified more flexibly.
[0038] In a second aspect, a device for executing database operation instructions is provided, the device comprising at least one module, and the at least one module is used to implement the method provided by the above-mentioned first aspect and its possible implementation methods.
[0039] In a third aspect, a computing device cluster is provided, comprising at least one computing device, each computing device comprising a processor and a memory; the processor of at least one computing device is used to execute instructions stored in the memory of at least one computing device, so that the computing device cluster executes the method provided by the above-mentioned first aspect and its possible implementation methods.
[0040] In a fourth aspect, a computer-readable storage medium is provided, which includes computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster executes the method provided by the above-mentioned first aspect and its possible implementation manner.
[0041] In a fifth aspect, a computer program product comprising instructions is provided. When the instructions are executed by a computing device cluster, the computing device cluster executes the method provided by the first aspect and possible implementations thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 is a structural diagram of a data system provided by an embodiment of the present disclosure;
[0043] Figure 2 is a flow chart of a method for executing a database operation instruction provided by an embodiment of the present disclosure;
[0044] Figure 3 is a flow chart of a method for executing a column adding instruction provided by an embodiment of the present disclosure;
[0045] Figure 4 is a flow chart of a method for executing a column deletion instruction provided by an embodiment of the present disclosure;
[0046] Figure 5 is a flow chart of a method for executing a field query instruction provided by an embodiment of the present disclosure;
[0047] Figure 6 is a flow chart of a method for executing a function call instruction provided by an embodiment of the present disclosure;
[0048] Figure 7 is a flow chart of a method for executing table creation instructions provided by an embodiment of the present disclosure;
[0049] Figure 8 It is a structural schematic diagram of a device for executing database operation instructions provided by an embodiment of the present disclosure;
[0050] Fig. 9 is a schematic diagram of a computing device provided by an embodiment of the present disclosure;
[0051] Fig.10is a schematic diagram of a computing device cluster provided by an embodiment of the present disclosure;
[0052] Fig.11 It is a schematic diagram of a computing device cluster provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0053] In order to make the objectives, technical solutions and advantages of the present disclosure more clear, the embodiments of the present disclosure will be further described in detail below with reference to the accompanying drawings.
[0054] The concepts involved in this disclosure are explained below:
[0055] database
[0056] A database is a collection of data with a specified data structure. The data in a database is generally stored in a two-dimensional table.
[0057] Table operation instructions
[0058] Table operation instructions are instructions for performing table operations in a database. Table operations can be creating tables, adding columns, deleting columns, adding data, deleting data, querying data, etc. A Structured Query Language (SQL) statement, which is a database query and programming language used to access data and query, update, and manage databases.
[0059] AI Operation
[0060] AI operations are operations related to machine learning, such as creating AI models (obtaining AI models that can be used for reasoning through training), reasoning, deleting AI models, and so on.
[0061] Training calibration data
[0062] Training calibration data is the data used as the reference value (or true value) of the output data during the AI model training process, which is generally calibrated manually or automatically by an algorithm. For example, for an AI model that recognizes the type of object in an image, if there is a car in a sample image, the corresponding training calibration data can be a number representing the "car type".
[0063] Metadata for AI models
[0064] Metadata is data that describes data and can be considered as attribute information of data. The metadata of an AI model is the attribute information of the AI model, such as the model algorithm type of the AI model, etc.
[0065] Asynchronous mode and synchronous mode
[0066] Asynchronous mode refers to running multiple clients on the user terminal. Multiple clients can send operation instructions to the database server respectively. The database server can process each operation instruction in parallel, for example, the creation process of multiple AI models can be executed in parallel. The processing process of each operation instruction can refer to the processing flow of the method for executing database operation instructions provided in the embodiment of the present disclosure. The user terminal can display the execution status of each operation instruction, for example, AI model training, AI model creation completed, etc.
[0067] Synchronous mode refers to running a client on the user terminal. Through the client, one or more operation instructions can be sent to the database server. When multiple operation instructions are sent, the database server processes the multiple operation instructions in sequence. The processing process of each operation instruction can refer to the processing flow of the method for executing database operation instructions provided in the embodiment of the present disclosure. For the operation instructions that have been executed, the user terminal can display the completion status, and for the operation instructions that have not been executed, the user terminal can display the blocking status.
[0068] The present disclosure provides a method for executing a database operation instruction. The method can be applied to a data system composed of a database server (or database system) 110 and an AI server (or AI system) 120. The structure of the data system is as follows: Figure 1 The data system may also include an OBS device 130, a metadata service device 140, a dataset device 150, etc. The following introduces each component of the data system:
[0069] The database server 110 can be a server cluster or a separate device. The database server is generally used for storing massive data and for processing database operation instructions sent by user devices. In the case of a server cluster, the database server can further include a scheduling server 111 and a storage engine server 112.
[0070] The scheduling server 111 can be responsible for instruction parsing, task allocation, task monitoring, execution control, etc. At the same time, the scheduling server can conveniently implement operations such as task execution, re-running, and termination, and can conveniently view execution logs and timely monitor and manage task execution.
[0071] The storage engine server is the underlying component of the database and the core of the database. The main processing of the storage engine server can include creating, querying, updating, and deleting data tables.
[0072] The AI server 120 may also be referred to as an AI engine server, which is a framework that can support users to develop machine learning and deep learning model training operations, such as TensorFlow, MXNet, etc. The AI engine server can be used for various AI operations, such as creating AI models.
[0073] The OBS device 130 is a third-party storage device that can provide large-capacity, secure, highly reliable and low-cost data storage. There is no need to consider capacity limitations during use and a variety of storage types are provided to meet user demands for various business scenarios.
[0074] The meta service device 140 is mainly used to store metadata, and in the embodiment of the present disclosure, it can be used to store metadata of the AI model.
[0075] The dataset device 150 is also a third-party storage device, generally used to build a small database.
[0076] In database applications, users hope to use simple database operation instructions to trigger the execution of some more complex combined operations, especially combined operations including AI operations, to improve operation efficiency and lower the threshold for using AI functions. To this end, the present disclosure provides a method for executing database operation instructions, such as Figure 2 As shown, the following steps are included:
[0077] 201, receiving a table operation instruction.
[0078] The table operation instruction may be a table operation instruction that complies with general SQL syntax rules. Alternatively, the table operation instruction may also be a table operation instruction with extended syntax, and the extension method is as follows: Method 1, the table operation instruction may be a table operation instruction obtained by adding a first key field to a table operation instruction that complies with general SQL syntax rules, and the first key field may be added to a specified position of the table operation instruction; Method 2, the table operation instruction may be a table operation instruction obtained by replacing a specified field with the first key field in a table operation instruction that complies with general SQL syntax rules.
[0079] The table operation instructions of the embodiments of the present disclosure mainly take column adding instructions, column deleting instructions, and field query instructions as examples. Other situations are handled similarly and will not be described in detail. The following are examples of several table operation instructions, wherein the column adding instruction is a column adding instruction of extended syntax, and its form is a table operation instruction obtained by adding the first key field to the specified position of the column adding instruction of general syntax. The column deleting instruction is a column deleting instruction of extended syntax, and its form is a table operation instruction obtained by adding the first key field to the specified position of the column deleting instruction of general syntax. The field query instruction is a field query instruction of general syntax. The first key field can be set to any field that is not used by any database operation instruction. The embodiment of the present disclosure takes the first key field as PREDICT as an example to explain the solution in detail. Other situations are similar and will not be described in detail. The specific form is as follows:
[0080] Column addition instruction: ALTER TABLE table_name ADD PREDICT column_name datatype
[0081] Among them, ALTER TABLE table_name ADD column_name datatype is a table operation instruction of general syntax. In this instruction, the first key field PREDICT is added, and the first key field is placed after ADD to obtain a column adding instruction of extended syntax. table_name is the table name of the data table to which the column is added, column_name is the name of the newly added column, and datatype is the format requirement of the data in the newly added column. For example, if datatype is char(20), it means that each data in the column is in character format, and the maximum length of the string of the data is 20.
[0082] Column deletion command: ALTER TABLE table name DROP PREDICT COLUMN column name
[0083] Among them, ALTER TABLE table_name DROP COLUMN column_name is a table operation instruction of general syntax. In this instruction, the first key field PREDICT is added, and the first key field is placed after DROP to obtain a column deletion instruction of extended syntax. table_name is the table name of the data table to delete the column, and column_name is the name of the column to be deleted.
[0084] Field query instruction: SELECT column_name FROM table_name AS SELECT……
[0085] The form of the field query instruction is a table operation instruction in general syntax. table_name is the table name of the data table for field query, and column_name is the column name corresponding to the query field. The field after AS SELECT is the query condition parameter, which can include one or more query condition parameters, and each query condition parameter includes the condition column name and condition value.
[0086] 202. Determine a corresponding sub-operation set based on the received table operation instruction.
[0087] The sub-operation set may include at least one AI operation, and in addition to the AI operation, may also include at least one data processing operation, for example, adding or deleting a column in a table, updating a mapping table, and the like.
[0088] In the database server, a correspondence between table operation instructions and sub-operation sets may be stored. In this correspondence, different table operation instructions may correspond to different sub-operation sets. The sub-operation sets corresponding to various table operation instructions will be described in detail in the following content.
[0089] After the database server receives the table operation instruction, for the table operation instruction of the extended syntax, the first key field can be identified in the table operation instruction to trigger the acquisition of the corresponding sub-operation set. This case will be described in detail in the following content in conjunction with the execution process of the column adding instruction and the column deleting instruction. For the table operation instruction of the general syntax, a judgment can be made based on certain parameter information in the table operation instruction to trigger the acquisition of the corresponding sub-operation set. This case will be described in detail in the following content in conjunction with the execution process of the field query instruction.
[0090] 203, execute the sub-operation set.
[0091] Different sub-operations may have different execution entities. Some sub-operations are executed in the database server, and some sub-operations are executed in the AI server. The scheduling server in the database server can assign different sub-operations to corresponding execution devices. Then the corresponding device executes the assigned sub-operation. During the execution of the sub-operation set, if a sub-operation is executed incorrectly, the sub-operation set can be re-executed or the sub-operation can be re-executed according to the settings.
[0092] By adopting the above method, a series of complex operations including at least one AI operation and at least one data processing operation can be triggered to be automatically executed through table operation instructions. The user only needs to input simple table operation instructions instead of a series of complex operation instructions, which can improve the operation efficiency.
[0093] There are many possible situations for the above table operation instructions, and the corresponding sub-operation sets are also different, and the AI operations in the sub-operation sets are also different. The following is a detailed introduction to several of them:
[0094] (1) In case 1, the table operation instruction is a column adding instruction, and the AI operation includes creating an AI model.
[0095] When the scheduling server receives the table operation instruction, the parsing process of the table operation instruction can be as follows:
[0096] When the scheduling server parses the instruction, it first reads the instruction name in the table operation instruction. When the ALTERTABLE and ADD fields are read, it can be determined that the instruction is a column operation instruction. Then it is further determined whether there is PREDICT after the ADD field. If so, it is determined that the instruction is a column addition instruction with extended syntax.
[0097] In the scheduling server, different sub-operation sets are set for table operation instructions of different extended syntaxes. The sub-operation set corresponding to the column adding instruction of the extended syntax may include sub-operations such as creating an AI model, updating a mapping table, and adding a column. The execution process of the sub-operation set can be as follows: Figure 3 As shown, the following steps are included:
[0098] 301, create AI model.
[0099] The scheduling server can add instructions based on the columns of the above extended syntax to generate instructions for creating an AI model. The instructions for creating an AI model can be in the following form:
[0100] CREAT MODEL model_name WITH()AS SELECT*FROM table_name
[0101] In this instruction, CREAT MODEL is the instruction name, WITH() is used to extract the relevant attribute parameters of the AI model, and ASSELECT*FROM is used to extract the data source for training the AI model. The characters of these three fields are fixed and can be called fixed fields.
[0102] model_name, the fields in brackets after WITH, and table_name are parameter fields. The contents of the parameter fields can be obtained from the column operation instructions or set in advance.
[0103] model_name is the name of the AI model to be created. There are many ways to set the name. For example, you can use a sequence number or a string plus a sequence number, it can be a combination of a table name and a column name in a column operation instruction, and so on.
[0104] The fields in brackets after WITH are attribute parameters of the AI model, such as training mode and model algorithm type. Attribute parameters can be preset, such as presetting the training mode to asynchronous mode or synchronous mode. Attribute parameters can also be obtained in the column adding instruction, such as the column adding instruction has a parameter field, which carries the model algorithm type as a convolutional neural network. Attribute parameters can also be determined by some automated machine learning technologies, for example, the model algorithm type is automatically determined based on the data type in the data table. The automated machine learning technology used can be automated machine learning (AutoML) or smart machine learning (SmartML).
[0105] table_name is the name of the data table where the data for training the AI model is located. The table_name can be obtained from the table_name in the column adding instruction.
[0106] After generating the instruction to create an AI model, it can be further parsed to obtain a series of sub-operations. The specific execution process of the sub-operations can be as follows:
[0107] 3011, providing the data in the data table to the AI server.
[0108] The data table is in the form of a two-dimensional table. The embodiment of the present disclosure takes the following data table as an example to provide a detailed description of the solution.
[0109] The data table is named iris, and has five columns, namely sepal length (sepal_length), sepal width (sepal_width), petal length (petal_length), petal width (petal_width), and type (output_label). The data corresponding to output_label is the training calibration data.
[0110] The form of the data table is shown in Table 1:
[0111] Table 1
[0112]
[0113] The scheduling server can notify the storage engine server to directly send the data in the data table to the AI server. For example, this processing method can be used when the amount of data in the data table is small. Alternatively, the scheduling server can first store the data in the data table to a third-party storage device, and then notify the AI server to obtain the corresponding data from the third-party storage device. For example, this processing method can be used when the amount of data in the data table is large. The following is an explanation of the processing method using a third-party storage device:
[0114] The scheduling server can instruct the storage engine server to create a foreign table on a third-party storage device and add the data in the data table to the foreign table. The third-party storage device can be an OBS device or a dataset device, etc. The name of the foreign table can be set by adding the external field after the table name of the column adding instruction, or other setting methods can be used. The data structure of the foreign table can be the same as the data structure of the data table in the column adding instruction. The storage engine server can add all the data in the data table to the foreign table, or select the data of some columns based on automated machine learning technology and add them to the foreign table.
[0115] You can set an indication information for the data table in advance to indicate the target column in the data table as the training calibration data. The indication information can be set through the table creation instruction when creating the data table (which will be described in detail later), or it can be preset uniformly (for example, uniformly setting the first column as the training calibration data). When creating a foreign table, the indication information is also set for the foreign table.
[0116] The command to create a foreign table can be: CREAT EXTERNAL TEMP TABLE external_table_name
[0117] external_table_name is the name of the external table to be created. For example, the external table name is iris_external.
[0118] The instruction to fill the data in the data table into the external table is: INSERT INTO external_table_name SELECT * FROM table_name table_name is the name of the data table, for example, the table name can be iris.
[0119] 3012, sending a model creation request to the AI server.
[0120] The scheduling server sends a model creation request to the AI server. The model creation request may carry the attribute parameters of the AI model (which can be obtained from the above-mentioned CREAT MODEL instruction), and may also carry the storage location information of the above-mentioned appearance, such as the address of the third-party storage device, the storage path, the name of the appearance, etc.
[0121] The AI server can obtain the data in the appearance from a third-party storage device based on the storage location information of the appearance, and can also obtain the above-mentioned indication information. Based on the indication information, it can be determined which column of data in the appearance is the training calibration data, and then the data in the appearance other than the training calibration data can be determined as the sample input data. Furthermore, the AI server can create an initial AI model that conforms to the above-mentioned attribute information (i.e., an AI model that has not been trained and adjusted, and the mathematical parameters of the model are all initial values), and then train the initial AI model based on the sample input data and the training calibration data. During the training process, the storage engine server can periodically send status query requests to the AI server, and the AI server can feedback the training status to the storage engine server, such as training in progress, training completed, etc.
[0122] After the AI server completes training, the model file of the trained AI model can be sent to a third-party storage device. The model file may include the model algorithm type, model mathematical parameters (these are the values taken after training) and feature data (such as the accuracy of the AI model, etc.). The third-party storage device can be pre-specified by the storage engine server, and can be an OBS device or a dataset device. The third-party storage device can be the same as or different from the third-party storage device of the storage table.
[0123] After the storage engine server finds that the current training status is training completed, it can obtain the storage location information of the model file from the AI server, such as the address, storage path, and file name of the third-party storage device.
[0124] 3013, obtain the AI model.
[0125] The storage engine server obtains the model file of the AI model from the third-party storage device based on the storage location information. Alternatively, the AI server may also send the model file directly to the storage engine server.
[0126] Then, the storage engine server stores the model file to the third-party storage device bound to the storage engine server (the third-party storage device mentioned above temporarily stores the model file, and the third-party storage device here stores the model file for a long time until the AI model is deleted), and generates metadata for the AI model based on the current storage location information. The metadata can also include other attribute information of the AI model, such as name, accuracy, etc. The storage engine server can store the metadata, or the storage engine server sends the metadata to the scheduling server, which sends the metadata to the metaservice device for storage.
[0127] In the above processing, the storage engine server queries the training status, obtains the model file, stores the model file, generates metadata, stores metadata, etc. Some or all of these processes can also be performed by the scheduling server.
[0128] 3014, generate the execution function of the AI model.
[0129] The scheduling server can generate an execution function of the AI model based on the model algorithm type and model mathematical parameters, and store the execution function in the storage engine server.
[0130] 302. Update the table name-column name-function name mapping table.
[0131] The scheduling server can maintain a mapping table of table name-column name-function name to record the correspondence between the execution function created by the column adding instruction of the extended syntax and the data table and column. After generating the execution function of the AI model, the table name, column name and function name of the execution function in the column adding instruction can be added to the mapping table accordingly. When the execution function is subsequently called to perform inference on the AI model or when the AI model is deleted, the mapping table can be used for related queries.
[0132] 303, add columns to the data table.
[0133] The scheduling server may generate a corresponding general syntax column adding instruction based on the above extended syntax column adding instruction. For example, the corresponding processing may be to remove the first key field in the extended syntax column adding instruction. The generated instruction may be as follows:
[0134] ALTER TABLE table_name ADD column_name datatype
[0135] Furthermore, a column adding instruction of this general syntax can be executed to add a column to a corresponding data table.
[0136] For example, add a prediction column predict1 to the data table shown in Table 1 above, and the resulting data table is shown in Table 2. The corresponding instructions are as follows:
[0137] ALTER TABLE iris ADD predict1 char(20)
[0138] Table 2
[0139]
[0140] In some application scenarios, the above-mentioned step 302 and / or step 303 may not be performed. For example, the generation rule of the function name is to combine the table name and column name corresponding to the column addition instruction, and similar function name generation rules are also used in the reasoning and deletion of the AI model. In this case, step 302 may not be performed. For another example, if it is not necessary to record the reasoning results in the data table when reasoning based on the AI model in a certain application scenario, the processing of step 303 may not be performed. In addition, there is no necessary temporal sequence relationship between step 303 and steps 301-302. Step 303 can be executed first or later, and can also be interspersed at any time during the process of steps 301-302.
[0141] In the disclosed embodiment, the AI model can also be retrained by a similar processing method as described above. When the data in the data table changes to a certain extent (for example, a large amount of data is added), the user can enter a similar column adding instruction of the extended syntax again to trigger the AI model retraining. The retraining process is similar to the above process, and please refer to the above related content. Here, the column adding instruction of the extended syntax currently input is called the first column adding instruction, and the column adding instruction of the extended syntax input in the above process is called the second column adding instruction.
[0142] The first table name in the first column adding instruction and the second table name in the second column adding instruction are the same. The first column name in the first column adding instruction and the second column name in the second column adding instruction can be the same or different. When the first column name and the second column name are different, the process of executing the first column adding instruction and the second column adding instruction will create a first AI model and a second AI model respectively, which can be considered as different versions of the same AI model, corresponding to different columns in the same data table. When the first column name and the second column name are the same, after executing the second column adding instruction to generate the second AI model, the first AI model can be replaced by the second AI model.
[0143] The trigger for retraining the AI model can be a manual input command from the user or an automatic trigger. The database server can monitor the data in the above data table. When it is detected that the data in the data table meets the specified change conditions, the AI model is retrained based on the current data in the data table. The change condition can be that the data that has changed (added or modified) exceeds the specified number or proportion, or the change value of the distribution information of one or more columns of data exceeds the specified threshold. The distribution information can be the existence ratio of various values.
[0144] (2) Case 2: The table operation instruction is a column deletion instruction. The AI operation includes the table name and column in the column deletion instruction. Name the AI model.
[0145] When the scheduling server receives the table operation instruction, the parsing process of the table operation instruction can be as follows:
[0146] When the scheduling server parses the instruction, it first reads the instruction name in the table operation instruction. When it reads the ALTERTABLE, DROP, COLUMN fields, it can be determined that the instruction is a column deletion instruction. Then it further determines whether there is PREDICT after the DROP field. If so, it is determined that the instruction is a column deletion instruction with extended syntax.
[0147] In the scheduling server, different sub-operation sets are set for table operation instructions of different extended syntaxes. The sub-operation set corresponding to the column deletion instruction of the extended syntax may include sub-operations such as determining an AI model and deleting an AI model. The execution process of the sub-operation set may be as follows: Figure 4 As shown, the following steps are included:
[0148] 401. Determine the AI model to be deleted based on the table name and column name of the data table in the column deletion instruction.
[0149] Method 1: The scheduling server stores a mapping table of table name-column name-function name. The scheduling server can obtain the table name and column name of the data table in the column deletion instruction, and then search for the function name corresponding to the table name and column name in the mapping table. This is the function name of the execution function of the AI model, which can also be considered as the name of the AI model.
[0150] Method 2: When the name of the AI model is a combination of the table name and the column name of the data table when creating the AI model, the name of the AI model can be obtained by directly combining the table name and the column name of the data table in the column deletion instruction.
[0151] 402: Delete the metadata of the AI model and delete the execution function of the AI model.
[0152] The scheduling server can send a metadata deletion message carrying the name of the AI model to the meta service device, and the meta service device deletes the metadata corresponding to the AI model name. The scheduling server can send an execution function message carrying the name of the AI model to the storage engine server, and the storage engine server deletes the execution function corresponding to the AI model name.
[0153] 403. In the mapping table, the mapping relationship between the table name, the column name and the function name in the column deletion instruction is deleted.
[0154] The scheduling server may delete the corresponding items of the table name, column name, and function name found in step 401 in the above mapping table.
[0155] 404. Delete the corresponding column in the corresponding table based on the table name and column name in the column deletion instruction.
[0156] The scheduling server may generate a corresponding column deletion instruction of general syntax based on the column deletion instruction of the extended syntax. For example, the corresponding processing may be to remove the first key field in the column deletion instruction of the extended syntax. The generated instruction may be as follows:
[0157] ALTER TABLE table_name DROP COLUMN column_name
[0158] Furthermore, a column deletion instruction of this general syntax can be executed to delete a column in a corresponding data table.
[0159] For example, in the data table shown in Table 2, delete the prediction column predict1, and the resulting data table is shown in Table 1. The corresponding instructions are as follows:
[0160] ALTER TABLE iris DROP COLUMN predict1
[0161] In some application scenarios, the above step 403 and / or step 404 may not be performed. For example, in the case of the above method 2, the data system does not have the above mapping table, in which case step 403 may not be performed. For another example, when creating an AI model, no columns are added to the above data table, in which case step 404 may not be performed. In addition, there is no necessary temporal sequence relationship between steps 402, 403, and 404, and any step may be performed first or later.
[0162] (3) Case 3: The table operation instruction is a field query instruction, and the AI operation includes performing AI model reasoning.
[0163] When the scheduling server receives the table operation instruction, the parsing process of the table operation instruction can be as follows:
[0164] When the scheduling server performs instruction parsing, it first reads the instruction name in the table operation instruction. When it reads the SELECT, FROM, and AS SELECT fields, it can be determined that the instruction is a field query instruction. The field query instruction is an instruction for querying data in a data table, and the form can be: SELECT predict1 FROM iris AS SELECT... Then, the scheduling server further determines whether the table name-column name-function name mapping table stored in itself contains a mapping relationship between a function name and the table name and column name in the instruction. If so, the scheduling server determines the sub-operation set corresponding to the field query instruction, and then executes the sub-operation set. The execution process of the sub-operation set can be as follows: Figure 5 As shown, the following steps are included:
[0165] 501. Determine the execution function of the AI model based on the table name and column name in the field query instruction.
[0166] Method 1: The scheduling server stores a mapping table of table name-column name-function name. The scheduling server can obtain the table name and column name of the data table in the field query instruction, and then find the function name corresponding to the table name and column name in the mapping table, which is the function name of the execution function of the AI model.
[0167] Method 2: When the name of the AI model is a combination of the table name and column name of the data table when creating the AI model, the name of the AI model can be directly combined according to the table name and column name of the data table in the field query instruction, which is the function name of the execution function of the AI model.
[0168] 502, input the query condition parameters in the field query instruction into the execution function of the AI model to obtain the inference result.
[0169] The scheduling server can obtain the query condition parameters in the field query instruction. Then, the query condition parameters are set as the function input data. Then, an inference notification is sent to the storage engine server, and the inference notification carries the function name and function input data of the execution function of the AI model. In addition, the inference notification can also carry the above-mentioned table name and column name.
[0170] The storage engine server calls the execution function of the AI model based on the function name, and inputs the function input data into the execution function to obtain the inference result. Among them, the function input data is the query condition parameter, and the query condition parameter includes the condition column name and condition value. The condition column name is the parameter name of the execution function, and the condition value is the corresponding parameter value.
[0171] The storage engine server can determine the corresponding data table based on the table name, query the function input data (i.e., query condition parameters) in the data table, and perform different processing based on different query results:
[0172] In case one, if a row of data in the data table includes the function input data, the field corresponding to the above column name in the row can be further determined. The field can be considered as the query target field of the above field query instruction, and then the inference result can be added to the query target field.
[0173] For example, the query condition parameters are sepal_length 4.5, sepal_width 3.1, petal_length 1.1, petal_width 0.20. There is a row of data in the data table corresponding to Table 2, in which the field value corresponding to the sepal_length column is 4.5, the field value corresponding to the sepal_width column is 3.1, the field value corresponding to the petal_length column is 1.1, the field value corresponding to the petal_width column is 0.20, the output_label column is empty, and the predict1 column is empty. Executing the field query instruction will fill in the inference result 2 (category number) in the field corresponding to the predict1 column of the row (that is, the query result field), as shown in Table 3.
[0174] Table 3
[0175]
[0176] Case 2: If the function input data is not included in any row of data in the data table, you can create a new row and add the function input data (i.e., query condition parameters) in the row. As mentioned earlier, each query condition parameter includes a condition column name and a condition value. You can determine the field corresponding to the condition column name in the row and add the corresponding condition value to the field. In addition, you can determine the field corresponding to the above column name in the row. This field can be considered as the query target field of the above field query instruction, and then you can add the inference result to the query target field.
[0177] For example, the query condition parameters are sepal_length 4.5, sepal_width 3.1, petal_length 1.1, petal_width 0.20, and none of the rows of data in the data table corresponding to Table 2 includes these query condition parameters. You can create a new row to fill in these query condition parameters, and fill in the inference result 2 (category number) in the field corresponding to the predict1 column (that is, the query result field), as shown in Table 4.
[0178] Table 4
[0179]
[0180]
[0181] 503, the inference result is fed back as the query result of the field query instruction.
[0182] The storage engine server feeds back the inference results to the user.
[0183] In the disclosed embodiment, considering that executing a field query instruction will fill in the inference results in the data table, and may also fill in the query condition parameters, optionally, when receiving the field query instruction, after determining that there is a table entry in the table name-column name-function name mapping table that includes the table name and column name in the instruction, it can be determined whether there is a row in the data table of the table name that meets the query condition parameters. If so, it is further determined whether the field corresponding to the column name in the row (i.e., the query result field) is empty. If it is empty, it can be processed according to the above process. If it is not empty, the data of the field can be directly read and fed back as the query result. According to this processing method, if the field query instruction is executed according to the above process, and the same field query instruction is executed again, the AI model reasoning will not be triggered, and only a simple data query will be performed.
[0184] In addition to triggering AI model reasoning through field query instructions as mentioned above, AI model reasoning can also be triggered directly by executing function call instructions.
[0185] The format of the call instruction is: SELECT func_name inference condition parameter
[0186] func_name is the name of the execution function of the AI model. The inference condition parameters are similar to the query condition parameters described above. For example, if the execution function name is iris_predice1, the inference condition parameters are sepal_length 4.5, sepal_width 3.1, petal_length 1.1, and petal_width 0.20.
[0187] Because the AI model can be retrained in the embodiments of the present disclosure, there may be multiple different versions of the same AI model. If different versions of the same AI model have different function names, the corresponding execution function can be directly called by the function name, and the execution function can be used for reasoning. If different versions of the same AI model use the same function name and have different version numbers, the following can be used: Figure 6 The processing flow shown includes the following steps:
[0188] 601, receiving a call instruction of an execution function of an AI model.
[0189] The calling instruction may carry the function name and function input data of the executed function.
[0190] 602. Determine the version number corresponding to the function name carried by the calling instruction based on a mapping table of function name-version number.
[0191] The scheduling server stores a mapping table of function name-version number, which is used to store the version number of the latest version of the execution function of the AI model. After receiving the call instruction, the scheduling server queries the latest version number of the AI model through the mapping table of function name-version number.
[0192] 603, calling the execution function of the AI model based on the function name and version number, inputting the function input data in the calling instruction into the execution function, and obtaining the inference result.
[0193] 604, feeding back the inference result as a response to the calling instruction.
[0194] Each time the AI model is retrained, the version number of the retrained execution function can be obtained, and in the function name-version number mapping table, the version number corresponding to the function name of the execution function is replaced with the currently obtained version number.
[0195] The disclosed embodiment also provides a method for creating a data table, in which the target column is set as training calibration data for use in the AI model training process. The processing flow of the method is as follows: Figure 7 As shown, the following steps may be included:
[0196] 701, receiving a table creation instruction.
[0197] The statement corresponding to the target column in the table creation instruction may include a second key field, which is used to indicate that the data in the target column is training calibration data, and the character content of the field can be arbitrarily set in advance. The form of the table creation instruction can be:
[0198] CREATE TABLE table_name (
[0200] column_name1 datatype,
[0201] column_name2 datatype,
[0202] column_name3 datatype,
[0203] column_name4 datatype,
[0204] column_name5 datatype PREDICT KEY )
[0206] ……;
[0207] Among them, only part of the content of the instruction is shown, and the content of the "..." part is not explained here. CREATETABLE is the instruction name. table_name is the table name of the data table, column_name1, column_name2, column_name3, column_name4, column_name5 are the five column names of the data table, and datatype is the data format corresponding to the column. PREDICT KEY is the second key field, and PREDICT KEY is located in the 5th column, so the 5th column is set to training calibration data.
[0208] Taking the creation of the data table corresponding to Table 1 as an example, the table creation instruction can be:
[0209] CREATE TABLE iris (
[0211] sepal_length float4,
[0212] sepal_width float4,
[0213] petal_length float4,
[0214] petal_width float4,
[0215] output_label char(20)PREDICT KEY )
[0217] ……;
[0218] PREDICT KEY is used to indicate that the data corresponding to the output_label column is training calibration data.
[0219] 702, create the table and record the indication information corresponding to the table.
[0220] The indication information is used to indicate that the data in the target column is training calibration data, and the indication information will be used in the subsequent training process.
[0221] Based on the same technical concept, the embodiment of the present disclosure provides a device for executing database operation instructions, which can be applied to the above database system, such as Figure 8 As shown, the device comprises:
[0222] The receiving module 810 is used to receive a first table operation instruction, wherein the first table operation instruction is used to add a column in a data table.
[0223] The determination module 820 is used to determine the corresponding sub-operation set based on the first table operation instruction, wherein the sub-operation set includes at least one data processing operation and at least one artificial intelligence (AI) operation, and at least one AI operation includes an AI model obtained by training based on data in the data table.
[0224] The processing module 830 is used to: provide the data in the data table to the AI server; send a model creation request to the AI server, wherein the model creation request is used to instruct the AI server to obtain an AI model based on the data in the data table training; and obtain the AI model.
[0225] In a possible implementation, the first table operation instruction includes a first key field, the first key field is used to define a column as a prediction column, and the prediction column is used to record the reasoning result of the AI model. A determination module is used to determine a corresponding sub-operation set based on the first key field.
[0226] In a possible implementation, the processing module 830 is further used to generate an execution function of the AI model, and the execution function is used to call the AI model.
[0227] In a possible implementation, the processing module 830 is further used to record the mapping relationship between the columns of the data table and the AI model.
[0228] In a possible implementation, the processing module 830 is further configured to add a column to the data table based on the first table operation instruction.
[0229] In a possible implementation, the receiving module 810 is further used to receive a call instruction for an execution function of the AI model. The processing module 830 is further used to input the inference condition parameter in the call instruction into the AI model to obtain a first inference result, and to feed back the first inference result as a response to the call instruction.
[0230] In a possible implementation, the receiving module 810 is further used to receive a first field query instruction for a column of a data table. The determining module 820 is further used to determine that the AI model needs to be used based on a mapping relationship between the column and the AI model. The processing module 830 is further used to input the query condition parameter in the first field query instruction into the AI model to obtain a second inference result, and to feed back the second inference result as a response to the first field query instruction.
[0231] In one possible implementation, the processing module 830 is further configured to record the inference results of the AI model into a column.
[0232] In a possible implementation, the receiving module 810 is further used to receive a second field query instruction for a column of the data table. The determining module 820 is further used to determine a target inference result from the column based on a query condition parameter in the second field query instruction. The processing module 830 is further used to feed back the target inference result as a query result of the second field query instruction.
[0233] In a possible implementation, the receiving module 810 is further configured to receive a second table operation instruction, where the second table operation instruction is used to delete a column in the data table. The processing module 830 is further configured to delete the AI model and / or the execution function of the AI model based on the mapping relationship between the column and the AI model.
[0234] In a possible implementation, the model creation request is also used to instruct the AI server to obtain data from a third-party storage service. Processing module 830 is used to store the data in the third-party storage service.
[0235] In a possible implementation, the receiving module 810 is further used to receive a table creation instruction, wherein the table creation instruction is used to create a data table, and a second key field corresponding to the target column is added to the table creation instruction. The processing module 830 is further used to create a data table, and determine indication information based on the second key field, wherein the indication information is used to indicate that the target column in the data table is used to store training calibration data, and after determining the corresponding sub-operation set, provide the indication information to the AI server.
[0236] Among them, the receiving module 810, the determining module 820 and the processing module 830 can all be implemented by software, or can be implemented by hardware. Exemplarily, the implementation of the receiving module 810 is introduced below by taking the receiving module 810 as an example. Similarly, the implementation of the determining module 820 and the processing module 830 can refer to the implementation of the receiving module 810.
[0237] As an example of a software functional unit, the receiving module 810 may include code running on a computing instance. Among them, the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the above-mentioned computing instance may be one or more. For example, the receiving module 810 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region (region) or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including a data center or multiple data centers with similar geographical locations. Among them, usually a region may include multiple AZs.
[0238] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.
[0239] As an example of a hardware functional unit, the receiving module 810 may include at least one computing device, such as a server, etc. Alternatively, the receiving module 810 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
[0240] The multiple computing devices included in the receiving module 810 can be distributed in the same region or in different regions. The multiple computing devices included in the receiving module 810 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the receiving module 810 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0241] It should be noted that, in other embodiments, the receiving module 810, the determining module 820 and the processing module 830 can be used to execute any step in the method for executing database operation instructions. The steps that the receiving module 810, the determining module 820 and the processing module 830 are responsible for implementing can be specified as needed. The receiving module 810, the determining module 820 and the processing module 830 respectively implement different steps in the method for executing database operation instructions to realize the full functions of the device for executing database operation instructions.
[0242] The present disclosure also provides a computing device 100. Fig. 9 As shown, the computing device 100 includes: a bus 102, a processor 104, a memory 106, and a communication interface 108. The processor 104, the memory 106, and the communication interface 108 communicate with each other through the bus 102. The computing device 100 can be a server or a terminal device. It should be understood that the present disclosure does not limit the number of processors and memories in the computing device 100.
[0243] The bus 102 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 The bus 102 is represented by only one line, but it does not mean that there is only one bus or one type of bus. The bus 102 may include a path for transmitting information between various components of the computing device 100 (eg, the memory 106, the processor 104, and the communication interface 108).
[0244] The processor 104 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0245] The memory 106 may include a volatile memory, such as a random access memory (RAM). The memory 106 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0246] The memory 106 stores executable program codes, and the processor 104 executes the executable program codes to respectively implement the functions of the aforementioned receiving module 810, the determining module 820, and the processing module 830, thereby implementing the method for executing the database operation instruction. That is, the memory 106 stores instructions for executing the database operation instruction method.
[0247] Alternatively, the memory 106 stores executable codes, and the processor 104 executes the executable codes to respectively implement the functions of the aforementioned receiving module 810, the determining module 820, and the processing module 830, thereby implementing the method for executing the database operation instruction. That is, the memory 106 stores instructions for executing the method for executing the database operation instruction.
[0248] The communication interface 108 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 100 and other devices or a communication network.
[0249] The present disclosure also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device may be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device may also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.
[0250] like Fig.10As shown, the computing device cluster includes at least one computing device 100. The memory 106 in one or more computing devices 100 in the computing device cluster may store the same instructions for executing the method of database operation instructions.
[0251] In some possible implementations, the memory 106 of one or more computing devices 100 in the computing device cluster may also store partial instructions of the method for executing the database operation instruction. In other words, the combination of one or more computing devices 100 may jointly execute the instructions of the method for executing the database operation instruction.
[0252] It should be noted that the memory 106 in different computing devices 100 in the computing device cluster may store different instructions, which are respectively used to execute part of the functions of the device for executing the database operation instruction. That is, the instructions stored in the memory 106 in different computing devices 100 may implement the functions of one or more modules among the receiving module 810, the determining module 820 and the processing module 830.
[0253] In some possible implementations, one or more computing devices in the computing device cluster may be connected via a network, which may be a wide area network or a local area network. Fig.11 A possible implementation is shown. Fig.11 As shown, two computing devices 100A and 100B are connected via a network. Specifically, the network is connected via a communication interface in each computing device. In this type of possible implementation, the memory 106 in the computing device 100A stores instructions for executing the functions of the processing module 830. At the same time, the memory 106 in the computing device 100B stores instructions for executing the functions of the receiving module 810 and the determining module 820.
[0254] Fig.11 The connection method between the computing device clusters shown may be that considering that the method for executing database operation instructions provided by the present disclosure requires a large amount of data storage, it is considered to hand over the functions implemented by the receiving module 510 and the determining module 520 to the computing device 100B for execution.
[0255] It should be understood that Fig.11 The functions of the computing device 100A shown in FIG. 1 may also be completed by multiple computing devices 100. Similarly, the functions of the computing device 100B may also be completed by multiple computing devices 100.
[0256] The present disclosure also provides another computing device cluster. The connection relationship between the computing devices in the computing device cluster can be similar to that of Fig.10 and Fig.11The connection mode of the computing device cluster is different in that the memory 106 in one or more computing devices 100 in the computing device cluster may store the same instructions for executing the method of database operation instructions.
[0257] In some possible implementations, the memory 106 of one or more computing devices 100 in the computing device cluster may also store partial instructions of the method for executing the database operation instruction. In other words, the combination of one or more computing devices 100 may jointly execute the instructions of the method for executing the database operation instruction.
[0258] The present disclosure also provides a computer program product including instructions. The computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the method enables at least one computing device to execute a database operation instruction.
[0259] The present disclosure also provides a computer-readable storage medium. The computer-readable storage medium may be any available medium that can be stored by a computing device or a data storage device such as a data center that includes one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a digital video disk (DVD)), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct a computing device to execute a method for a database operation instruction, or instructs a computing device to execute a method for a database operation instruction.
[0260] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present disclosure.
Claims
1. A method for executing a database operation instruction, characterized in that: The method is applied to a database system, and the method comprises: Receive a first table operation instruction, wherein the first table operation instruction is used to add a column in a data table; Based on the first table operation instruction, determine a corresponding sub-operation set, wherein the sub-operation set includes at least one data processing operation and at least one artificial intelligence (AI) operation, and the at least one AI operation includes an AI model obtained by training based on the data in the data table; Providing the data in the data table to the AI server; Sending a model creation request to the AI server, wherein the model creation request is used to instruct the AI server to obtain the AI model through training based on the data in the data table; Obtain the AI model.
2. The method according to claim 1, characterized in that The first table operation instruction includes a first key field, the first key field is used to define the column as a prediction column, and the prediction column is used to record the inference result of the AI model; The determining the corresponding sub-operation set based on the first table operation instruction includes: determining the corresponding sub-operation set based on the first key field.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: An execution function of the AI model is generated, where the execution function is used to call the AI model.
4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: Record the mapping relationship between the columns of the data table and the AI model.
5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: Based on the first table operation instruction, the column is added to the data table.
6. The method according to any one of claims 3 to 5, characterized in that: The method further comprises: Receiving a call instruction to the execution function of the AI model; The inference condition parameters in the calling instruction are input into the AI model to obtain a first inference result, and the first inference result is fed back as a response to the calling instruction.
7. The method according to any one of claims 4 to 5, characterized in that: The method further comprises: receiving a first field query instruction for the column of the data table; Based on the mapping relationship between the column and the AI model, determining that the AI model needs to be used; The query condition parameters in the first field query instruction are input into the AI model to obtain a second inference result, and the second inference result is fed back as a response to the first field query instruction.
8. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: The inference result of the AI model is recorded in the column.
9. The method according to claim 8, characterized in that The method further comprises: receiving a second field query instruction for the column of the data table; Determining a target inference result from the column based on a query condition parameter in the second field query instruction; The target inference result is fed back as a query result of the second field query instruction.
10. The method according to any one of claims 4 to 9, characterized in that: The method further comprises: receiving a second table operation instruction, where the second table operation instruction is used to delete the column in the data table; Based on the mapping relationship between the column and the AI model, the AI model and / or the execution function of the AI model is deleted.
11. The method according to any one of claims 1 to 10, characterized in that: The model creation request is also used to instruct the AI server to obtain the data from a third-party storage service; Providing the data in the data table to the AI server includes: storing the data in the third-party storage service.
12. The method according to any one of claims 1 to 11, characterized in that: Before receiving the first table operation instruction, the method further includes: receiving a table creation instruction, wherein the table creation instruction is used to create the data table, and a second key field corresponding to the target column is added to the table creation instruction; Creating the data table, and determining indication information based on the second key field, wherein the indication information is used to indicate that the target column in the data table is used to store training calibration data; After determining the corresponding sub-operation set, the method further includes: The instruction information is provided to the AI server.
13. A device for executing a database operation instruction, characterized in that: The device is applied to a database system, and comprises: A receiving module, configured to receive a first table operation instruction, wherein the first table operation instruction is used to add a column in a data table; A determination module, configured to determine a corresponding sub-operation set based on the first table operation instruction, wherein the sub-operation set includes at least one data processing operation and at least one artificial intelligence (AI) operation, and the at least one AI operation includes an AI model obtained by training based on the data in the data table; A processing module is used to provide the data in the data table to the AI server; send a model creation request to the AI server, wherein the model creation request is used to instruct the AI server to obtain the AI model through training based on the data in the data table; and obtain the AI model.
14. The device according to claim 13, characterized in that The first table operation instruction includes a first key field, the first key field is used to define the column as a prediction column, and the prediction column is used to record the inference result of the AI model; The determination module is used to determine the corresponding sub-operation set based on the first key field.
15. The device according to claim 13 or 14, characterized in that The processing module is also used to generate an execution function of the AI model, and the execution function is used to call the AI model.
16. The device according to any one of claims 13 to 15, characterized in that The processing module is also used to record the mapping relationship between the columns of the data table and the AI model.
17. The device according to any one of claims 13 to 16, characterized in that: The processing module is further configured to add the column to the data table based on the first table operation instruction.
18. The device according to any one of claims 15 to 17, characterized in that: The receiving module is further used to receive a call instruction for the execution function of the AI model; The processing module is also used to input the reasoning condition parameters in the calling instruction into the AI model to obtain a first reasoning result, and to feed back the first reasoning result as a response to the calling instruction.
19. The device according to any one of claims 16-17, characterized in that The receiving module is further used to receive a first field query instruction for the column of the data table; The determination module is further used to determine the need to use the AI model based on the mapping relationship between the column and the AI model; The processing module is also used to input the query condition parameters in the first field query instruction into the AI model to obtain a second reasoning result, and to feed back the second reasoning result as a response to the first field query instruction.
20. The device according to any one of claims 13 to 19, characterized in that The processing module is also used to record the inference results of the AI model into the column.
21. The device according to claim 20, characterized in that The receiving module is further used to receive a second field query instruction for the column of the data table; The determination module is further used to determine a target inference result from the column based on a query condition parameter in the second field query instruction; The processing module is further configured to feed back the target inference result as a query result of the second field query instruction.
22. The device according to any one of claims 16 to 21, characterized in that The receiving module is further used to receive a second table operation instruction, where the second table operation instruction is used to delete the column in the data table; The processing module is further used to delete the AI model and / or the execution function of the AI model based on the mapping relationship between the column and the AI model.
23. The device according to any one of claims 13 to 22, characterized in that: The model creation request is also used to instruct the AI server to obtain the data from a third-party storage service; The processing module is used to store the data in the third-party storage service.
24. The device according to any one of claims 13 to 23, characterized in that The receiving module is further used to receive a table creation instruction, wherein the table creation instruction is used to create the data table, and a second key field corresponding to the target column is added to the table creation instruction; The processing module is further used to create the data table and determine indication information based on the second key field, wherein the indication information is used to indicate that the target column in the data table is used to store training calibration data; after determining the corresponding sub-operation set, the indication information is provided to the AI server.
25. A computing device cluster, characterized in that: comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method according to any one of claims 1 to 12.
26. A computer-readable storage medium, characterized in that: The method comprises computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster performs the method according to any one of claims 1 to 12.
27. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device cluster, the computing device cluster executes the method according to any one of claims 1 to 12.
Citation Information
Cited By
Method for executing database operation instruction, apparatus, device and storage medium
WO2025044202A1