A Hive script testing method and device, electronic equipment and storage medium

By parsing Hive scripts and generating backup table operation statements, it was possible to perform drill tests on newly created backup tables, which solved the problem of drill testing of Hive scripts in a single test environment and improved test quality and efficiency.

CN115774674BActive Publication Date: 2026-07-21PING AN BANK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
PING AN BANK CO LTD
Filing Date
2022-12-05
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Because Hive scripts can only be executed in a single test environment of a big data platform, they cannot be used for drills and tests, resulting in a high risk of production accidents and making it impossible to ensure the quality and efficiency of drills and tests.

Method used

By parsing Hive scripts, table keywords and operation keywords are extracted to generate backup table creation and operation statements. Based on these statements, a test script is generated and executed on the newly created backup table to bypass the production environment for testing.

Benefits of technology

This ensured the successful testing and verification of Hive scripts, overcame the limitations of the testing environment, and improved the quality and efficiency of testing and verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115774674B_ABST
    Figure CN115774674B_ABST
Patent Text Reader

Abstract

The application provides a Hive script test method and device, electronic equipment and a storage medium. The method comprises the following steps: obtaining a target Hive script, performing analysis processing on the target Hive script, obtaining at least one Hive statement in the target Hive script, performing keyword retrieval on the at least one Hive statement, obtaining at least one table keyword in the at least one Hive statement and at least one table operation keyword corresponding to each table keyword, generating a backup table creation statement corresponding to a target table based on the table keyword, generating a backup table operation statement for the backup table according to the table operation keyword, generating a rehearsal script according to the backup table creation statement and the backup table operation statement, executing the rehearsal script and returning an execution result. The application can break through the test environment limitation, ensure the rehearsal test verification of the Hive script, improve the rehearsal test quality and improve the rehearsal test efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of testing technology, and in particular to a Hive script testing method, apparatus, electronic device, and storage medium. Background Technology

[0002] The testing execution of any project by the Basic Law R&D team consists of five testing phases: smoke test, SIT test, UAT test, regression test, and drill test. Among them, the drill test, as the last round of testing before production, is crucial for achieving the project quality benchmark of "preventing production accidents and ensuring smooth production," and is essential for ensuring high-quality production.

[0003] Replay testing refers to a new test environment not used during the SIT testing phase. Following the steps and instructions in the production deployment documentation, the HIVE / SQL scripts, system menus and parameter configurations, server deployment, and other operations required for pre-production deployment are repeated. This is equivalent to performing a simulated production deployment in the test environment the day before production. High-quality replay testing requires a separate test environment independent of the SIT testing environment. Otherwise, the replay process may be disrupted, and it may be impossible to determine whether problems are caused by environmental factors or inaccurate steps and instructions in the production deployment documentation. This makes it impossible to guarantee 100% quality of the replay test, and failures or production incidents are highly likely to occur during production. A second production deployment is considered a "high" severity production issue.

[0004] The drill tests must be conducted in a separate test environment—the UAT test environment—that is independent of the SIT test environment. However, since Hive scripts can only be tested on the big data platform, and the big data platform only has one test environment (already used in the SIT testing phase), drill tests cannot be performed on Hive scripts, which may lead to production accidents and production problems. Summary of the Invention

[0005] In view of this, the embodiments of this application provide a Hive script testing method, apparatus, electronic device and storage medium, which can overcome the limitations of the testing environment, ensure the exercise testing and verification of Hive scripts, improve the exercise testing quality and increase the exercise testing efficiency.

[0006] The technical solution of this application embodiment is implemented as follows:

[0007] In a first aspect, embodiments of this application provide a Hive script testing method, comprising the following steps:

[0008] Obtain the target Hive script, wherein the target Hive script includes at least one Hive statement;

[0009] The target Hive script is parsed to obtain at least one Hive statement in the target Hive script;

[0010] Perform keyword retrieval on the at least one Hive statement to obtain at least one table keyword and at least one table operation keyword corresponding to each table keyword, wherein the table keyword is used to indicate the selection of the target table, and the corresponding table operation keyword indicates the operation on the target table;

[0011] Based on the table keywords, a backup table creation statement corresponding to the target table is generated, and a backup table operation statement for the backup table is generated according to the table operation keywords. The backup table creation statement is used to create a backup table, and the backup table operation statement is used to operate on the backup table.

[0012] Generate a drill script based on the backup table creation statement and the backup table operation statement;

[0013] Execute the exercise and return the execution result.

[0014] In one possible implementation, obtaining the target Hive script includes:

[0015] Create a retrieval script, wherein the retrieval script is used to retrieve the target Hive script from the target path;

[0016] In response to a submission operation for the target path, a target Hive script is obtained from the target path, wherein the target Hive script includes at least one Hive script;

[0017] Return and display the results obtained from the target path.

[0018] In one possible implementation, parsing the target Hive script to obtain the at least one Hive statement in the target Hive script includes:

[0019] The target Hive script is opened using at least one preset encoding format;

[0020] Read at least one Hive statement from the opened target Hive script;

[0021] Return the at least one Hive statement.

[0022] In one possible implementation, the step of performing keyword retrieval on the at least one Hive statement to obtain at least one table keyword and at least one table operation keyword corresponding to each table keyword includes:

[0023] Create keyword search statements;

[0024] The keyword search statement is used to perform keyword search on the at least one Hive statement. If there are table keywords and at least one table operation keywords corresponding to each table keyword in the at least one Hive statement, the at least one table keyword and at least one table operation keywords corresponding to each table keyword are extracted.

[0025] In one possible implementation, the step of generating a backup table creation statement corresponding to the target table based on the table keywords, and generating a backup table operation statement for the backup table based on the table operation keywords, includes:

[0026] The backup table creation statement is obtained by concatenating the first string with the table keyword using a preset first string concatenation function; and...

[0027] The backup table operation statement is obtained by concatenating the table operation keywords with a preset second string concatenation function.

[0028] In one possible implementation, generating the exercise script based on the backup table creation statement and the backup table operation statement includes:

[0029] In response to the write operation of the backup table creation statement and the backup table operation statement, the backup table creation statement and the backup table operation statement are written to the target script, and a prompt message is displayed when the write operation is error-free, and an alarm message is displayed when the write operation is error-free.

[0030] In one possible implementation, the method further includes:

[0031] After the exercise is executed and the execution result is returned, the backup table is deleted;

[0032] Return and display the deletion results.

[0033] Secondly, embodiments of this application also provide a Hive script testing device, the device comprising:

[0034] The acquisition module is used to acquire a target Hive script, wherein the target Hive script includes at least one Hive statement;

[0035] The parsing module is used to parse the target Hive script to obtain at least one Hive statement in the target Hive script;

[0036] The retrieval module is used to perform keyword retrieval on the at least one Hive statement, and obtain at least one table keyword and at least one table operation keyword corresponding to each table keyword in the at least one Hive statement, wherein the table keyword is used to indicate the selection of the target table, and the corresponding table operation keyword indicates the operation on the target table;

[0037] The first generation module is used to generate a backup table creation statement corresponding to the target table based on the table keywords, and to generate a backup table operation statement for the backup table based on the table operation keywords, wherein the backup table creation statement is used to create a backup table, and the backup table operation statement is used to operate on the backup table.

[0038] The second generation module is used to generate a drill script based on the backup table creation statement and the backup table operation statement;

[0039] The execution module is used to execute the exercise and return the execution result.

[0040] Thirdly, embodiments of this application also provide an electronic device, including: a processor, a storage medium, and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the Hive script testing method described in any of the first aspects.

[0041] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the Hive script testing method described in any one of the first aspects.

[0042] The embodiments of this application have the following beneficial effects:

[0043] By acquiring the target Hive script and parsing it to obtain at least one Hive statement, and then performing keyword retrieval on the at least one Hive statement to obtain at least one table keyword and at least one table operation keyword corresponding to each table keyword, a backup table creation statement corresponding to the target table is generated based on the table keywords. A backup table operation statement is then generated based on the table operation keywords. Finally, a drill script is generated based on the backup table creation statement and the backup table operation statements. The drill script is then executed and the execution result is returned. This ensures that the execution of the Hive script is based on the newly created backup table, thus bypassing the production environment and overcoming the limitations of the testing environment. This ensures the drill testing and verification of the Hive script, improves the quality of drill testing, and enhances the efficiency of drill testing. Attached Figure Description

[0044] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0045] Figure 1 This is a flowchart illustrating steps S101-S106 provided in the embodiments of this application;

[0046] Figure 2 This is a flowchart illustrating steps S201-S203 provided in the embodiments of this application;

[0047] Figure 3 This is a flowchart illustrating steps S301-S303 provided in the embodiments of this application;

[0048] Figure 4 This is a schematic diagram of the structure of the Hive script testing device provided in the embodiments of this application;

[0049] Figure 5 This is a schematic diagram of the composition structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0050] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the accompanying drawings in this application are for illustrative and descriptive purposes only and are not intended to limit the scope of protection of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.

[0051] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0052] Furthermore, the described embodiments are merely some, not all, of the embodiments of this application. The components of the embodiments of this application described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0053] In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.

[0054] It should be noted that the term "comprising" will be used in the embodiments of this application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.

[0055] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application and is not intended to limit this application.

[0056] See Figure 1 , Figure 1This is a flowchart illustrating steps S101-S106 of the Hive script testing method provided in this application embodiment, which will be combined with... Figure 1 Steps S101-S106 shown will be explained.

[0057] Step S101: Obtain the target Hive script, wherein the target Hive script includes at least one Hive statement;

[0058] Step S102: Parse the target Hive script to obtain at least one Hive statement in the target Hive script;

[0059] Step S103: Perform keyword retrieval on the at least one Hive statement to obtain at least one table keyword and at least one table operation keyword corresponding to each table keyword in the at least one Hive statement, wherein the table keyword is used to indicate the selection of the target table, and the corresponding table operation keyword indicates the operation on the target table;

[0060] Step S104: Based on the table keywords, generate a backup table creation statement corresponding to the target table, and generate a backup table operation statement for the backup table according to the table operation keywords. The backup table creation statement is used to create a backup table, and the backup table operation statement is used to operate on the backup table.

[0061] Step S105: Generate a drill script based on the backup table creation statement and the backup table operation statement;

[0062] Step S106: Execute the exercise and return the execution result.

[0063] The above-described Hive script testing method involves acquiring a target Hive script, parsing it to obtain at least one Hive statement, performing keyword retrieval on the statement to obtain at least one table keyword and at least one corresponding table operation keyword, generating a backup table creation statement based on the table keyword, and generating backup table operation statements based on the table operation keywords. A test script is then generated based on the backup table creation and operation statements, and finally executed, returning the execution result. This ensures that the Hive script execution is based on the newly created backup table, thus bypassing the production environment and overcoming testing environment limitations, ensuring Hive script test verification, improving test quality, and increasing test efficiency.

[0064] The exemplary steps described above in the embodiments of this application will be explained below.

[0065] In step S101, a target Hive script is obtained, wherein the target Hive script includes at least one Hive statement;

[0066] In step S102, the target Hive script is parsed to obtain at least one Hive statement in the target Hive script;

[0067] In step S103, keyword retrieval is performed on the at least one Hive statement to obtain at least one table keyword and at least one table operation keyword corresponding to each table keyword. The table keyword is used to indicate the selection of the target table, and the corresponding table operation keyword indicates the operation on the target table.

[0068] In step S104, based on the table keywords, a backup table creation statement corresponding to the target table is generated, and a backup table operation statement for the backup table is generated according to the table operation keywords. The backup table creation statement is used to create a backup table, and the backup table operation statement is used to operate on the backup table.

[0069] In step S105, a drill script is generated based on the backup table creation statement and the backup table operation statement;

[0070] In step S106, the exercise script is executed and the execution result is returned.

[0071] In some embodiments, see Figure 2 , Figure 2 This is a flowchart illustrating steps S201-S203 provided in the embodiments of this application. The acquisition of the target Hive script can be achieved through steps S201-S203, which will be explained in conjunction with each step.

[0072] In step S201, a retrieval script is created, wherein the retrieval script is used to retrieve the target Hive script from the target path.

[0073] In step S202, in response to a submission operation for the target path, a target Hive script is obtained from the target path, wherein the target Hive script includes at least one Hive script.

[0074] In step S203, the results obtained from the target path are returned and displayed.

[0075] Here, you can input the target path and then obtain the target Hive script under the target path. It should be noted that there can be one or more target Hive scripts, and they can be processed in batches.

[0076] In some embodiments, see Figure 3 , Figure 3 This is a flowchart illustrating steps S301-S303 provided in the embodiments of this application. The step of parsing the target Hive script to obtain at least one Hive statement in the target Hive script can be achieved through steps S301-S303, which will be explained in conjunction with each step.

[0077] In step S301, the target Hive script is opened using at least one preset encoding format.

[0078] In step S302, at least one Hive statement in the opened target Hive script is read.

[0079] In step S303, the at least one Hive statement is returned.

[0080] In some embodiments, the step of performing keyword retrieval on the at least one Hive statement to obtain at least one table keyword and at least one table operation keyword corresponding to each table keyword includes:

[0081] Create keyword search statements;

[0082] The keyword search statement is used to perform keyword search on the at least one Hive statement. If there are table keywords and at least one table operation keywords corresponding to each table keyword in the at least one Hive statement, the at least one table keyword and at least one table operation keywords corresponding to each table keyword are extracted.

[0083] Here, we obtain keywords such as "create" or "add" (table operation keywords) for creating a new table or adding a field to an existing table, as well as the table name after "create table" (table keyword), and then extract these words or sentences.

[0084] In some embodiments, generating a backup table creation statement corresponding to the target table based on the table keywords, and generating a backup table operation statement for the backup table based on the table operation keywords, includes:

[0085] The backup table creation statement is obtained by concatenating the first string with the table keyword using a preset first string concatenation function; and...

[0086] The backup table operation statement is obtained by concatenating the table operation keywords with a preset second string concatenation function.

[0087] Here, string concatenation is used to construct complete operation statements for the backup table. When adding, deleting, modifying, or querying data in the backup table using these operation statements, it is equivalent to performing the same operations on the same data as the original table.

[0088] In some embodiments, generating the exercise script based on the backup table creation statement and the backup table operation statement includes:

[0089] In response to the write operation of the backup table creation statement and the backup table operation statement, the backup table creation statement and the backup table operation statement are written to the target script, and a prompt message is displayed when the write operation is error-free, and an alarm message is displayed when the write operation is error-free.

[0090] In some embodiments, the method further includes:

[0091] After the exercise is executed and the execution result is returned, the backup table is deleted;

[0092] Return and display the deletion results.

[0093] In summary, the embodiments of this application have the following beneficial effects:

[0094] By acquiring the target Hive script and parsing it to obtain at least one Hive statement, and then performing keyword retrieval on the at least one Hive statement to obtain at least one table keyword and at least one table operation keyword corresponding to each table keyword, a backup table creation statement corresponding to the target table is generated based on the table keywords. A backup table operation statement is then generated based on the table operation keywords. Finally, a drill script is generated based on the backup table creation statement and the backup table operation statements. The drill script is then executed and the execution result is returned. This ensures that the execution of the Hive script is based on the newly created backup table, thus bypassing the production environment and overcoming the limitations of the testing environment. This ensures the drill testing and verification of the Hive script, improves the quality of drill testing, and enhances the efficiency of drill testing.

[0095] Based on the same inventive concept, this application also provides a Hive script testing device corresponding to the Hive script testing method in the first embodiment. Since the principle of the device in this application is similar to the above-mentioned Hive script testing method, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.

[0096] like Figure 4 As shown, Figure 4 This is a schematic diagram of the structure of the Hive script testing device 400 provided in this application embodiment. The Hive script testing device 400 includes:

[0097] The acquisition module 401 is used to acquire a target Hive script, wherein the target Hive script includes at least one Hive statement;

[0098] Parsing module 402 is used to parse the target Hive script to obtain at least one Hive statement in the target Hive script;

[0099] The retrieval module 403 is used to perform keyword retrieval on the at least one Hive statement, and obtain at least one table keyword and at least one table operation keyword corresponding to each table keyword in the at least one Hive statement, wherein the table keyword is used to indicate the selection of the target table, and the corresponding table operation keyword indicates the operation on the target table;

[0100] The first generation module 404 is used to generate a backup table creation statement corresponding to the target table based on the table keywords, and to generate a backup table operation statement for the backup table based on the table operation keywords, wherein the backup table creation statement is used to create a backup table, and the backup table operation statement is used to operate on the backup table.

[0101] The second generation module 405 is used to generate a drill script based on the backup table creation statement and the backup table operation statement;

[0102] The execution module 406 is used to execute the exercise and return the execution result.

[0103] Those skilled in the art should understand that Figure 4 The functionality of each unit in the Hive script testing device 400 shown can be understood by referring to the relevant description of the aforementioned Hive script testing method. Figure 4 The functions of each unit in the Hive script testing device 400 shown can be implemented by a program running on the processor or by specific logic circuits.

[0104] In one possible implementation, the acquisition module 401 acquires the target Hive script, including:

[0105] Create a retrieval script, wherein the retrieval script is used to retrieve the target Hive script from the target path;

[0106] In response to a submission operation for the target path, a target Hive script is obtained from the target path, wherein the target Hive script includes at least one Hive script;

[0107] Return and display the results obtained from the target path.

[0108] In one possible implementation, the parsing module 402 parses the target Hive script to obtain the at least one Hive statement in the target Hive script, including:

[0109] The target Hive script is opened using at least one preset encoding format;

[0110] Read at least one Hive statement from the opened target Hive script;

[0111] Return the at least one Hive statement.

[0112] In one possible implementation, the retrieval module 403 performs keyword retrieval on the at least one Hive statement to obtain at least one table keyword and at least one table operation keyword corresponding to each table keyword, including:

[0113] Create keyword search statements;

[0114] The keyword search statement is used to perform keyword search on the at least one Hive statement. If there are table keywords and at least one table operation keywords corresponding to each table keyword in the at least one Hive statement, the at least one table keyword and at least one table operation keywords corresponding to each table keyword are extracted.

[0115] In one possible implementation, the first generation module 404 generates a backup table creation statement corresponding to the target table based on the table keywords, and generates a backup table operation statement for the backup table based on the table operation keywords, including:

[0116] The backup table creation statement is obtained by concatenating the first string with the table keyword using a preset first string concatenation function; and...

[0117] The backup table operation statement is obtained by concatenating the table operation keywords with a preset second string concatenation function.

[0118] In one possible implementation, the second generation module 405 generates a drill script based on the backup table creation statement and the backup table operation statement, including:

[0119] In response to the write operation of the backup table creation statement and the backup table operation statement, the backup table creation statement and the backup table operation statement are written to the target script, and a prompt message is displayed when the write operation is error-free, and an alarm message is displayed when the write operation is error-free.

[0120] In one possible implementation, the execution module 406 further includes:

[0121] After the exercise is executed and the execution result is returned, the backup table is deleted;

[0122] Return and display the deletion results.

[0123] The aforementioned Hive script testing device acquires a target Hive script, parses it to obtain at least one Hive statement, performs keyword retrieval on the statement to obtain at least one table keyword and at least one corresponding table operation keyword, generates a backup table creation statement for the target table based on the table keywords, and generates backup table operation statements for the backup table based on the table operation keywords. Finally, a test script is generated based on the backup table creation and operation statements, and the test script is executed and the execution result is returned. This ensures that the Hive script is executed based on the newly created backup table, thus bypassing the production environment and overcoming testing environment limitations, ensuring the test verification of the Hive script, improving test quality, and increasing test efficiency.

[0124] like Figure 5 As shown, Figure 5 This is a schematic diagram of the composition structure of the electronic device 500 provided in the embodiments of this application. The electronic device 500 includes:

[0125] The device 500 includes a processor 501, a storage medium 502, and a bus 503. The storage medium 502 stores machine-readable instructions that can be executed by the processor 501. When the electronic device 500 is running, the processor 501 communicates with the storage medium 502 via the bus 503. The processor 501 executes the machine-readable instructions to perform the steps of the Hive script testing method described in the embodiments of this application.

[0126] In practical applications, the various components in the electronic device 500 are coupled together via a bus 503. It is understood that the bus 503 is used to achieve communication between these components. In addition to a data bus, the bus 503 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 5The general designated all buses as Bus 503.

[0127] The aforementioned electronic device acquires a target Hive script, parses and processes it to obtain at least one Hive statement. It then performs keyword retrieval on the at least one Hive statement to obtain at least one table keyword and at least one corresponding table operation keyword. Based on the table keywords, it generates a backup table creation statement corresponding to the target table and a backup table operation statement for the backup table based on the table operation keywords. Finally, it generates a drill script based on the backup table creation and operation statements and executes the drill script, returning the execution result. This ensures that the Hive script execution is based on the newly created backup table, thus bypassing the production environment and overcoming testing environment limitations. This guarantees the drill testing and verification of the Hive script, improves the quality and efficiency of drill testing.

[0128] This application also provides a computer-readable storage medium storing executable instructions, which, when executed by at least one processor 501, implement the Hive script testing method described in this application.

[0129] In some embodiments, the storage medium may be a magnetic random access memory (FRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM), etc.; or it may be a device that includes one or any combination of the above-mentioned memories.

[0130] In some embodiments, executable instructions may take the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a standalone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.

[0131] As an example, executable instructions may, but do not necessarily, correspond to files in the file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple collaborating files (e.g., a file that stores one or more modules, subroutines, or code sections).

[0132] As an example, executable instructions can be deployed to execute on a single computing device, or on multiple computing devices located in one location, or on multiple computing devices distributed across multiple locations and interconnected via a communication network.

[0133] The aforementioned computer-readable storage medium acquires a target Hive script, parses and processes the target Hive script to obtain at least one Hive statement in the target Hive script, then performs keyword retrieval on the at least one Hive statement to obtain at least one table keyword and at least one table operation keyword corresponding to each table keyword, then generates a backup table creation statement corresponding to the target table based on the table keywords, and generates backup table operation statements for the backup table based on the table operation keywords, then generates a drill script based on the backup table creation statement and the backup table operation statements, and finally executes the drill script and returns the execution result. This ensures that the execution of the Hive script is based on the newly created backup table, thus bypassing the production environment and overcoming the limitations of the test environment, ensuring the drill test verification of the Hive script, improving the drill test quality, and increasing the drill test efficiency.

[0134] In the several embodiments provided in this application, it should be understood that the disclosed methods and electronic devices can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components may be combined, or integrated into another system, or some features may be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0135] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0136] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0137] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a platform server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.

[0138] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A Hive script testing method, characterized in that, Includes the following steps: Obtain the target Hive script, wherein the target Hive script includes at least one Hive statement; The target Hive script is parsed to obtain at least one Hive statement in the target Hive script; Perform keyword retrieval on the at least one Hive statement to obtain at least one table keyword and at least one table operation keyword corresponding to each table keyword, wherein the table keyword is used to indicate the selection of the target table, and the corresponding table operation keyword indicates the operation on the target table; Based on the table keywords, a backup table creation statement corresponding to the target table is generated, and a backup table operation statement for the backup table is generated according to the table operation keywords. The backup table creation statement is used to create a backup table, and the backup table operation statement is used to operate on the backup table. Generate a drill script based on the backup table creation statement and the backup table operation statement; Execute the exercise script and return the execution result.

2. The method according to claim 1, characterized in that, The process of obtaining the target Hive script includes: Create a retrieval script, wherein the retrieval script is used to retrieve the target Hive script from the target path; In response to a submission operation for the target path, a target Hive script is obtained from the target path, wherein the target Hive script includes at least one Hive script; Return and display the results obtained from the target path.

3. The method according to claim 1, characterized in that, The step of parsing the target Hive script to obtain at least one Hive statement in the target Hive script includes: The target Hive script is opened using at least one preset encoding format; Read at least one Hive statement from the opened target Hive script; Return the at least one Hive statement.

4. The method according to claim 1, characterized in that, The step of performing keyword retrieval on the at least one Hive statement to obtain at least one table keyword and at least one table operation keyword corresponding to each table keyword includes: Create keyword search statements; The keyword search statement is used to perform keyword search on the at least one Hive statement. If there are table keywords and at least one table operation keywords corresponding to each table keyword in the at least one Hive statement, the at least one table keyword and at least one table operation keywords corresponding to each table keyword are extracted.

5. The method according to claim 1, characterized in that, The step of generating a backup table creation statement corresponding to the target table based on the table keywords, and generating a backup table operation statement for the backup table based on the table operation keywords, includes: The backup table creation statement is obtained by concatenating the first string with the table keyword using a preset first string concatenation function; and... The backup table operation statement is obtained by concatenating the table operation keywords with a preset second string concatenation function.

6. The method according to claim 1, characterized in that, The step of generating a drill script based on the backup table creation statement and the backup table operation statement includes: In response to the write operation of the backup table creation statement and the backup table operation statement, the backup table creation statement and the backup table operation statement are written to the target script, and a prompt message is displayed when the write operation is error-free, and an alarm message is displayed when the write operation is error-free.

7. The method according to claim 1, characterized in that, The method further includes: After the exercise script is executed and the execution result is returned, the backup table is deleted; Return and display the deletion results.

8. A Hive script testing device, characterized in that, The device includes: The acquisition module is used to acquire a target Hive script, wherein the target Hive script includes at least one Hive statement; The parsing module is used to parse the target Hive script to obtain at least one Hive statement in the target Hive script; The retrieval module is used to perform keyword retrieval on the at least one Hive statement, and obtain at least one table keyword and at least one table operation keyword corresponding to each table keyword in the at least one Hive statement, wherein the table keyword is used to indicate the selection of the target table, and the corresponding table operation keyword indicates the operation on the target table; The first generation module is used to generate a backup table creation statement corresponding to the target table based on the table keywords, and to generate a backup table operation statement for the backup table based on the table operation keywords, wherein the backup table creation statement is used to create a backup table, and the backup table operation statement is used to operate on the backup table. The second generation module is used to generate a drill script based on the backup table creation statement and the backup table operation statement; The execution module is used to execute the exercise script and return the execution result.

9. An electronic device, characterized in that, include: The device includes a processor, a storage medium, and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the Hive script testing method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the Hive script testing method as described in any one of claims 1 to 7.