CN109325042B - Processing template acquisition method, form processing method, device, equipment and medium - Google Patents

Processing template acquisition method, form processing method, device, equipment and medium Download PDF

Info

Publication number
CN109325042B
CN109325042B CN201810921298.8A CN201810921298A CN109325042B CN 109325042 B CN109325042 B CN 109325042B CN 201810921298 A CN201810921298 A CN 201810921298A CN 109325042 B CN109325042 B CN 109325042B
Authority
CN
China
Prior art keywords
processing
sql
data table
character string
processed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810921298.8A
Other languages
Chinese (zh)
Other versions
CN109325042A (en
Inventor
徐翔宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Life Insurance Company of China Ltd
Original Assignee
Ping An Life Insurance Company of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Life Insurance Company of China Ltd filed Critical Ping An Life Insurance Company of China Ltd
Priority to CN201810921298.8A priority Critical patent/CN109325042B/en
Publication of CN109325042A publication Critical patent/CN109325042A/en
Application granted granted Critical
Publication of CN109325042B publication Critical patent/CN109325042B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a processing template acquisition method, a form processing method, a device, equipment and a medium, wherein the processing template acquisition method comprises the following steps: acquiring a matching character string, and screening SQL sentences in a SPARK calculation engine according to the matching character string to obtain SQL functional sentences; correlating the SQL function sentences screened out by the same matching character string; classifying the SQL function sentences according to the associated matching character strings, and extracting the SQL function sentences to an XML file; and replacing the processing object element in each SQL function statement with a placeholder in the XML file to obtain a processing template, wherein the processing template is a template for processing the data table by using the SQL function statement in the XML file through a SPARK calculation engine. The processing template acquisition method can modify SQL sentences in the SPARK calculation engine and can perform batch operation on the data tables aiming at the SQL sentences in the program.

Description

Processing template acquisition method, form processing method, device, equipment and medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method for obtaining a processing template, a method for processing a table, a device, equipment, and a medium.
Background
At present, in the SPARK calculation engine, after SQL sentences are written into a program, the SQL sentences in the program cannot be uniformly managed, so that the development and maintenance time cost is increased. When the data tables are configured in batches according to the SQL sentences, the SQL sentences are modified, names of the data tables are written into the SPARK calculation engine one by one, and the processing efficiency is low.
Disclosure of Invention
The embodiment of the invention provides a processing template acquisition method, a device, a counting device and a medium, which can modify SQL sentences in a SPARK calculation engine and can perform batch operation on data tables aiming at the SQL sentences in a program.
The embodiment of the invention provides a table processing method, a device, equipment and a medium, which can improve the efficiency of batch operation of data tables aiming at SQL sentences.
A process template acquisition method comprising:
acquiring a matching character string, and screening SQL sentences in a SPARK calculation engine according to the matching character string to obtain SQL functional sentences;
correlating the SQL function sentences screened out by the same matching character string;
classifying the SQL function sentences according to the associated matching character strings, and extracting the SQL function sentences to an XML file;
And replacing the processing object element in each SQL function statement with a placeholder in the XML file to obtain a processing template, wherein the processing template is a template for processing the data table by using the SQL function statement in the XML file through a SPARK calculation engine.
A form processing method, comprising:
acquiring a data table processing request, wherein the data table processing request comprises a data table processing type and a data table to be processed, and the data table to be processed comprises a name of the data table to be processed;
acquiring a processing template according to the processing type of the data table, wherein the processing template is acquired by adopting the processing template acquisition method;
calculating a key value corresponding to each to-be-processed data table name, and putting the to-be-processed data table name into a hash map according to the key value;
and processing the data table to be processed according to the processing template and the key value.
A process template acquisition apparatus comprising:
the screening module is used for acquiring a matching character string, screening SQL sentences in the SPARK calculation engine according to the matching character string, and obtaining SQL functional sentences;
The association module is used for associating the SQL function sentences screened out by the same matching character string together;
the classification extraction module is used for classifying the SQL function sentences according to the associated matching character strings and extracting the SQL function sentences into XML files;
and the replacing module is used for replacing the processing object element in each SQL function statement with a placeholder in the XML file to obtain a processing template, wherein the processing template is a template for processing a data table by using the SQL function statement in the XML file through a SPARK calculation engine.
A form processing apparatus comprising:
the request acquisition module is used for acquiring a data form processing request, wherein the data form processing request comprises a data form processing type and a data form to be processed, and the data form to be processed comprises a data form name to be processed;
the processing template acquisition module is used for acquiring a processing template according to the processing type of the data form, wherein the processing template is acquired by adopting the processing template acquisition method;
the key value calculation module is used for calculating a key value corresponding to each to-be-processed data table name, and placing the to-be-processed data table name into a hash map according to the key value;
And the processing module is used for processing the data form to be processed according to the processing template and the key value.
A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the above-described processing template acquisition method when executing the computer program; alternatively, the processor may implement the steps of the table processing method described above when executing the computer program.
A computer-readable storage medium storing a computer program which, when executed by a processor, implements the steps of the above-described processing template acquisition method; alternatively, the computer program when executed by a processor implements the steps of the table processing method described above.
According to the method, the device, the computer equipment and the storage medium for acquiring the processing template, the SQL sentences are screened, the SQL function sentences obtained through screening are classified and then extracted into the corresponding XML files, and the processing object elements in each SQL function sentence are replaced by placeholders in the XML files, so that the processing template is obtained, the time for modifying and maintaining the SPARK calculation engine can be saved, and the development efficiency is improved. Meanwhile, the processing object elements in each SQL function statement are replaced by placeholders in the XML file, so that the processing template is obtained, the subsequent batch configuration processing of the data table can be facilitated, and the efficiency of the configuration processing of the data table is improved.
The method, the device, the computer equipment and the storage medium for processing the table are characterized in that the key value of the data table to be processed is calculated, the data table to be processed is put into the hash map, and the data table to be processed is processed through the key value and the processing template. Because the hash mapping is a data structure capable of directly reading data, the time for reading the data form to be processed can be saved when the data form to be processed is processed in batches, and the processing efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments of the present invention will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of an application environment for processing a template acquisition method or a table processing method according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method for processing template acquisition in accordance with an embodiment of the present invention;
FIG. 3 is a flowchart showing an implementation of step S10 in a processing template acquisition method according to an embodiment of the present invention;
FIG. 4 is a flowchart showing the implementation of step S20 in a processing template acquisition method according to an embodiment of the present application;
FIG. 5 is a flowchart showing the implementation of step S30 in a processing template acquisition method according to an embodiment of the present application;
FIG. 6 is a flow chart of a table processing method in an embodiment of the application;
FIG. 7 is a flowchart showing the implementation of step S80 in a table processing method according to an embodiment of the present application;
FIG. 8 is a schematic block diagram of a processing template acquisition apparatus according to an embodiment of the present application;
FIG. 9 is a schematic block diagram of a table processing device in accordance with an embodiment of the present application;
FIG. 10 is a schematic diagram of a computer device in accordance with an embodiment of the application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The processing template acquisition method provided by the application can be applied to an application environment as shown in fig. 1, wherein a client (computer equipment) communicates with a server through a network. The client sends the matching character string to the server. And the server screens the SQL sentences in the SPARK calculation engine according to the matching character strings, classifies the SQL functional sentences obtained by screening and extracts the SQL functional sentences into XML files, and replaces the processing object elements in the SQL functional sentences with placeholders to obtain the processing templates. Among other things, meter clients (computer devices) may be, but are not limited to, various personal computers, notebook computers, smartphones, tablet computers, and portable wearable devices. The server may be implemented by a stand-alone service or a server cluster formed by a plurality of servers.
In one embodiment, as shown in fig. 2, a method for obtaining a processing template is provided, and the method is applied to the server in fig. 1 for illustration, and includes the following steps:
s10: and obtaining a matching character string, and screening the SQL sentences in the SPARK calculation engine according to the matching character string to obtain the SQL functional sentences.
In this embodiment, SQL is a structured language (Structured Query Language, SQL) that can be used to access data and query, update, and manage relational database systems, and SQL statements are a language in which databases are operated. The matching string is a string which is preset and used for screening SQL sentences in the SPARK calculation engine. Specifically, the user can input a preset matching character string through the client, the client sends the matching character string to the server, and the server obtains the matching character string. A SPARK computing engine is a fast and versatile computing engine designed for large-scale data processing. The SQL function statement is an SQL statement obtained by screening in the SPARK calculation engine according to the matching character string. After the server acquires the matching character string, screening is carried out in the SPARK calculation engine according to the matching character string, and the SQL statement obtained by screening is used as an SQL functional statement. For example, if the matching string is "drop table" and "create table", then in the SPARK calculation engine, all SQL statements containing the "drop table" and "create table" are filtered out as SQL function statements.
Illustratively, for a complete SQL statement "drop table test" in the SPARK compute engine; the server screens out the SQL sentences containing the drop table according to the matching character string of the drop table to obtain an SQL function sentence of the drop table test; ".
S20: and correlating SQL function sentences screened out by the same matching character string.
Specifically, according to the matching character string, SQL function sentences screened out by using the same matching character string are associated together. The same notation can be used for the association mode to mark SQL function sentences screened out by using the same matching character string. The symbol may be any character, for example, a number, an english letter, or other symbol that can be recognized by a computer. For example, SQL function sentences screened out by using "create table" as the matching character string are associated together, and SQL function sentences screened out by using "drop table" as the matching character string are associated together.
S30: and classifying SQL function sentences according to the associated matching character strings, and extracting the SQL function sentences into an XML file.
In the present embodiment, an XML (extensible markup language ) file refers to a file for storing the extracted SQL function statement.
Specifically, SQL function sentences obtained after the same matching character string is used for association are classified into one class. For example, SQL function statements that are associated using "create table" as an associated matching string are classified into one type, and SQL function statements that are associated using "drop table" as an associated matching string are classified into one type.
Further, according to the result of classifying the SQL function sentences, the SQL function sentences are extracted into corresponding XML files, and each type of SQL function sentences corresponds to one XML file.
S40: and replacing the processing object element in each SQL function statement with a placeholder in the XML file to obtain a processing template, wherein the processing template is a template for processing the data table by using the SQL function statement in the XML file through the SPARK calculation engine.
In this embodiment, the placeholder refers to a symbol that occupies a fixed position in the SQL function statement in advance, and data can be input into the placeholder, and is processed according to the SQL function statement. The processing template is a template in the SPARK calculation engine, which can process the data table according to SQL function sentences in the processing template. Meanwhile, SQL function sentences in the processing template can be modified, so that the purpose of modifying functions realized by the SPARK calculation engine is achieved. The processing object element refers to an element corresponding to the name of the data table in the SQL function statement. For example, in the SQL function statement "drop table test; in "data table name" test "is the processing object element of the SQL function statement.
Specifically, the processing object elements in each SQL function statement in the XML file replace placeholders. For example, taking { key } as a placeholder, taking the original SQL function statement drop table test; the processing object element 'test' in the table is replaced by a placeholder, and a drop table { key }. Wherein, the deleted "test" refers to the corresponding data table name. And replacing the placeholder with the processing object element of each SQL function statement in the XML file, and adding a corresponding identifier to the XML file to serve as a processing template for processing the data table by using the SQL function statement in the XML file by the SPARK calculation engine.
Further, if the processing template is required to be used for processing the data table, the mark of the processing template can be obtained through a getXML statement in the SPARK calculation engine, and then the SQL function statement in the processing template is obtained according to the mark to process the data table.
In this embodiment, the SQL function sentences obtained by screening are classified and extracted into corresponding XML files, and the processing object elements in each SQL function sentence are replaced by placeholders in the XML files to obtain the processing templates, so that the time for modifying and maintaining the SPARK calculation engine can be saved, and the development efficiency is improved. Meanwhile, the processing object elements in each SQL function statement are replaced by placeholders in the XML file, so that the processing template is obtained, the subsequent batch configuration processing of the data table can be facilitated, and the efficiency of the configuration processing of the data table is improved.
In one embodiment, as shown in fig. 3, in step S10, a matching string is obtained, and the SQL function statement is obtained by filtering the SQL statement in the SPARK calculation engine according to the matching string, which specifically includes the following steps:
s11: and obtaining the matching character strings according to the function information of the SQL sentences.
In this embodiment, the function information refers to a function of the configuration implemented by the SQL statement corresponding to the data table. The function information includes: addition, deletion, modification, and query of data tables. And obtaining a corresponding matching character string according to the function information, namely, the matching character string corresponding to the addition of the data table is a "create table", the matching character string corresponding to the deletion of the data table is a "drop table", the matching character string corresponding to the modification of the data table is an "alter table", and the matching character string corresponding to the query of the data table is a "select".
Specifically, according to the function information of the SQL sentence, a matching character string corresponding to the function information is acquired. The function information and the corresponding matching character strings can be bound together in advance, and the corresponding matching character strings can be obtained according to the function information of the SQL sentence.
S12: the length of the matching string is calculated.
Specifically, the length of the matching string may be calculated by calling a length function. For example, for the matching string "select", the length calculated by this length function is 6 characters. Wherein the length function is a function for calculating and acquiring the character string length.
Preferably, if the matching string includes a space, it may be understood that the matching string is a string combination of adding one space to the number of spaces in the matching string, for example, for the matching string "drop table" including one space, it may be understood that the matching string is obtained by combining two strings "drop" and "table", and the length of each string may be calculated by a length function and connected by "+" as the length of the matching string, for example, for the matching string "drop table", the calculated length is represented by 4+5.
S13: and carrying out matching inquiry in the SQL sentence according to the length of the matching character string, and taking the character string with the same length as the matching character string in the SQL sentence as a comparison character string.
In this embodiment, the comparison string refers to a string used for comparison with the matching string in the SQL statement.
Specifically, according to the length of the matching string, in the SPARK calculation engine, SQL sentences with the length equal to the length of the matching string are obtained through a length function to serve as comparison strings. For example, if the matching string "select" has a length of 6 characters, the search engine obtains a string having a length of 6 characters as a comparison string by a length function. Preferably, if the matching string includes a space, for example, a matching string "drop table", when a matching query is performed in an SQL sentence by a length function, a string composed of strings of 4 characters in length plus strings of 5 characters in length is obtained as a comparison string.
S14: and judging whether the matching character string is identical with the comparison character string by adopting a naive algorithm.
In the present embodiment, the naive algorithm is an algorithm for judging whether two character strings match or not by effective offset.
Specifically, the naive algorithm starts to match from the character corresponding to the first position of the matching character string and the comparing character string, and if the matching character string is the same as the first character of the comparing character string, starts to match the character corresponding to the next position of the matching character string and the comparing character string. If the character matching result corresponding to any position of the matching character string and the comparison character string is different in the matching process, judging that the matching character string and the comparison character string are different, and ending the matching operation. If the matching character string is detected to be the same as the character corresponding to the last position of the comparison character string, judging that the matching character string is the same as the comparison character string, and ending the matching operation.
S15: if the judging result is the same, determining the SQL sentence corresponding to the comparison character string as the SQL function sentence.
Specifically, if it is determined in step S14 that the matching string is identical to the comparison string, the SQL statement corresponding to the comparison string is filtered out as an SQL function statement. For example, if the matching string is "drop table", the SQL statement containing the "drop table" is executed, for example, "drop table test; "as an SQL function statement.
In the filtering, the filtering may be performed by comparing the statement end identifier of the SQL statement corresponding to the character string by query. Specifically, the statement end identifier refers to a symbol for identifying the end of the SQL statement, and can be marked with a semicolon "; "means. Further, according to the comparison character string, searching and locating the SQL sentence to be screened by using an index method, and querying a sentence end mark (line. Index (")) of the SQL sentence by querying a semicolon. After locating the comparison character string and the sentence ending mark corresponding to the comparison character string, acquiring the SQL sentence between the comparison character string and the sentence ending mark corresponding to the comparison character string according to the comparison character string and the sentence ending mark corresponding to the comparison character string, and obtaining the SQL function sentence.
In this embodiment, by performing matching query in the SPARK calculation engine according to the length of the matching string, the comparison string obtained by the matching query and the matching string are subjected to a determination of a naive algorithm, and an SQL statement corresponding to the comparison string whose determination result is the same as the matching string is used as the SQL function statement. Because the general naive algorithm judges whether two character strings with unequal lengths are matched through effective offset, the algorithm does not perform preprocessing, but performs matching processing on the character strings, and the algorithm process is to move one-bit comparison character at a time, so the time complexity is very high. In this embodiment, the length function is adopted in advance to screen out the comparison character strings, and then the naive algorithm is directly adopted to perform character string matching, so that offset and one-to-one comparison in the whole SPARK calculation engine are not needed, the time for character string matching is greatly reduced, and the screening efficiency is improved.
In one embodiment, as shown in fig. 4, in step S20, the SQL function statements screened out by the same matching string are associated together, and specifically include the following steps:
s21: and obtaining the number of the matching character strings, and numbering each matching character string according to the number of the matching character strings.
In this embodiment, the number of matching strings is the number of function information of the SQL statement, that is, the function information of the SQL statement includes 4 kinds of function information, i.e., adding, deleting, modifying and querying the data table, and correspondingly, the number of matching strings is 4.
After the number of matching strings is obtained, each matching string is numbered according to the number. For example, if the number of matching strings is 4, the 4 matching strings are numbered with "1, 2, 3, and 4", respectively.
S22: and marking the SQL function statement by adopting a number corresponding to the matching character string, and completing the association between the SQL function statement and the corresponding matching character string.
Specifically, the SQL function sentences screened by using the same matching character strings are marked by using the numbers of the matching character strings, and the association of the SQL function sentences and the corresponding matching character strings is completed. It will be appreciated that SQL function statements of the same function information are associated together. For example, if the number of the matching string "drop table" is 1, and the SQL function statements screened by the matching string "drop table" are "drop table a" and "drop table B", the SQL function statements "drop table a" and "drop table B" are both marked with the number 1.
In this embodiment, by associating the SQL function sentences with the corresponding matching strings, the SQL function sentences having the same function information are associated together, so that the efficiency of classifying when extracting the SQL function sentences can be improved.
In one embodiment, as shown in fig. 5, in step S30, the SQL function statement is classified according to the associated matching string and extracted into an XML file, and specifically includes the following steps:
s31: and creating an XML file according to the number of the matched character strings.
Specifically, the XML files are created according to the number of matching strings, i.e., if the number of matching strings is 4, 4 XML files are created correspondingly.
S32: and marking the XML file according to the number corresponding to the matching character string.
Specifically, the XML files are labeled one by one using the numbers corresponding to the matching strings. And marking the next XML file by using the number corresponding to the next matching character string after marking the XML file by using the number corresponding to the matching character string, until all the numbers corresponding to the matching character strings mark the XML file.
S33: and extracting the SQL function statement into the corresponding XML file according to the marks of the XML file and the SQL function statement.
Specifically, according to the marks of the XML file and the SQL function statement, if the marks of the SQL function statement are the same as those of the XML file, the SQL function statement is extracted into the XML file. I.e., each XML file corresponds to the functional information of one SQL statement. The method for extracting the SQL function statement can be that an extracted SQL function statement is put into a container List by using a dom4j tool, then the SQL function statement and a corresponding XML file in the container List are read by the dom4j tool, and the read SQL function statement in the List is written into the XML file. Wherein, dom4j is a tool for reading and writing XML files, and the container List is a file for storing the extracted SQL function statement.
In this embodiment, after classifying the SQL function statements according to the corresponding matching strings, the SQL function statements are extracted into the corresponding XML files, which is favorable for obtaining the corresponding XML files according to the actual processing conditions when the data tables are processed by using the SQL function statements, and obtaining the corresponding SQL function statements in the XML files, thereby improving the processing efficiency of the data tables.
The form processing method provided by the application can also be applied to an application environment as shown in fig. 1, wherein a client (computer equipment) communicates with a server through a network. The client acquires the data form processing request and sends the data form processing request to the server. The server obtains a corresponding processing template according to the data form processing request, and processes the data form according to the processing template. Among other things, clients (computer devices) may be, but are not limited to, various personal computers, notebook computers, smartphones, tablet computers, and portable wearable devices. The server may be implemented by a stand-alone server or a server cluster formed by a plurality of servers.
In one embodiment, as shown in fig. 6, a table processing method is provided, and the method is applied to the server in fig. 1 for illustration, and includes the following steps:
s50: and acquiring a data table processing request, wherein the data table processing request comprises a data table processing type and a data table to be processed, and the data table to be processed comprises a name of the data table to be processed.
In this embodiment, the data table processing request refers to a request sent by the client to process the data table. The data table to be processed refers to a data table that needs to be processed. The to-be-processed data table name refers to a table name corresponding to the to-be-processed data table. The data table processing type corresponds to the function information of the SQL statement and comprises adding, deleting, modifying and inquiring the data table.
Specifically, when the data table to be processed is required to be processed, the client side acquires the data table to be processed and the data table processing type, then forms a data table processing request, sends the data table processing request to the server side, and the server side acquires the data table processing request.
S60: and acquiring a processing template according to the processing type of the data table, wherein the processing template is acquired by adopting a processing template acquisition method.
Specifically, according to the processing type of the data table, a processing template with a corresponding function is obtained, and the processing template is obtained by the processing template obtaining method. For example, if the data table processing type is deletion of the data table, a processing template corresponding to the deletion of the data table is obtained.
S70: and calculating a key value corresponding to each to-be-processed data table name, and putting the to-be-processed data table name into the hash map according to the key value.
In this embodiment, the hash map is a data structure that can directly read data. The key value is a key value for acquiring the data table storage location in the hash map.
Specifically, the key value of each to-be-processed data table name may be calculated by calling a function for acquiring the key value, such as a key function or hashcode function, and substituting each to-be-processed data table name into the function for acquiring the key value. After the key value of each data table name to be processed is calculated, the position of each data table name to be processed in the hash map is obtained according to the key value, and the data table name to be processed is placed in the hash map according to the position.
S80: and processing the data table to be processed according to the processing template and the key value.
Specifically, the key value of the data table to be processed is imported into the processing template in a mode of importing the key value of the data table to be processed into the placeholder of the processing template, and corresponding processing is carried out on the data table to be processed according to the function information corresponding to the processing template.
In this embodiment, the key value of the data table to be processed is calculated, the data table to be processed is put into the hash map, and the data table to be processed is processed through the key value and the processing template. Because the hash mapping is a data structure capable of directly reading data, the time for reading the data form to be processed can be saved when the data form to be processed is processed in batches, and the processing efficiency is improved.
In one embodiment, as shown in fig. 7, in step S80, according to the processing template and the key value, the data table to be processed is processed, which specifically includes the following steps:
s81: and importing the key value of the name of the data table to be processed into the placeholder of the processing template.
Specifically, the placeholder of the processing template may be a key value for acquiring the data table to be processed. Further, if there is only one data table to be processed, the key value of the data table to be processed is directly imported into the placeholder. If a plurality of (more than or equal to two) to-be-processed data tables exist, the key value of each to-be-processed data table is circularly imported into the placeholder, namely, after the key value of one to-be-processed data table is imported into the placeholder, the key value of the next to-be-processed data table is imported until all the key values are imported into the placeholder.
S82: and acquiring the name of the data table to be processed from the hash map according to the key value of the name of the data table to be processed.
Specifically, after the key value of the to-be-processed data table name is obtained, the corresponding to-be-processed data table name is obtained in the hash mapping according to the key value.
S83: and processing the data form to be processed according to the processing template.
Specifically, after the name of the data table to be processed is imported into the processing template through the key value of the name of the data table to be processed, corresponding processing is performed on the data table to be processed corresponding to the name of the data table to be processed according to the processing template.
In this embodiment, the key value of the name of the data table to be processed is imported into the placeholder of the processing template, and the processing template obtains the corresponding name of the data table to be processed from the hash map through the key value and processes the data table to be processed corresponding to the name of the data table to be processed, so that the speed of reading the data table to be processed can be improved, and the processing efficiency of the data table to be processed can be improved.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present invention.
In one embodiment, a processing template acquiring device is provided, and the processing template acquiring device corresponds to the processing template acquiring method in the above embodiment one by one. As shown in fig. 8, the processing template acquisition apparatus includes a screening module 81, an association module 82, a classification extraction module 83, and a replacement module 84. The functional modules are described in detail as follows:
the screening module 81 is configured to obtain a matching string, and screen the SQL statement in the SPARK calculation engine according to the matching string to obtain an SQL function statement;
the association module 82 is configured to associate the SQL function sentences screened out by the same matching character string together;
the classification extraction module 83 is configured to classify the SQL function statement according to the associated matching character string, and extract the SQL function statement to the XML file;
and a replacing module 84, configured to replace the processing object element in each SQL function statement with a placeholder in the XML file, to obtain a processing template, where the processing template is a template for processing the data table by the SPARK computing engine using the SQL function statement in the XML file.
Preferably, the screening module 81 includes:
a matching character string obtaining sub-module 811 for obtaining a matching character string according to the function information of the SQL statement;
A calculation sub-module 812 for calculating the length of the matching string;
the query sub-module 813 is configured to perform a matching query in the SQL statement according to the length of the matching string, and use a string in the SQL statement that is equal to the matching string in length as a comparison string;
a matching sub-module 814, configured to determine whether the matching string is identical to the comparison string by using a naive algorithm;
the judging sub-module 815 is configured to determine the SQL statement corresponding to the comparison string as an SQL function statement if the judging result is the same.
Preferably, the association module 82 includes:
a number obtaining sub-module 821, configured to obtain the number of matching strings, and number each matching string according to the number of matching strings;
and the association sub-module 822 is used for marking the SQL function statement by adopting the number corresponding to the matching character string, and completing association between the SQL function statement and the corresponding matching character string.
Preferably, the classification extraction module 83 comprises:
a creating sub-module 831 for creating an XML file according to the number of matching character strings;
a marking sub-module 832 for marking the XML file according to the number corresponding to the matching string;
the extracting submodule 833 is used for extracting the SQL function statement into the corresponding XML file according to the XML file and the mark of the SQL function statement.
The specific definition of the processing template acquisition device may be referred to as the definition of the processing template acquisition method hereinabove, and will not be described herein. The above-described respective modules in the processing template acquisition apparatus may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a table processing device is provided, which corresponds to the table processing method in the above embodiment one by one. As shown in fig. 9, the table processing apparatus includes a request acquisition module 91, a processing template acquisition module 92, a key value calculation module 93, and a processing module 94. The functional modules are described in detail as follows:
a request acquiring module 91, configured to acquire a data table processing request, where the data table processing request includes a data table processing type and a data table to be processed, and the data table to be processed includes a name of the data table to be processed;
the processing template obtaining module 92 is configured to obtain a processing template according to a processing type of the data table, where the processing template is obtained by using a processing template obtaining method;
A key value calculation module 93, configured to calculate a key value corresponding to each to-be-processed data table name, and put the to-be-processed data table name into the hash map according to the key value;
the processing module 94 is configured to process the data table to be processed according to the processing template and the key value.
Preferably, the processing module 94 includes:
an importing submodule 941, configured to import a key value of a name of a data table to be processed into a placeholder of a processing template;
the table name obtaining sub-module 942 is configured to obtain a table name of the data to be processed from the hash map according to a key value of the data to be processed;
the processing sub-module 943 is configured to process the data table to be processed according to the processing template.
For specific limitations of the form processing apparatus, reference may be made to the above limitations of the form processing method, and no further description is given here. The various modules in the above-described form processing apparatus may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which may be as shown in fig. 10. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used for storing the processing templates and the data tables to be processed. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a process template acquisition method; alternatively, the computer program is executed by a processor to implement a form processing method.
In one embodiment, a computer device is provided comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of when executing the computer program:
Acquiring a matching character string, and screening SQL sentences in the SPARK calculation engine according to the matching character string to obtain SQL functional sentences;
correlating SQL function sentences screened out by the same matching character string;
classifying SQL function sentences according to the associated matching character strings, and extracting the SQL function sentences into XML files;
and replacing the processing object element in each SQL function statement with a placeholder in the XML file to obtain a processing template, wherein the processing template is a template for processing the data table by using the SQL function statement in the XML file through the SPARK calculation engine.
Alternatively, the processor may perform the following steps when executing the computer program:
acquiring a data table processing request, wherein the data table processing request comprises a data table processing type and a data table to be processed, and the data table to be processed comprises a name of the data table to be processed;
acquiring a processing template according to the processing type of the data form, wherein the processing template is acquired by adopting a processing template acquisition method;
calculating a key value corresponding to each data table name to be processed, and putting the data table names to be processed into a hash map according to the key values;
and processing the data table to be processed according to the processing template and the key value.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring a matching character string, and screening SQL sentences in the SPARK calculation engine according to the matching character string to obtain SQL functional sentences;
correlating SQL function sentences screened out by the same matching character string;
classifying SQL function sentences according to the associated matching character strings, and extracting the SQL function sentences into XML files;
and replacing the processing object element in each SQL function statement with a placeholder in the XML file to obtain a processing template, wherein the processing template is a template for processing the data table by using the SQL function statement in the XML file through the SPARK calculation engine.
Alternatively, the computer program may, when executed by a processor, perform the steps of:
acquiring a data table processing request, wherein the data table processing request comprises a data table processing type and a data table to be processed, and the data table to be processed comprises a name of the data table to be processed;
acquiring a processing template according to the processing type of the data form, wherein the processing template is acquired by adopting a processing template acquisition method;
Calculating a key value corresponding to each data table name to be processed, and putting the data table names to be processed into a hash map according to the key values;
and processing the data table to be processed according to the processing template and the key value.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile 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. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention.

Claims (7)

1. A process template acquisition method, characterized in that the process template acquisition method comprises:
obtaining a matching character string, screening SQL sentences in a SPARK calculation engine according to the matching character string to obtain SQL functional sentences, wherein the method comprises the following steps:
Acquiring a matching character string according to the function information of the SQL sentence;
calculating the length of the matching character string;
performing matching inquiry in the SQL sentence according to the length of the matching character string, and taking the character string with the same length as the matching character string in the SQL sentence as a comparison character string;
judging whether the matching character string is identical with the comparison character string or not by adopting a naive algorithm;
if the judging result is the same, determining the SQL sentence corresponding to the comparison character string as the SQL function sentence;
the SQL function sentences screened out by the same matching character string are associated together, and the SQL function sentences comprise the following steps:
acquiring the number of the matching character strings, and numbering each matching character string according to the number of the matching character strings;
marking the SQL function statement by adopting a number corresponding to the matching character string to complete the association between the SQL function statement and the corresponding matching character string;
classifying the SQL function statement according to the associated matching character string, and extracting the SQL function statement into an XML file comprises:
creating an XML file according to the number of the matching character strings;
marking the XML file according to the number corresponding to the matching character string;
Extracting the SQL function statement into the corresponding XML file according to the XML file and the mark of the SQL function statement;
and replacing the processing object element in each SQL function statement with a placeholder in the XML file to obtain a processing template, wherein the processing template is a template for processing a data table by using the SQL function statement in the XML file through a SPARK calculation engine.
2. A form processing method, characterized in that the form processing method comprises:
acquiring a data table processing request, wherein the data table processing request comprises a data table processing type and a data table to be processed, and the data table to be processed comprises a name of the data table to be processed;
acquiring a processing template according to the processing type of the data table, wherein the processing template is acquired by adopting the processing template acquisition method of claim 1;
calculating a key value corresponding to each to-be-processed data table name, and putting the to-be-processed data table name into a hash map according to the key value;
and processing the data table to be processed according to the processing template and the key value.
3. The form processing method according to claim 2, wherein the processing the data form to be processed based on the processing template and the key value includes:
Importing the key value of the name of the data table to be processed into the placeholder of the processing template;
acquiring the name of the data table to be processed from the hash map according to the key value of the name of the data table to be processed;
and processing the data form to be processed according to the processing template.
4. A process template acquisition device for implementing the method according to claim 1, characterized in that the process template acquisition device comprises:
the screening module is used for acquiring a matching character string, screening SQL sentences in the SPARK calculation engine according to the matching character string, and obtaining SQL functional sentences;
the association module is used for associating the SQL function sentences screened out by the same matching character string together;
the classification extraction module is used for classifying the SQL function sentences according to the associated matching character strings and extracting the SQL function sentences into XML files;
and the replacing module is used for replacing the processing object element in each SQL function statement with a placeholder in the XML file to obtain a processing template, wherein the processing template is a template for processing a data table by using the SQL function statement in the XML file through a SPARK calculation engine.
5. A form processing apparatus, characterized in that the form processing apparatus comprises:
the request acquisition module is used for acquiring a data form processing request, wherein the data form processing request comprises a data form processing type and a data form to be processed, and the data form to be processed comprises a data form name to be processed;
a processing template acquisition module, configured to acquire a processing template according to the processing type of the data table, where the processing template is acquired by using the processing template acquisition method according to claim 1;
the key value calculation module is used for calculating a key value corresponding to each to-be-processed data table name, and placing the to-be-processed data table name into a hash map according to the key value;
and the processing module is used for processing the data form to be processed according to the processing template and the key value.
6. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the process template acquisition method according to claim 1 when the computer program is executed by the processor; alternatively, the processor, when executing the computer program, implements the steps of the form processing method according to any one of claims 2 to 3.
7. A computer-readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the steps of the processing template acquisition method of claim 1; alternatively, the computer program when executed by a processor implements the steps of a form processing method as claimed in any one of claims 2 to 3.
CN201810921298.8A 2018-08-14 2018-08-14 Processing template acquisition method, form processing method, device, equipment and medium Active CN109325042B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810921298.8A CN109325042B (en) 2018-08-14 2018-08-14 Processing template acquisition method, form processing method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810921298.8A CN109325042B (en) 2018-08-14 2018-08-14 Processing template acquisition method, form processing method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN109325042A CN109325042A (en) 2019-02-12
CN109325042B true CN109325042B (en) 2023-11-24

Family

ID=65263771

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810921298.8A Active CN109325042B (en) 2018-08-14 2018-08-14 Processing template acquisition method, form processing method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN109325042B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110083815B (en) * 2019-05-07 2023-05-23 中冶赛迪信息技术(重庆)有限公司 Synonymous variable identification method and system
CN110457302B (en) * 2019-07-31 2022-04-29 河南开合软件技术有限公司 Intelligent structured data cleaning method
CN110851346B (en) * 2019-09-24 2024-05-31 平安科技(深圳)有限公司 Query statement boundary problem detection method, device, equipment and storage medium
CN111158650B (en) * 2019-12-25 2023-06-27 中国建设银行股份有限公司 Report template and report generation method and device
CN111427849A (en) * 2020-02-27 2020-07-17 深圳壹账通智能科技有限公司 Data processing method, electronic device and storage medium
CN114168942A (en) * 2021-12-06 2022-03-11 北京天融信网络安全技术有限公司 Statement extraction method and device, electronic equipment and computer-readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104346334A (en) * 2013-07-23 2015-02-11 上海化工宝电子商务有限公司 Remote visual interface database system
CN105159997A (en) * 2015-09-08 2015-12-16 深圳禧金信息技术有限公司 Report form processing method and report form processing system
CN105677745A (en) * 2015-12-28 2016-06-15 国云科技股份有限公司 General efficient self-service data search system and implementation method
CN105912594A (en) * 2016-04-05 2016-08-31 深圳市深信服电子科技有限公司 SQL sentence processing method and system
CN106649503A (en) * 2016-10-11 2017-05-10 北京集奥聚合科技有限公司 Query method and system based on sql

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8140558B2 (en) * 2009-05-22 2012-03-20 International Business Machines Corporation Generating structured query language/extensible markup language (SQL/XML) statements

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104346334A (en) * 2013-07-23 2015-02-11 上海化工宝电子商务有限公司 Remote visual interface database system
CN105159997A (en) * 2015-09-08 2015-12-16 深圳禧金信息技术有限公司 Report form processing method and report form processing system
CN105677745A (en) * 2015-12-28 2016-06-15 国云科技股份有限公司 General efficient self-service data search system and implementation method
CN105912594A (en) * 2016-04-05 2016-08-31 深圳市深信服电子科技有限公司 SQL sentence processing method and system
CN106649503A (en) * 2016-10-11 2017-05-10 北京集奥聚合科技有限公司 Query method and system based on sql

Also Published As

Publication number Publication date
CN109325042A (en) 2019-02-12

Similar Documents

Publication Publication Date Title
CN109325042B (en) Processing template acquisition method, form processing method, device, equipment and medium
WO2020186786A1 (en) File processing method and apparatus, computer device and storage medium
CN108932294B (en) Resume data processing method, device, equipment and storage medium based on index
TWI634449B (en) Method and device for auditing sql
CN111090788B (en) json file comparison method and device, storage medium and computer equipment
CN113220782B (en) Method, device, equipment and medium for generating multi-element test data source
CN111563051B (en) Crawler-based data verification method and device, computer equipment and storage medium
CN111538779A (en) Incremental data synchronization method and device, computer equipment and storage medium
CN110377649B (en) Construction and query methods, devices, equipment and storage medium of tagged data
CN112559726A (en) Resume information filtering method, model training method, device, equipment and medium
CN110659282A (en) Data route construction method and device, computer equipment and storage medium
CN110659297A (en) Data processing method, data processing device, computer equipment and storage medium
CN112286934A (en) Database table importing method, device, equipment and medium
WO2020206838A1 (en) Code snippet translation method and apparatus, computer device, and storage medium
CN111083054B (en) Route configuration processing method and device, computer equipment and storage medium
CN112307169B (en) Address data matching method and device, computer equipment and storage medium
CN114356968A (en) Query statement generation method and device, computer equipment and storage medium
CN111274291B (en) Query method, device, equipment and medium for user access data
CN113505078A (en) Configuration file updating method, device, equipment and storage medium
CN110647452B (en) Test method, test device, computer equipment and storage medium
CN110674383B (en) Public opinion query method, device and equipment
CN111078671A (en) Method, device, equipment and medium for modifying data table field
CN115345166A (en) Method, device, equipment and storage medium for identifying disease diagnosis name of medical text
CN116049509A (en) Data query method, device, equipment and medium based on regular matching
CN112559671B (en) ES-based text search engine construction method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant