Data storage method, device, equipment and storage medium

By parsing and encapsulating SQL statements, generating execution plans and storing them in the big data platform, it solves the problem of low storage efficiency in the big data platform and achieves more efficient data processing and operations.

CN113326270BActive Publication Date: 2024-09-10CHINA PING AN LIFE INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110734748.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-30
Publication Date
2024-09-10
Estimated Expiration
2041-06-30

AI Technical Summary

Technical Problem

In big data platforms, databases need to go through multiple processing steps and execute multiple query statements when storing data, resulting in low storage efficiency and inconvenient operation.

Method used

By receiving multiple SQL statements sent by users, parsing and encapsulating them into target statements with a Java syntax structure, generating an execution plan, storing it in a temporary table, sending it to the working node for execution and summary, and finally returning the results. to users.

Benefits of technology

It improves the efficiency and convenience of data storage, reduces the processing pressure of the big data platform, and avoids the cumbersome operation of submitting SQL statements separately.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113326270B
    Figure CN113326270B
Patent Text Reader

Abstract

The present application is in the field of data storage technology, and the present application provides a data storage method, device, equipment and storage medium, wherein the method comprises: receiving multiple SQL statements sent by a user, parsing the multiple SQL statements respectively, and determining the grammatical structure of each SQL statement; according to the grammatical structure, encapsulating each SQL statement into a target statement of a java grammatical structure respectively; storing the target statement in a pre-created temporary table, and generating an execution plan for each target statement; sending each execution plan to each working node, and extracting the execution result of each working node from the temporary table, and summarizing the execution result of each working node and sending it to the user. The present application achieves the purpose of unified storage operation by encapsulating each SQL statement and managing the execution plan of each target statement by a temporary table, avoiding the independent submission of each SQL statement through a big data platform, and the operation method is more efficient and convenient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data storage, and in particular to a data storage method, device, equipment and storage medium. Background Art

[0002] With the rapid development of informatization, the types and functions of information system resources are becoming more and more complete, resulting in huge amounts of information system application data. These application data are becoming more and more important, and in-depth data mining and analysis have become the industry's way to deepen business functions, user behavior analysis, hot applications, and a large number of technical means based on massive data analysis have emerged, reflecting the important position of these business data. At the same time, how to effectively store these precious business data has also become a research hotspot.

[0003] Currently, in big data platforms, when storing data in a database, multiple processing steps are required, multiple query statements are executed, and finally the query results are returned. During this storage process, the big data platform needs to submit each SQL statement independently, which is inconvenient to operate and has low storage efficiency. Summary of the invention

[0004] The main purpose of this application is to provide a data storage method, device, equipment and storage medium to improve data storage efficiency.

[0005] In order to achieve the above-mentioned object of the invention, the present application provides a data storage method, which comprises the following steps:

[0006] Receiving multiple SQL statements sent by a user, parsing the multiple SQL statements respectively, and determining the grammatical structure of each of the SQL statements;

[0007] According to the grammatical structure, each of the SQL statements is encapsulated into a target statement of a Java grammatical structure;

[0008] The target statements are stored in a pre-created temporary table, and an execution plan for each target statement is generated; wherein the temporary table is used to manage each execution plan;

[0009] Send each execution plan to each working node, so that each working node, when receiving the execution plan, obtains data according to the execution plan, stores the data in a corresponding database, and generates an execution result and stores it in the temporary table;

[0010] The execution result of each working node is extracted from the temporary table, and the execution result of each working node is summarized and sent to the user.

[0011] Preferably, the step of respectively parsing the multiple SQL statements includes:

[0012] Parsing the SQL statement, obtaining keywords in the SQL statement, and determining the grammatical structure of the SQL statement according to the keywords;

[0013] The step of encapsulating each of the SQL statements into a target statement with a Java syntax structure comprises:

[0014] Encapsulate each keyword into an intermediate object corresponding to the grammatical structure;

[0015] Each intermediate object is converted into a target statement of the Java grammar structure.

[0016] Furthermore, after the step of aggregating the execution results of each working node and sending the result to the user, the step further includes:

[0017] Receive query requests of SQL statements;

[0018] Extracting the SQL syntax to be queried from the query request, processing the SQL syntax to be queried using a preset rule, and obtaining a processing result;

[0019] Determine an index that matches the processing result of the SQL grammar to be queried from the preset encrypted SQL grammar indexes, and determine the target encrypted SQL grammar;

[0020] Based on the target encrypted SQL grammar, generate a target SQL statement;

[0021] The target SQL statement is determined as a query result and returned.

[0022] Preferably, the step of sending each execution plan to each working node includes:

[0023] Parse the execution plan of each working node and obtain the node name of each working node;

[0024] According to the node name, the execution plan of each working node is sent to each working node in the form of message pairs, and the sending status of each execution plan is recorded.

[0025] Preferably, the step of respectively parsing the multiple SQL statements includes:

[0026] Determine whether there is any analytical function in the multiple SQL statements that is not supported by the data warehouse tool;

[0027] If the unsupported parsing function exists, the SQL statement of the parsing function that is not supported by the data warehouse tool is obtained to obtain the target SQL statement, and the unsupported parsing function is converted according to a preset processing method to obtain the target parsing function;

[0028] The target SQL statement is parsed using the target parsing function.

[0029] Preferably, the step of aggregating the execution results of each working node and sending the result to the user comprises:

[0030] Gather the execution results of each working node in the data table;

[0031] The data table is sent to the user.

[0032] Furthermore, after the step of extracting the execution result of each working node from the temporary table, the method further includes:

[0033] The target statement corresponding to the execution result is queried, and the target statement corresponding to the execution result is deleted from the temporary table.

[0034] The present application also provides a data storage device, comprising:

[0035] A receiving module, used for receiving multiple SQL statements sent by a user, parsing the multiple SQL statements respectively, and determining the grammatical structure of each of the SQL statements;

[0036] An encapsulation module, used for encapsulating each of the SQL statements into a target statement with a Java syntax structure according to the syntax structure;

[0037] A generation module, used to store the target statement in a pre-created temporary table and generate an execution plan for each target statement; wherein the temporary table is used to manage each execution plan;

[0038] A sending module is used to send each execution plan to each working node, so that each working node, when receiving the execution plan, obtains data according to the execution plan, stores the data in a corresponding database, and generates an execution result and stores it in the temporary table;

[0039] The summary module is used to extract the execution result of each working node from the temporary table, summarize the execution result of each working node and send it to the user.

[0040] The present application also provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.

[0041] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above methods are implemented.

[0042] The present application provides a data storage method, device, equipment and storage medium. The method receives multiple SQL statements sent by a user, parses the multiple SQL statements respectively, and determines the grammatical structure of each SQL statement; encapsulates each SQL statement into a target statement of a Java grammatical structure according to the grammatical structure so that each work node can execute it; then stores the target statement in a pre-created temporary table, and generates an execution plan for each target statement; sends each execution plan to each work node, so that each work node obtains data according to the execution plan when receiving the execution plan, stores the data in a corresponding database, and generates an execution result and stores it in a temporary table; finally, extracts the execution result of each work node from the temporary table, summarizes the execution result of each work node and sends it to the user, so that by encapsulating each SQL statement and storing it in a temporary table, the execution plan of each target statement is managed by the temporary table, and the purpose of unified storage operation is achieved, avoiding the need to submit each SQL statement independently through a big data platform, and the operation method is more efficient and convenient; at the same time, each work node completes data storage, summarizes the execution results of each work node and sends them to the user, reducing the processing pressure of the big data platform. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 A schematic diagram of a data storage method according to an embodiment of the present application;

[0044] Figure 2 This is a schematic block diagram of the structure of a data storage device according to an embodiment of the present application;

[0045] Figure 3 A schematic block diagram of the structure of a computer device according to an embodiment of the present application.

[0046] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0048] refer to Figure 1 The present application proposes a data storage method, which uses a big data platform as an execution subject to improve the storage efficiency of data. In one embodiment, the data storage method includes the following steps:

[0049] S11, receiving multiple SQL statements sent by a user, parsing the multiple SQL statements respectively, and determining the grammatical structure of each of the SQL statements;

[0050] S12, according to the grammatical structure, encapsulating each of the SQL statements into a target statement with a Java grammatical structure;

[0051] S13, storing the target statement in a pre-created temporary table, and generating an execution plan for each target statement; wherein the temporary table is used to manage each execution plan;

[0052] S14, sending each execution plan to each working node, so that each working node, when receiving the execution plan, obtains data according to the execution plan, stores the data in a corresponding database, and generates an execution result and stores it in the temporary table;

[0053] S15. Extract the execution result of each working node from the temporary table, summarize the execution result of each working node and send it to the user.

[0054] As described in the above step S11, SQL is the abbreviation of Structured Query Language, and its Chinese name is Structured Query Language. SQL statements are a database query and programming language used to access data and query, update and manage relational database systems.

[0055] When the big data platform receives multiple SQL statements at the same time, it parses the multiple SQL statements separately to determine the grammatical structure of each SQL statement. During the specific parsing, the SQL statements are first preprocessed to achieve standardization of SQL statements. For example, the spaces before and after the SQL statements are removed, the consecutive blank characters are replaced with a single space, the SQL statements are converted to lowercase, an end symbol is added to the end of the SQL statement, etc. The SQL statements are then divided into statement blocks, and the grammatical structured description information in the statement blocks is extracted to determine the grammatical structure of the SQL statements.

[0056] As described in step S12 above, according to the grammatical structure, the groovy script is called to encapsulate each of the SQL statements into a target statement of the java grammatical structure so as to be stored in the database. Among them, the database is the clickhouse database, and Groovy is an agile development language based on JVM (Java virtual machine). It combines many powerful features of Python, Ruby and Smalltalk. Groovy code can be well combined with Java code and can also be used to expand existing code. Due to its characteristics of running on JVM, Groovy can also use libraries written in other non-Java languages.

[0057] As described in step S13 above, this step uses a pre-built temporary table to manage the execution process of each SQL statement. The temporary table in the process needs to be registered in the context and takes effect during execution. The table name ends with the task ID and also contains information about the retention period. The temporary table can be deleted using the drop statement inside the stored procedure, or it can be deleted by the temporary table cleanup process guarded by the background.

[0058] In addition, a temporary table is a data table created in a database, and a temporary table is created in a database, and the temporary table is used to store various execution plans. Among them, the execution plan in the database refers to the description of the execution process of the SQL (Structured query language) statement. Each time the database server executes the SQL statement sent by the client, it needs to parse the SQL statement and generate the corresponding execution plan, and complete the data storage according to the execution plan.

[0059] Creating a temporary table in the database means creating a temporary table connected to the performance table v$sql and the performance table v$sql_plan in the database to store SQL instructions in the performance table v$sql and the corresponding execution plan in the performance table v$sql_plan, so as to extend the storage time of SQL instructions and the corresponding SQL execution plan.

[0060] As described in step S14 above, the temporary table can set the execution time for each execution plan, and send each execution plan to each working node according to the execution time, so that each working node can obtain the data to be stored according to the target statement in the execution plan when receiving the execution plan, and store the data in the corresponding database, that is, each working node corresponds to a database, and generate the execution result and store it in the temporary table. Among them, the execution result is the data storage result of each working node, such as whether the data is stored successfully, the storage duration, the storage location, etc. Preferably, after the storage process is completed, a result table can also be constructed to save the final result, and finally provide query statistics to the outside, which can also be used for data synchronization to hive.

[0061] As described in the above step S15, after acquiring the execution results of each working node, this step summarizes the execution results of each working node and sends them to the user so that the user can view the storage status of the data.

[0062] The present application provides a data storage method, which receives multiple SQL statements sent by a user, parses the multiple SQL statements respectively, and determines the grammatical structure of each SQL statement; encapsulates each SQL statement into a target statement of a Java grammatical structure according to the grammatical structure so that each work node can execute it; then stores the target statement in a pre-created temporary table, and generates an execution plan for each target statement; sends each execution plan to each work node, so that each work node obtains data according to the execution plan when receiving the execution plan, stores the data in a corresponding database, and generates an execution result and stores it in a temporary table; finally, extracts the execution result of each work node from the temporary table, summarizes the execution result of each work node and sends it to the user, so that by encapsulating each SQL statement and storing it in a temporary table, the execution plan of each target statement is managed by the temporary table, the purpose of unified storage operation is achieved, and it is avoided that each SQL statement needs to be submitted independently through a big data platform, and the operation method is more efficient and convenient; at the same time, each work node completes data storage, summarizes the execution result of each work node and sends it to the user, reducing the processing pressure of the big data platform.

[0063] In one embodiment, in step S11, the step of respectively parsing the plurality of SQL statements may specifically include:

[0064] S111, parsing the SQL statement, obtaining keywords in the SQL statement, and determining the grammatical structure of the SQL statement according to the keywords;

[0065] At this time, in step S12, the step of encapsulating each of the SQL statements into a target statement of a Java syntax structure may specifically include:

[0066] S121, encapsulating each keyword into an intermediate object corresponding to the grammatical structure;

[0067] S122, converting each intermediate object into a target statement of the Java grammatical structure.

[0068] In the specific implementation process, the SQL statement can be parsed to obtain the keywords in the SQL statement, the grammatical structure of the SQL statement can be determined according to the keywords, and each keyword can be encapsulated into an intermediate object, which is converted into a target statement with a Java grammatical structure.

[0069] In one embodiment, in step S11, the step of respectively parsing the plurality of SQL statements includes:

[0070] A111. Determine whether there is any analytical function in the multiple SQL statements that is not supported by the data warehouse tool;

[0071] A112. If the unsupported parsing function exists, obtain the SQL statement of the unsupported parsing function by the data warehouse tool to obtain the target SQL statement, and convert the unsupported parsing function according to a preset processing method to obtain the target parsing function;

[0072] A113. Utilize the target parsing function to parse the target SQL statement.

[0073] In the big data platform, some parsing functions are not supported in SQL, such as the date conversion function to_date, the data conversion function int, and the character conversion function to_char. They need to be converted to parsing functions supported in SQL.

[0074] In the process of parsing multiple SQL statements separately, it is necessary to find out the differences that do not conform to the SQL statements, and then replace the differences based on the preset conversion rules. Specifically, it is determined whether there are unsupported operation commands in the SQL statements, namely update operations, delete operations and submit operations, and then they are converted according to the preset corresponding operation rules. It is further determined whether there are parsing functions in the SQL statements that are not supported by the data warehouse tool hive, such as date conversion, data conversion, character conversion, etc., and then the functions are converted according to the preset conversion rules.

[0075] In one embodiment, after the step of aggregating the execution results of each working node and sending the result to the user, the following steps may also be included:

[0076] Receive query requests of SQL statements;

[0077] Extracting the SQL syntax to be queried from the query request, processing the SQL syntax to be queried using a preset rule, and obtaining a processing result;

[0078] Determine an index that matches the processing result of the SQL grammar to be queried from the preset encrypted SQL grammar indexes, and determine the target encrypted SQL grammar;

[0079] Based on the target encrypted SQL grammar, generate a target SQL statement;

[0080] The target SQL statement is determined as a query result and returned.

[0081] In this embodiment, if the query request of the SQL statement includes the SQL statement to be queried, the SQL statement to be queried may include the SQL syntax to be queried and the SQL parameter to be queried, and the query result of the SQL statement to be queried may be obtained by comprehensively querying the encrypted SQL parameter and the encrypted SQL syntax. Specifically, a query request of the SQL statement is received; in response to determining that the query request includes the SQL statement to be queried, the SQL syntax to be queried and the SQL parameter to be queried may be extracted from the SQL statement to be queried; the SQL syntax to be queried and the SQL parameter to be queried are processed using preset rules; the indexes matching the processing results of the SQL syntax to be queried and the processing results of the SQL parameter to be queried are determined from the indexes of each encrypted SQL syntax and the indexes of each encrypted SQL parameter, respectively, to determine the target encrypted SQL syntax and the target encrypted SQL parameter; based on the target encrypted SQL syntax and the target encrypted SQL parameter, a target SQL statement is generated; the target SQL statement is determined as the query result and returned.

[0082] In one embodiment, in step S14, the step of sending each execution plan to each working node may specifically include:

[0083] S141. Analyze the execution plan of each working node to obtain the node name of each working node;

[0084] S142. According to the node name, the execution plan of each working node is sent to each working node in the form of a message pair, and the sending status of each execution plan is recorded.

[0085] In this embodiment, the big data platform searches for the nodeid value in the connected working node, and sends a piece of data corresponding to the node in the execution plan to the corresponding working node in the form of a message pair. After each working node is successfully sent, the status is marked as 1, indicating that the sending is successful.

[0086] In one embodiment, in step S15, the step of summarizing the execution results of each working node and sending them to the user may specifically include:

[0087] S151, collecting the execution results of each working node in a data table;

[0088] S152: Send the data table to the user.

[0089] Specifically, when SQL statements are executed in multiple databases and tables, multiple data result sets will be obtained, which will be merged and compiled into a data table for output. For example, when new query statements are executed in clickhouse database a and clickhouse database b, multiple data result sets will be merged and compiled into a data table for output, making the operation as convenient as a single database and single table.

[0090] In one embodiment, when parsing a query statement, a field with a sorting condition is obtained, the field with the sorting condition is obtained, a new query statement is executed according to the sorting condition, multiple result sets of sorted data are obtained, and then a list output is generated after sorting using a merge sort algorithm. This embodiment sorts the result sets of multiple data obtained and then generates a list output. This makes the operation simple and more convenient for users.

[0091] In one embodiment, in step S14, after the step of extracting the execution result of each working node from the temporary table, the following may also be included:

[0092] The target statement corresponding to the execution result is queried, and the target statement corresponding to the execution result is deleted from the temporary table.

[0093] In this embodiment, when the stored procedure ends, the data of the partition where the task is located is cleaned up, or left to the background temporary partition cleaning process for deletion, and the target statement that is about to be executed and obtain the execution result is deleted from the temporary table to avoid occupying storage space.

[0094] Specifically, after the execution results in the temporary table are sent to the user, in order to reduce the storage pressure of the database, the target statement corresponding to the execution result that has been sent to the user and stored in the temporary table can be deleted, so as to facilitate the data scanning and storage of the execution plan related data when the scheduled task is executed next time, so as to release the storage pressure of the database in time.

[0095] In one embodiment, the execution results, temporary tables and other data of each working node can be stored in the nodes of the blockchain network, and a data storage method as described above is implemented in the blockchain network.

[0096] As mentioned above, blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0097] The underlying blockchain platform can include processing modules such as user management, basic services, smart contracts, and operation monitoring. Among them, the user management module is responsible for the identity information management of all blockchain participants, including maintaining public and private key generation (account management), key management, and the maintenance of the correspondence between the user's real identity and the blockchain address (authority management), etc., and, under authorization, supervises and audits the transactions of certain real identities and provides risk control rule configuration (risk control audit); the basic service module is deployed on all blockchain node devices to verify the validity of business requests, and records valid requests to storage after consensus is reached. For a new business request, the basic service first adapts the interface for parsing and authentication (interface adaptation), and then encrypts the business information through the consensus algorithm (consensus management). The smart contract module is responsible for the registration and issuance of contracts, as well as contract triggering and contract execution. Developers can define the contract logic in a programming language and publish it to the blockchain (contract registration). According to the logic of the contract terms, the key or other events are called to trigger the execution and complete the contract logic. It also provides the function of contract upgrade and cancellation. The operation monitoring module is mainly responsible for the deployment, configuration modification, contract setting, cloud adaptation and real-time status visualization output of the product during the product release process, such as alarm, network monitoring, node equipment health monitoring, etc.

[0098] Reference Figure 2 , the embodiment of the present application also provides a data storage device, including:

[0099] The receiving module 11 is used to receive multiple SQL statements sent by the user, parse the multiple SQL statements respectively, and determine the grammatical structure of each SQL statement;

[0100] An encapsulation module 12 is used to encapsulate each of the SQL statements into a target statement of a Java syntax structure according to the syntax structure;

[0101] A generating module 13, used to store the target statement in a pre-created temporary table and generate an execution plan for each target statement; wherein the temporary table is used to manage each execution plan;

[0102] The sending module 14 is used to send each execution plan to each working node, so that each working node, when receiving the execution plan, obtains data according to the target statement in the execution plan, stores the data in the corresponding database, and generates an execution result and stores it in the temporary table;

[0103] The summarizing module 15 is used to extract the execution result of each working node from the temporary table, summarize the execution result of each working node and send it to the user.

[0104] SQL is the abbreviation of Structured Query Language. Its Chinese name is Structured Query Language. SQL statement is a database query and programming language used to access data and query, update and manage relational database systems.

[0105] When the big data platform receives multiple SQL statements at the same time, it parses the multiple SQL statements separately to determine the grammatical structure of each SQL statement. During the specific parsing, the SQL statements are first preprocessed to achieve standardization of SQL statements. For example, the spaces before and after the SQL statements are removed, the consecutive blank characters are replaced with a single space, the SQL statements are converted to lowercase, an end symbol is added to the end of the SQL statement, etc. The SQL statements are then divided into statement blocks, and the grammatical structured description information in the statement blocks is extracted to determine the grammatical structure of the SQL statements.

[0106] According to the grammatical structure, the groovy script is called to encapsulate each of the SQL statements into a target statement of the java grammatical structure so as to be stored in the database. The database is the clickhouse database. Groovy is an agile development language based on JVM (Java Virtual Machine). It combines many powerful features of Python, Ruby and Smalltalk. Groovy code can be well combined with Java code and can also be used to expand existing code. Due to its characteristics of running on JVM, Groovy can also use libraries written in other non-Java languages.

[0107] In addition, you can also use pre-built temporary tables to manage the execution process of each SQL statement. The temporary table in the process needs to be registered in the context and takes effect during execution. The table name ends with the task ID and also contains information about the retention period. The temporary table can be deleted using the drop statement inside the stored procedure, or it can be deleted by the temporary table cleanup process guarded by the background.

[0108] Among them, a temporary table is a data table created in the database, and a temporary table is created in the database, and the temporary table is used to store various execution plans. Among them, the execution plan in the database refers to the description of the execution process of the SQL (Structured query language) statement. Each time the database server executes the SQL statement sent by the client, it needs to parse the SQL statement and generate the corresponding execution plan, and complete the data storage according to the execution plan.

[0109] Creating a temporary table in the database means creating a temporary table connected to the performance table v$sql and the performance table v$sql_plan in the database to store SQL instructions in the performance table v$sql and the corresponding execution plan in the performance table v$sql_plan, so as to extend the storage time of SQL instructions and the corresponding SQL execution plan.

[0110] The temporary table can set the execution time for each execution plan, and send each execution plan to each working node according to the execution time, so that each working node can obtain the data to be stored according to the execution plan when receiving the execution plan, store the data in the corresponding database, that is, each working node corresponds to a database, and generate the execution result and store it in the temporary table. Among them, the execution result is the data storage result of each working node, such as whether the data is stored successfully, the storage duration, the storage location, etc. . Preferably, after the storage process is processed, a result table can also be constructed to save the final result, and finally provide query statistics to the outside, which can also be used for data synchronization to hive.

[0111] After obtaining the execution results of each working node, the execution results of each working node are summarized and sent to the user so that the user can view the storage status of the data.

[0112] As described above, it can be understood that the various components of the data storage device proposed in the present application can realize the functions of any of the data storage methods described above, and the specific structure will not be repeated.

[0113] Reference Figure 3 In the embodiment of the present application, a computer device is also provided, whose internal structure can be as follows Figure 3 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor designed by the computer is used to provide computing and control capabilities. The memory of the computer device includes a storage medium and an internal memory. The storage medium stores an operating system, a computer program and a database. The memory provides an environment for the operation of the operating system and the computer program in the storage medium. The database of the computer device is used to store data such as temporary tables and execution results. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data storage method is implemented.

[0114] The processor executes the data storage method, including:

[0115] Receiving multiple SQL statements sent by a user, parsing the multiple SQL statements respectively, and determining the grammatical structure of each of the SQL statements;

[0116] According to the grammatical structure, each of the SQL statements is encapsulated into a target statement of a Java grammatical structure;

[0117] The target statements are stored in a pre-created temporary table, and an execution plan for each target statement is generated; wherein the temporary table is used to manage each execution plan;

[0118] Send each execution plan to each working node, so that each working node, when receiving the execution plan, obtains data according to the execution plan, stores the data in a corresponding database, and generates an execution result and stores it in the temporary table;

[0119] The execution result of each working node is extracted from the temporary table, and the execution result of each working node is summarized and sent to the user.

[0120] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, a data storage method is implemented, including the steps of:

[0121] Receiving multiple SQL statements sent by a user, parsing the multiple SQL statements respectively, and determining the grammatical structure of each of the SQL statements;

[0122] According to the grammatical structure, each of the SQL statements is encapsulated into a target statement of a Java grammatical structure;

[0123] The target statements are stored in a pre-created temporary table, and an execution plan for each target statement is generated; wherein the temporary table is used to manage each execution plan;

[0124] Send each execution plan to each working node, so that each working node, when receiving the execution plan, obtains data according to the execution plan, stores the data in a corresponding database, and generates an execution result and stores it in the temporary table;

[0125] The execution result of each working node is extracted from the temporary table, and the execution result of each working node is summarized and sent to the user.

[0126] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided in the present application and used in the embodiments can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double-speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0127] In summary, the greatest beneficial effects of this application are:

[0128] The present application provides a data storage method, device, equipment and storage medium. The method receives multiple SQL statements sent by a user, parses the multiple SQL statements respectively, and determines the grammatical structure of each SQL statement; encapsulates each SQL statement into a target statement of a Java grammatical structure according to the grammatical structure so that each work node can execute it; then stores the target statement in a pre-created temporary table, and generates an execution plan for each target statement; sends each execution plan to each work node, so that each work node obtains data according to the execution plan when receiving the execution plan, stores the data in a corresponding database, and generates an execution result and stores it in a temporary table; finally, extracts the execution result of each work node from the temporary table, summarizes the execution result of each work node and sends it to the user, so that by encapsulating each SQL statement and storing it in a temporary table, the execution plan of each target statement is managed by the temporary table, and the purpose of unified storage operation is achieved, avoiding the need to submit each SQL statement independently through a big data platform, and the operation method is more efficient and convenient; at the same time, each work node completes data storage, summarizes the execution results of each work node and sends them to the user, reducing the processing pressure of the big data platform.

[0129] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, device, article or method including the element.

[0130] The above description is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A data storage method, It is characterized in that The following steps are involved: Receiving multiple SQL statements sent by a user, parsing the multiple SQL statements respectively, and determining the grammatical structure of each of the SQL statements; According to the grammatical structure, each of the SQL statements is encapsulated into a target statement with a Java grammatical structure; The target statements are stored in a pre-created temporary table, and an execution plan for each target statement is generated; wherein the temporary table is used to manage each execution plan; The temporary table sets an execution time for each execution plan, and sends each execution plan to each working node according to the execution time, so that each working node obtains data according to the execution plan when receiving the execution plan, stores the data in the corresponding database, and generates an execution result and stores it in the temporary table; The execution result of each working node is extracted from the temporary table, and the execution result of each working node is summarized and sent to the user.

2. The method according to claim 1, It is characterized in that The step of respectively parsing the multiple SQL statements includes: Parsing the SQL statement, obtaining keywords in the SQL statement, and determining the grammatical structure of the SQL statement according to the keywords; The step of encapsulating each of the SQL statements into a target statement with a Java syntax structure comprises: Encapsulate each keyword into an intermediate object corresponding to the grammatical structure; Each intermediate object is converted into a target statement of the Java grammar structure.

3. The method according to claim 1, It is characterized in that After the step of aggregating the execution results of each working node and sending the result to the user, the method further includes: Receive query requests of SQL statements; Extracting the SQL syntax to be queried from the query request, processing the SQL syntax to be queried using a preset rule, and obtaining a processing result; Determine an index that matches the processing result of the SQL grammar to be queried from the preset encrypted SQL grammar indexes, and determine the target encrypted SQL grammar; Based on the target encrypted SQL grammar, generate a target SQL statement; The target SQL statement is determined as a query result and returned.

4. The method according to claim 1, It is characterized in that The step of sending each execution plan to each working node includes: Parse the execution plan of each working node and obtain the node name of each working node; According to the node name, the execution plan of each working node is sent to each working node in the form of message pairs, and the sending status of each execution plan is recorded.

5. The method according to claim 1, It is characterized in that The step of respectively parsing the multiple SQL statements includes: Determine whether there is any analytical function in the multiple SQL statements that is not supported by the data warehouse tool; If the unsupported parsing function exists, the SQL statement of the parsing function that is not supported by the data warehouse tool is obtained to obtain the target SQL statement, and the unsupported parsing function is converted according to a preset processing method to obtain the target parsing function; The target SQL statement is parsed using the target parsing function.

6. The method according to claim 1, It is characterized in that The step of summarizing the execution results of each working node and sending them to the user includes: Gather the execution results of each working node in the data table; The data table is sent to the user.

7. The method according to claim 1, It is characterized in that After the step of extracting the execution result of each working node from the temporary table, the method further includes: The target statement corresponding to the execution result is queried, and the target statement corresponding to the execution result is deleted from the temporary table.

8. A data storage device, It is characterized in that include: A receiving module, used for receiving multiple SQL statements sent by a user, parsing the multiple SQL statements respectively, and determining the grammatical structure of each of the SQL statements; An encapsulation module, used for encapsulating each of the SQL statements into a target statement with a Java syntax structure according to the syntax structure; A generation module, used to store the target statement in a pre-created temporary table and generate an execution plan for each target statement; wherein the temporary table is used to manage each execution plan; A sending module is used to send each execution plan to each working node according to the execution time, so that each working node obtains data according to the execution plan when receiving the execution plan, stores the data in the corresponding database, and generates an execution result and stores it in the temporary table; the temporary table sets the execution time for each execution plan; The summary module is used to extract the execution result of each working node from the temporary table, summarize the execution result of each working node and send it to the user.

9. A computer device, It is characterized in that include: processor; Memory; The memory stores a computer program, and when the computer program is executed by the processor, the data storage method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the data storage method according to any one of claims 1 to 7.