Method and device for expanding SQL (Structured Query Language) and storage medium
By calling the objective function natively supporting array type in SQL statements for intermediate parameter processing, the problem of insufficient syntax flexibility in traditional SQL in AI applications is solved, and more complex data operation and analysis capabilities are achieved, supporting the needs of AI applications.
Patent Information
- Application Number
- CN202410946954.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2024-12-10
AI Technical Summary
Traditional SQL lacks syntax flexibility in handling complex data transformation and analysis, which limits its application in the field of artificial intelligence, especially its insufficient support for array types and complex functions.
By calling objective functions natively supporting array types in SQL statements for intermediate parameter processing, the flexibility of SQL statements is expanded, allowing the database system to better support AI applications. The specific methods include processing target data in SQL statements, calling the target function for intermediate parameter processing, and obtaining the processing results of the target data based on the processing results, supporting data type conversion of integer, floating point, and string types, as well as one-dimensional and two-dimensional Mapping relationship processing of dimensional arrays.
The flexibility of SQL statements is added, allowing the database system to complete complex data operations that could not be completed before, more adapted to the needs of AI applications, and supports more complex data transformation and analysis.
Smart Images

Figure CN119106073A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of database technology, and in particular to a method, device and storage medium for extending Structured Query Language (SQL). Background Art
[0002] In today's data-driven world, database systems and query languages are essential for storing and retrieving large amounts of information. SQL, as a standardized query language for database systems, was originally designed to provide an efficient and unified way to operate on data. The popularity and convenience of SQL make it an indispensable tool in database management and application development.
[0003] However, with the development of artificial intelligence (AI) technology, traditional SQL has shown the disadvantage of insufficient syntax flexibility when processing complex data transformation and analysis. AI applications usually require complex processing and analysis of large amounts of data, and the limitation of traditional SQL is that it lacks support for array types and complex functions, which limits its application in the field of AI. Summary of the invention
[0004] In view of this, the present disclosure proposes a method, device and storage medium for extending SQL. The embodiments of the present disclosure increase the flexibility of SQL statements by combining SQL statements with target functions that natively support array types, so that the database system can better support AI applications.
[0005] According to one aspect of the present disclosure, a method for extending SQL is provided, the method comprising:
[0006] Use SQL statements to process target data;
[0007] In the SQL statement, a target function is called to perform intermediate parameter processing to obtain an intermediate processing result, wherein the target function is a function that natively supports array types;
[0008] According to the intermediate processing result, a target processing result corresponding to the target data is obtained.
[0009] In a possible implementation, calling the target function in the SQL statement to perform intermediate parameter processing to obtain an intermediate processing result includes:
[0010] Performing data type conversion on the intermediate parameters when the SQL statement processes the target data to obtain converted intermediate parameters, wherein the data type of the converted intermediate parameters is the data type natively supported by the target function;
[0011] The target function is called in the SQL statement to process the converted intermediate parameters to obtain the intermediate processing result.
[0012] In another possible implementation, the data type natively supported by the target function includes any one of an integer type, a floating point type, and a string type.
[0013] In another possible implementation,
[0014] The input parameter and output parameter of the objective function are both one-dimensional arrays, and the objective function is used to indicate the mapping relationship between table rows.
[0015] In another possible implementation,
[0016] The input parameter of the objective function is a one-dimensional array, and the output parameter is a two-dimensional array. The objective function is used to indicate a mapping relationship between table rows and tables.
[0017] In another possible implementation,
[0018] The input parameter of the objective function is a two-dimensional array, and the output parameter is a one-dimensional array. The objective function is used to indicate a mapping relationship between a table and a table row.
[0019] In another possible implementation, the target function includes any one of a JavaScript function, a Python function, and a Java function.
[0020] According to another aspect of the present disclosure, a device for extending SQL is provided, the device comprising:
[0021] A processing module is used to process target data using SQL statements;
[0022] A calling module, used for calling a target function in the SQL statement to perform intermediate parameter processing and obtain an intermediate processing result, wherein the target function is a function that natively supports array types;
[0023] The obtaining module is used to obtain the target processing result corresponding to the target data according to the intermediate processing result.
[0024] In a possible implementation, the calling module is further used to:
[0025] Performing data type conversion on the intermediate parameters when the SQL statement processes the target data to obtain converted intermediate parameters, wherein the data type of the converted intermediate parameters is the data type natively supported by the target function;
[0026] The target function is called in the SQL statement to process the converted intermediate parameters to obtain the intermediate processing result.
[0027] In another possible implementation, the data type natively supported by the target function includes any one of an integer type, a floating point type, and a string type.
[0028] In another possible implementation,
[0029] The input parameter and output parameter of the objective function are both one-dimensional arrays, and the objective function is used to indicate the mapping relationship between table rows.
[0030] In another possible implementation,
[0031] The input parameter of the objective function is a one-dimensional array, and the output parameter is a two-dimensional array. The objective function is used to indicate a mapping relationship between table rows and tables.
[0032] In another possible implementation,
[0033] The input parameter of the objective function is a two-dimensional array, and the output parameter is a one-dimensional array. The objective function is used to indicate a mapping relationship between a table and a table row.
[0034] In another possible implementation, the target function includes any one of a JavaScript function, a Python function, and a Java function.
[0035] According to another aspect of the present disclosure, a device for extending SQL is provided, the device comprising:
[0036] processor;
[0037] a memory for storing processor-executable instructions;
[0038] The processor is configured to implement the above method when executing the instructions stored in the memory.
[0039] According to another aspect of the present disclosure, a non-volatile computer-readable storage medium is provided, on which computer program instructions are stored, wherein the computer program instructions implement the above method when executed by a processor.
[0040] According to another aspect of the present disclosure, a computer program product is provided, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of a computing device, the processor in the computing device executes the above method.
[0041] The present disclosure proposes a method for extending SQL, by using SQL statements to process target data; calling a target function in the SQL statement to perform intermediate parameter processing to obtain an intermediate processing result, wherein the target function is a function that natively supports array types; obtaining a target processing result corresponding to the target data according to the intermediate processing result; enabling SQL statements to embed target functions that natively support array types, thereby extending the grammatical basis of SQL statements, increasing the flexibility of SQL statements, and enabling database systems to better support AI applications.
[0042] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.
[0044] Figure 1 A schematic diagram of the structure of a computing device provided by an exemplary embodiment of the present disclosure is shown.
[0045] Figure 2 A flowchart of a method for extending SQL provided by an exemplary embodiment of the present disclosure is shown.
[0046] Figure 3 A schematic diagram of the structure of a device for extending SQL provided by an exemplary embodiment of the present disclosure is shown.
[0047] Figure 4 It is a block diagram of a device for extending SQL according to an exemplary embodiment. DETAILED DESCRIPTION
[0048] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0049] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0050] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.
[0051] First, the application scenarios involved in the present disclosure are introduced.
[0052] Please refer to Figure 1 , which shows a schematic diagram of the structure of a computing device provided by an exemplary embodiment of the present disclosure.
[0053] The computing device may be a terminal or a server. The terminal includes a mobile terminal or a fixed terminal, such as a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC), an intelligent robot, a car computer, and other terminal devices. The server may be a server, a server cluster consisting of several servers, or a cloud computing service center.
[0054] like Figure 1 As shown, the computing device includes a processor 10, a memory 20, and a communication interface 30. Those skilled in the art will appreciate that Figure 1 The structure shown in the figure does not constitute a limitation on the computing device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0055] The processor 10 is the control center of the computing device, and uses various interfaces and lines to connect various parts of the entire computing device. It executes various functions of the computing device and processes data by running or executing software programs and / or modules stored in the memory 20, and calling data stored in the memory 20, thereby controlling the computing device as a whole. The processor 10 can be implemented by a CPU or a GPU.
[0056] The memory 20 can be used to store software programs and modules. The processor 10 executes various functional applications and data processing by running the software programs and modules stored in the memory 20. The memory 20 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system 21, a processing module 22, a call module 23, a get unit 24 and an application 25 required for at least one function, etc.; the data storage area may store data created according to the use of the computing device, etc. The memory 20 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a magnetic disk or an optical disk. Accordingly, the memory 20 may further include a memory controller to provide the processor 10 with access to the memory 20 .
[0057] The processor 10 executes the following functions by running the processing module 22: using SQL statements to process target data. The processor 10 executes the following functions by running the calling module 23: calling the target function in the SQL statement to perform intermediate parameter processing to obtain an intermediate processing result, where the target function is a function that natively supports array types. The processor 10 executes the following functions by running the obtaining module 24: obtaining a target processing result corresponding to the target data according to the intermediate processing result.
[0058] Below, an exemplary embodiment is used to introduce the method for extending SQL provided by the embodiment of the present disclosure.
[0059] Please refer to Figure 2 , which shows a flowchart of a method for extending SQL provided by an exemplary embodiment of the present disclosure. In this embodiment, the method is used for Figure 1 The method is illustrated by using the computing device shown in FIG.
[0060] Step 201: Use SQL statements to process target data.
[0061] SQL statements are used in database systems to process target data. SQL statements are instructions used to interact with the database. SQL statements can be used to query, insert, update, or delete data, as well as manage database structures such as tables and indexes. For example, SQL statements can be query (English: SELECT) statements, insert (English: INSERT) statements, update (English: UPDATE) statements, or delete (English: DELETE) statements.
[0062] Target data refers to the data set that needs to be processed or analyzed in the database. This data is usually selected to meet specific business needs or solve specific problems.
[0063] Step 202: Call the target function in the SQL statement to perform intermediate parameter processing to obtain an intermediate processing result. The target function is a function that natively supports array types.
[0064] The target function is embedded in the SQL statement, that is, the target function can be directly called in the SQL statement, and the target function is used to perform specific data processing tasks.
[0065] The target function is a function that natively supports array types, which means that it can directly process array type data stored in the database. Array type data is an array. Array type is a data structure that allows multiple elements to be stored in a single field. Each element in the array can be any type of data. Native support means that the target function can directly process array type data, that is, the target function receives an array type input parameter and returns an array type output parameter.
[0066] Intermediate parameter processing refers to the processing of intermediate parameters in the process of processing target data. The intermediate processing result is the result obtained after calling the target function to process the intermediate parameters. This result is usually a transitional output, which will be further processed to generate the final target processing result.
[0067] For example, the target function is a JavaScript function, and the JavaScript function is a function implemented by the JavaScript language. As a general-purpose programming language, the JavaScript language has a relatively mature syntax and has a wide audience. Combining SQL with the JavaScript language enables it to complete more complex data transformation operations so that the database system can better support AI applications. It should be noted that the embodiments of the present disclosure are suitable for embedding any weakly typed general programming language into SQL. Different programming languages can be selected to implement the target function as needed, for example, the target function can also be a Python function or a Java function. The embodiments of the present disclosure are not limited to this.
[0068] Step 203, obtaining a target processing result corresponding to the target data according to the intermediate processing result.
[0069] The target processing result is the final output of the entire data processing process. Based on the intermediate processing results, the target processing result is obtained through a series of logical or calculation steps. The target processing result is used to support decision-making, reporting or other business needs.
[0070] In summary, the embodiments of the present disclosure extend SQL so that SQL statements can embed target functions that natively support array types, thereby increasing the flexibility of SQL statements and being able to complete operations in SQL statements that were previously impossible, thereby enabling the database system to better support AI applications.
[0071] Optionally, the above step 202 may further include the following steps: performing data type conversion on the intermediate parameters when the SQL statement processes the target data to obtain the converted intermediate parameters, wherein the data type of the converted intermediate parameters is the data type natively supported by the target function; calling the target function in the SQL statement to process the converted intermediate parameters to obtain the intermediate processing result.
[0072] Among them, the data type of the intermediate parameter when the SQL statement processes the target data is converted into a data type natively supported by the target function. The data type natively supported by the target function may include any one of integer type, floating point type, and string type.
[0073] Taking the target function as a JavaScript function as an example, JavaScript functions natively support the following three data types: integer, floating point, and string. In the case of the current 64-bit operating system being the mainstream, the data type of the intermediate parameter can be converted into any one of the following types in the database system: a 64-bit integer, a double-precision floating point, or a variable-length string with an upper limit of 128 characters.
[0074] Optionally, a unified function prototype of the objective function is predefined, and three different types of function effects can be realized based on the function prototype, namely, the input parameters (i.e., the intermediate parameters after transformation) and the output parameters (i.e., the intermediate processing results) of the objective function, including the following possible implementation methods:
[0075] In one possible implementation, one-to-one: the input and output parameters of the objective function are both one-dimensional arrays, and the objective function is used to indicate the mapping relationship between table rows and table rows, that is, the objective function is used to convert each table row in the table into a corresponding table row. This means that each row of input parameters corresponds to a row of output parameters. This type of function is often used in scenarios where data conversion is relatively direct, such as replacement operations in data cleaning, or converting one row of data to another row of data, such as converting Fahrenheit temperature to Celsius temperature.
[0076] In another possible implementation, one-to-many: the input parameter of the objective function is a one-dimensional array, and the output parameter is a two-dimensional array. The objective function is used to indicate the mapping relationship between table rows and tables. Table rows are rows, and tables are multiple rows. That is, the objective function is used to convert each table row in the table into corresponding multiple table rows. This means that each row of input parameters corresponds to multiple rows of output parameters. This type of function is suitable for extended operations on data, such as generating multiple order records based on user identifiers, or generating multiple versions of data based on a row of data (for example, predicting sales by applying different discount rates).
[0077] In another possible implementation, many-to-one: the input parameter of the objective function is a two-dimensional array, and the output parameter is a one-dimensional array. The objective function is used to indicate the mapping relationship between the table and the table row, that is, the objective function is used to convert multiple table rows in the table into a corresponding table row. This means that multiple rows of input parameters correspond to one row of output parameters, that is, multiple rows of input parameters are aggregated or summarized into one row of output parameters. This type of function is often used for data aggregation operations, such as calculating the average, sum, or other statistical information of all rows of data in a table.
[0078] It should be noted that the above function types are mutually exclusive, and the function type can be determined by checking the input and output of the function. If a function does not meet any of the above function categories, it can be considered illegal or abnormal.
[0079] Taking the target function as a JavaScript function (a callable function in the JavaScript language) as an example, in an illustrative example, the unified function prototype of the JavaScript function is defined using the array type: function(array)->array, which means that the JavaScript function receives an input parameter of an array type and returns an output parameter of an array type. All JavaScript functions can share the same function prototype, and three different types of function effects can be achieved based on the function prototype. Taking the SQL statement as a SELECT statement, three ways of calling a JavaScript function in a SELECT statement can be defined:
[0080] 1. In a basic SELECT statement, the SELECT item contains a one-to-one type of JavaScript function call.
[0081] At this point, the meaning of the function call is to transform each table row into another table row. For example:
[0082] SELECT f(A,B,C)AS(D,E,F)
[0083] FROM Table
[0084] Here, the target function f is a one-to-one JavaScript function. The input parameter of the target function f is a one-dimensional array containing three elements (A, B, C), and the output parameter is also a one-dimensional array containing three elements (D, E, F). The target function f can perform any operation inside to calculate the output parameter from the input parameter. Finally, the performance of calling the target function f in the SQL statement is to call the target function f to convert each table row in the original table into a corresponding table row, and the number of rows in the processed table is the same as the number of rows in the original table.
[0085] 2. In a basic SELECT statement, the SELECT item contains a one-to-many type of JavaScript function call.
[0086] At this time, the meaning of the function call is to convert each data row into multiple data rows. For example:
[0087] SELECT f(A,B,C)AS(D,E,F)
[0088] FROM Table
[0089] The target function f here is a one-to-many JavaScript function. The input parameter of the target function f is a one-dimensional array containing three elements (A, B, C), and the output parameter is a two-dimensional array, each of which is a one-dimensional array containing three elements (D, E, F). Finally, calling the target function f in the SQL statement means that each table row of the table is split into multiple table rows (or 0 rows) according to the target function f, and the number of rows in the processed table is different from the number of rows in the original table.
[0090] 3. In a SELECT statement containing a GROUP BY clause, the SELECT item contains a many-to-one type of JavaScript function call. For example:
[0091] SELECT A,f(B,C)AS(D,E,F)
[0092] FROM Table
[0093] GROUP BY A
[0094] The target function f here is a pre-written many-to-one type JavaScript function. The input parameter of the target function f is a two-dimensional array, each of which is a one-dimensional array containing three elements (A, B, C), and the output parameter is a one-dimensional array containing three elements (D, E, F). The GROUP BY clause is used to group the result set according to the specified column. Finally, the performance of calling the target function f in the SQL statement is to group the table rows of the original table according to the value of the A element, which means that the table rows with the same A value in the original table will be grouped together, and each group will form a local table. Then, the local table formed by the B and C columns corresponding to each group is used as the input of the target function f, and the output of the target function f and the A element are integrated into a data row as the output parameter and returned.
[0095] It should be noted that in the related art, the database engine's built-in extension solution can be used. Many database systems (such as MySQL) come with a solution for declaring custom functions, but this solution is often derived from SQL, has large restrictions and is often only applicable to one-to-one situations. In addition, in the related art, the expansion can also be completed by recompiling the database engine and linking an external dynamic library (Dynamic Link Library, DLL). However, the custom functions under this solution have fewer restrictions, but each time a custom function is added, the entire database system needs to be restarted, which is very costly. In addition, in the related art, the data in the database system can also be exported, the data transformation is completed externally, and then re-imported. However, this solution can only complete data transformation in batches on a regular basis, and cannot perform real-time transformation on data newly entering the system.
[0096] The method provided by the embodiment of the present disclosure can expand the role of SQL, enabling it to complete more complex data operations. Users can define new target functions at any time to achieve the desired data transformation, and are no longer limited to the limited SQL syntax. The embodiment of the present disclosure defines a unified function prototype of the target function, which facilitates the interface implementation between the database system engine and the target function, and identifies the specific implementation of three types of target functions, as well as the different meanings of each category when specifically applied to SQL statements, thereby expanding the SQL statement syntax in three different directions to adapt to different application scenarios.
[0097] The following is an apparatus embodiment of the present disclosure. For parts not described in detail in the apparatus embodiment, reference may be made to the technical details disclosed in the above method embodiment.
[0098] Please refer to Figure 3 , which shows a schematic diagram of the structure of a device for extending SQL provided by an exemplary embodiment of the present disclosure. The device can realize all or part of a computing device through software, hardware, or a combination of the two. The device includes: a processing module 22, a calling module 23, and a obtaining module 24.
[0099] A processing module 22, used for processing target data using SQL statements;
[0100] A calling module 23 is used to call a target function in the SQL statement to perform intermediate parameter processing and obtain an intermediate processing result, wherein the target function is a function that natively supports array types;
[0101] The obtaining module 24 is used to obtain the target processing result corresponding to the target data according to the intermediate processing result.
[0102] In a possible implementation, the calling module 23 is further used to:
[0103] The data type of the intermediate parameter when the SQL statement processes the target data is converted to obtain the converted intermediate parameter, and the data type of the converted intermediate parameter is the data type natively supported by the target function;
[0104] The target function is called in the SQL statement to process the converted intermediate parameters to obtain the intermediate processing results.
[0105] In another possible implementation, the data type natively supported by the target function includes any one of an integer type, a floating point type, and a string type.
[0106] In another possible implementation,
[0107] The input parameter and output parameter of the objective function are both one-dimensional arrays, and the objective function is used to indicate the mapping relationship between table rows.
[0108] In another possible implementation,
[0109] The input parameter of the objective function is a one-dimensional array, and the output parameter is a two-dimensional array. The objective function is used to indicate the mapping relationship between table rows and tables.
[0110] In another possible implementation,
[0111] The input parameter of the objective function is a two-dimensional array, and the output parameter is a one-dimensional array. The objective function is used to indicate the mapping relationship between the table and the table rows.
[0112] In another possible implementation, the target function includes any one of a JavaScript function, a Python function, and a Java function.
[0113] It should be noted that the device provided in the above embodiment only uses the division of the above-mentioned functional modules as an example to implement its functions. In practical applications, the above-mentioned functions can be assigned to different functional modules according to actual needs, that is, the content structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0114] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0115] The embodiment of the present disclosure also provides a computer-readable storage medium on which computer program instructions are stored, and the computer program instructions implement the above method when executed by a processor. The computer-readable storage medium can be a volatile or non-volatile computer-readable storage medium.
[0116] The embodiment of the present disclosure also proposes a computing device, comprising: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to implement the above method when executing the instructions stored in the memory.
[0117] The embodiment of the present disclosure also provides a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of a computing device, the processor in the computing device executes the above method.
[0118] Figure 4 1 is a block diagram of an apparatus 1900 for extending SQL according to an exemplary embodiment. For example, the apparatus 1900 may be provided as a server or a terminal device. Figure 4 , the apparatus 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions, such as an application, that can be executed by the processing component 1922. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.
[0119] The device 1900 may also include a power supply component 1926 configured to perform power management of the device 1900, a wired or wireless network interface 1950 configured to connect the device 1900 to a network, and an input / output interface 1958 (I / O interface). The device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server 2000. TM , MacOS X TM , Unix TM ,Linux TM , FreeBSD TM or similar.
[0120] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the device 1900 to perform the above method.
[0121] The present disclosure may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.
[0122] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.
[0123] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0124] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be customized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0125] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0126] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0127] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0128] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.
[0129] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A method for extending structured query language SQL, characterized in that: The method comprises: Use SQL statements to process target data; In the SQL statement, a target function is called to perform intermediate parameter processing to obtain an intermediate processing result, wherein the target function is a function that natively supports array types; According to the intermediate processing result, a target processing result corresponding to the target data is obtained.
2. The method according to claim 1, characterized in that: The step of calling the target function in the SQL statement to perform intermediate parameter processing and obtaining an intermediate processing result includes: Performing data type conversion on the intermediate parameters when the SQL statement processes the target data to obtain converted intermediate parameters, wherein the data type of the converted intermediate parameters is the data type natively supported by the target function; The target function is called in the SQL statement to process the converted intermediate parameters to obtain the intermediate processing result.
3. The method according to claim 2, characterized in that The data types natively supported by the target function include any one of integer type, floating point type, and string type.
4. The method according to any one of claims 1 to 3, characterized in that: The input parameter and output parameter of the objective function are both one-dimensional arrays, and the objective function is used to indicate the mapping relationship between table rows.
5. The method according to any one of claims 1 to 3, characterized in that: The input parameter of the objective function is a one-dimensional array, and the output parameter is a two-dimensional array. The objective function is used to indicate a mapping relationship between table rows and tables.
6. The method according to any one of claims 1 to 3, characterized in that: The input parameter of the objective function is a two-dimensional array, and the output parameter is a one-dimensional array. The objective function is used to indicate a mapping relationship between a table and table rows.
7. The method according to any one of claims 1 to 3, characterized in that: The target function includes any one of a JavaScript function, a Python function, and a Java function.
8. A device for extending SQL, characterized in that: The device comprises: A processing module is used to process target data using SQL statements; A calling module, used for calling a target function in the SQL statement to perform intermediate parameter processing and obtain an intermediate processing result, wherein the target function is a function that natively supports array types; The obtaining module is used to obtain the target processing result corresponding to the target data according to the intermediate processing result.
9. A device for extending SQL, characterized in that: The device comprises: processor; a memory for storing processor-executable instructions; The processor is configured to implement the method described in any one of claims 1 to 7 when executing the instructions stored in the memory.
10. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
