Column-to-row function correctness testing method, system and product based on stored procedure

By defining a stored procedure in the database, the correctness of the column-to-row function is automatically checked, which solves the problem of manual inspection in the existing technology being time-consuming and not adaptable to differences in different databases, and realizing an efficient and universal column-to-row function testing method, which is suitable for Various database types.

CN118445308BActive Publication Date: 2024-10-08JIANGSU HUAKU DATA TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410902765.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-08
Publication Date
2024-10-08
Estimated Expiration
2044-07-08

AI Technical Summary

Technical Problem

It is difficult to test the correctness of the column-to-row function in a comprehensive, effective and labor-saving manner with the existing technology. Especially when the query result set is large or there are many test cases, manual inspection is impractical, and the differences in data type processing methods of different database vendors lead to universal testing. Difficult to achieve.

Method used

By defining stored procedures in the database, the functions of the column-to-row function are implemented, including string splicing, delimiter processing, data grouping and sorting, and query result set output. Stored procedures are used to check the correctness of the column-to-row function result set, including obtaining column to row functions. Function parameters, grouped data, join results, and compare stored procedure query results with column-to-row function query results.

Benefits of technology

It implements automated column-to-row function correctness testing, saves labor costs, is suitable for various database types, improves testing efficiency and query speed, and ensures the accuracy of test results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118445308B_ABST
    Figure CN118445308B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of database processing technology, and discloses a column-to-row function correctness test method, system and product based on stored procedures, the method comprising: obtaining a column-to-row function query statement and a column-to-row function query result, extracting a column-to-row function parameter, an aggregate column and a table name from the column-to-row function query statement; obtaining a table to be queried by the column-to-row function query statement according to the table name; grouping the data in the table according to the aggregate column to obtain a grouping result; querying the grouping result according to the column-to-row function parameter, connecting the query result to obtain a group connection result; summarizing all group connection results to obtain a stored procedure query result; comparing the stored procedure query result with the column-to-row function query result to obtain the correctness of the column-to-row function. The present invention implements the function of the column-to-row function with the help of a stored procedure in a database, and checks the correctness of the column-to-row function result set by calling the stored procedure in the database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of database processing, and in particular to a method, system and product for testing the correctness of a column-to-row function based on a stored procedure. Background Art

[0002] The column-to-row function is a string concatenation function. It sorts the data of the specified column in the same group by the specified field and concatenates them into a string using the specified separator. The function syntax is as follows:

[0003] group_concat([distinct] expr [order by XXX ][topN XXX][separator 'XXX']);

[0004] Among them, distinct is the deduplication keyword, which removes duplicate values ​​in the columns of the same group; expr is the column to be connected; order by means that the values ​​of the columns in the same group will be sorted in the order of the sorting columns; topN is the maximum number of output columns in the same group; separator is the separator for connecting fields.

[0005] Currently, the correctness test of the column-to-row function generally adopts two methods: manually checking the correctness of the result set or comparing the correctness with the help of well-known industry databases.

[0006] The first method is time-consuming and wastes manpower costs. When the query result set is large or there are many test cases, manual inspection is impractical.

[0007] The second method is not applicable to all test scenarios because different database vendors have product differences in data types and the way they handle different data contents. For example, the maximum length of the varchar type in Oracle is 4000, while the maximum length of varchar in some databases can reach 10922. Using Oracle for comparison cannot perform boundary testing on varchar. Another example: some databases support the creation of table names and column names containing Chinese or special symbols, but well-known database vendors in the industry do not support this enough and cannot test databases containing Chinese or special symbols.

[0008] Therefore, a comprehensive, effective and labor-saving column-to-row function correctness testing method is needed. Summary of the invention

[0009] The present invention aims to solve the problem that it is difficult to test the correctness of the column-to-row function in a comprehensive, effective and labor-saving manner. To this end, the present invention provides a method, system and product for testing the correctness of the column-to-row function based on a stored procedure, which implements the function of the column-to-row function with the help of a stored procedure in a database, including string concatenation, delimiter processing, data grouping and sorting, and query result set output, and checks the correctness of the result set of the column-to-row function by calling the stored procedure in the database.

[0010] The present invention provides a method for testing the correctness of a column-to-row function based on a stored procedure, and the technical solution adopted is as follows:

[0011] Obtain a column-to-row function query statement and a column-to-row function query result, and extract column-to-row function parameters, aggregate columns, and table names from the column-to-row function query statement;

[0012] Obtaining the table to be queried by the column-to-row function query statement according to the table name;

[0013] Grouping the data in the table according to the clustering column to obtain a grouping result; querying the grouping result according to the column-to-row function parameter, and connecting the query results to obtain a group connection result;

[0014] Summarize all the group connection results to obtain the stored procedure query result;

[0015] Compare the query result of the stored procedure with the query result of the column-to-row function to obtain the correctness of the column-to-row function.

[0016] Furthermore, the parameters of the column-to-row function include a deduplication keyword, columns to be connected, sorting columns, the number of connection strings, and separators.

[0017] Further, the data in the table is grouped according to the clustering column to obtain a grouping result; the grouping result is queried according to the column-to-row function parameter, and the query result is connected to obtain the group connection result in the following process:

[0018] An outer cursor is defined, the outer cursor is used to receive the elements aggregated in the group, the elements are the values ​​of the columns to be connected in the table; a loop A and a variable list are defined in the outer cursor, the number of loop A is the number of groups, the number of groups is the number of values ​​of the aggregated column, and the variable list is used to store the value of the aggregated column of the current group;

[0019] An inner cursor is defined, and the inner cursor is used to receive the connection result of the elements aggregated in a single group; a loop B is defined in the inner cursor, and the number of loops B is the number of the connection strings; a query statement and a connection function are defined in the loop B, and the query statement is formed by splicing the deduplication keyword, the column to be connected, the sorting column, the aggregation column, the table name and the variable list;

[0020] Execute the outer cursor to obtain a grouping result; execute the inner cursor, use the query statement to sequentially take out elements one by one from the grouping result, use the connection function to connect the elements, and use the separator to separate the elements to obtain a group connection result.

[0021] Furthermore, loop A of the outer cursor is executed once to obtain a grouping result, and then the inner cursor is executed to obtain a group connection result.

[0022] Furthermore, the query results are connected using the concat_ws function.

[0023] Furthermore, the grouping result includes the value of the aggregation column and its corresponding values ​​of all the columns to be connected.

[0024] Furthermore, if the stored procedure query result is the same as the column-to-row function query result, the column-to-row function functions correctly; if the stored procedure query result is different from the column-to-row function query result, the column-to-row function functions incorrectly.

[0025] The present invention also provides a column-to-row function correctness test system based on a stored procedure, and the technical scheme adopted is as follows: comprising: a data acquisition module, a stored procedure module and a result comparison module, wherein the data acquisition module is connected to the stored procedure module and the result comparison module respectively, and the stored procedure module is connected to the result comparison module.

[0026] The data acquisition module is used to obtain a column-to-row function query statement and a column-to-row function query result, extract column-to-row function parameters, aggregate columns and table names from the column-to-row function query statement; and obtain the table to be queried by the column-to-row function query statement according to the table name;

[0027] The stored procedure module is used to group the data in the table according to the clustering column to obtain a grouping result; query the grouping result according to the column-to-row function parameter, connect the query results to obtain a group connection result; and aggregate all the group connection results to obtain a stored procedure query result;

[0028] The result comparison module is used to compare the stored procedure query result and the column-to-row function query result, and obtain and display the correctness of the column-to-row function.

[0029] The present invention also provides a computer program product, including a computer program, which implements the above-mentioned column-to-row function correctness testing method based on stored procedures when executed by a processor.

[0030] The above one or more technical solutions in the embodiments of the present invention have at least one of the following technical effects:

[0031] 1. The stored procedure of the present invention defines an outer cursor, and through a loop, obtains the values ​​of all the columns to be connected corresponding to the value of each of the aggregated columns. It also defines an inner cursor, and through a loop, in conjunction with a query statement and a concat_ws function, the values ​​of the columns to be connected are sequentially taken out, connected, and separated by delimiters, thereby realizing the functions of string concatenation, delimiter processing, and data grouping and sorting.

[0032] 2. The present invention designs a stored procedure with a column-to-row function, which realizes that the data of a specified column in the same group is sorted according to a specified field, connected into a string with a specified separator, and outputs the result. By comparing the execution result of the stored procedure with the query result of the column-to-row function, the correctness of the column-to-row function function is checked.

[0033] 3. The present invention saves labor costs. When the query result set is large or there are many test cases, the stored procedure is used to execute the test cases in batches, and the running results are used as the expected query results of the column-to-row function to compare the correctness. This avoids manual inspection of the correctness of the test results, frees up manpower, and can effectively improve work efficiency.

[0034] 4. The present invention is implemented based on the stored procedure in the database. The input parameters and variables defined in the stored procedure are suitable for various types of databases, with a comprehensive adaptability and fast query speed.

[0035] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0037] Figure 1 It is a flow chart of the method provided by the present invention.

[0038] Figure 2 It is a flow chart of the execution of the stored procedure provided by the present invention.

[0039] Figure 3 It is a structural block diagram of the system provided by the present invention.

[0040] Reference numerals:

[0041] 1. Data acquisition module; 2. Storage process module; 3. Result comparison module. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical scheme and advantages of the present invention clearer, the technical scheme of the present invention will be clearly and completely described below in conjunction with the drawings in the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present invention. The following embodiments are used to illustrate the present invention, but cannot be used to limit the scope of the present invention.

[0043] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiment of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0044] Combine the following Figure 1-Figure 3 The present invention is further described in detail, and a method, system and product for testing the correctness of a column-to-row function based on a stored procedure are described as follows:

[0045] In this embodiment, Figure 1 As shown, a method for testing the correctness of a column-to-row function based on a stored procedure is provided, comprising the following steps:

[0046] Step 1: Obtain a column-to-row function query statement and a column-to-row function query result. Extract column-to-row function parameters, aggregation columns, and table names from the column-to-row function query statement. The column-to-row function parameters include deduplication keywords, columns to be connected, sorting columns, the number of connection strings, and separators.

[0047] This method designs a stored procedure with the function of converting columns to rows. Seven input parameters and variables are defined in the stored procedure, namely, the deduplication keyword, the column to be connected, the sorting column, the number of connection strings, the separator, the aggregation column and the table name. Among them, the first five variables are consistent with the parameters required by the column-to-row function.

[0048] The stored procedure is implemented in the database, so the input parameters and variables defined in the stored procedure can support all database data types. For example, the column to be connected can be defined as varchar, and the maximum length supports 10922. The table names and column names involved in the stored procedure runtime all support Chinese and special characters.

[0049] Step 2: Obtain the table to be queried by the column-to-row function query statement according to the table name. The subsequent steps require operations on the data in the table.

[0050] Step 3: Group the data in the table according to the clustering column to obtain the grouping result; query the grouping result according to the column-to-row function parameter, connect the query results to obtain the group connection result; summarize all the group connection results to obtain the stored procedure query result. Figure 2 As shown, the specific process is:

[0051] Step 3.1: Create a temporary table with only one column, which is used to store the group connection results.

[0052] Step 3.2: Define an outer cursor, which is used to receive the elements aggregated in the group, where the elements are the values ​​of the columns to be connected in the table. Define loop A and variable list in the outer cursor. The number of loops A is the number of groups, which is the number of values ​​of the aggregated column. The variable list is used to store the value of the aggregated column of the current group.

[0053] An inner cursor is defined, and the inner cursor is used to receive the connection result of the elements aggregated in a single group. A loop B is defined in the inner cursor, and the number of loops of the loop B is the number of the connection string. A dynamic SQL and a connection function are defined in the loop B, and the dynamic SQL is a query statement formed by splicing the deduplication keyword, the column to be connected, the sorting column, the aggregation column, the table name and the variable list. The connection function uses the concat_ws function.

[0054] Step 3.3: Execute the outer cursor, and each time loop A in the outer cursor is executed once, a grouping result is obtained, and the grouping result includes the value of the aggregation column and the corresponding values ​​of all the columns to be connected. After loop A is executed once, go to step 3.4.

[0055] Step 3.4: Execute the inner cursor, use the query statement to sequentially extract elements from the grouping result, and then use the concat_ws(separator,str1,str2,...) function to connect the extracted elements, where separator is the separator obtained in step 1, and str1,str2,... are the elements sequentially extracted from the grouping result. Each time loop B is looped once, an element is added to the connection result. When loop B is completed, the group connection result is obtained. Then the group connection result is stored in a temporary table.

[0056] Step 3.5: Determine whether all groups have been processed, that is, determine whether the loop A is completed. If not, go to step 3.3; if completed, get the stored procedure query result. The temporary table summarizes all the group connection results, that is, the content in the temporary table is the stored procedure query result.

[0057] Step 4: Compare the query result of the stored procedure with the query result of the column-to-row function to obtain the correctness of the column-to-row function. If the query result of the stored procedure is the same as the query result of the column-to-row function, the function of the column-to-row function is correct; if the query result of the stored procedure is different from the query result of the column-to-row function, the function of the column-to-row function is incorrect. Display the comparison results. When the function of the column-to-row function is incorrect, manual intervention is required to analyze the cause of the incorrectness.

[0058] The following example illustrates the stored procedure execution process.

[0059] A table in a database that records the status of membership cards. Query the status of membership cards under the name of a person:

[0060] Data in table t:

[0061] gbase>select * from t;

[0062] +------+------+

[0063] | name | card|

[0064] +------+------+

[0065] | ben| 001|

[0066] | lily | 002|

[0067] | ben| 003|

[0068] | lily | 004|

[0069] | tina | 005|

[0070] +------+------+

[0071] 5 rows in set (Elapsed: 00:00:00.01).

[0072] Use the column-to-row function to query, and the query results of the column-to-row function are as follows:

[0073] gbase>select group_concat(distinct cardorder by card topN 3 separator',') as aa from t group by name;

[0074] +------------------+

[0075] | aa|

[0076] +------------------+

[0077] | 001,003|

[0078] | 002,004|

[0079] | 005|

[0080] +------+----------+

[0081] 3 rows in set (Elapsed: 00:00:00.02).

[0082] This method is used to verify the accuracy of the above column-to-row function, including the following steps:

[0083] Step 1: Get group_concat(distinct cardorder by card topN 3 separator',') as aa from t group by name. And the query results of the above column-to-row function.

[0084] The following results are extracted: keyword for deduplication: distinct, column to be connected: card, sorting column: card, number of connection strings: 3, separator: "," , aggregation column: name, table name: t.

[0085] Step 2: Get the data in table t.

[0086] Step 3: Generate stored procedure query results. The specific process is as follows:

[0087] Step 3.1: Create a temporary table t_tmp with only one column.

[0088] Step 3.2: Define the outer cursor and inner cursor.

[0089] Step 3.3: Execute the outer cursor, the cluster column is name, according to the cluster column, the data in the table is divided into 3 groups, then the number of loops of loop A is 3. The value of the cluster column of the first group is ben, that is, the value of the variable list corresponding to the first group cluster column is ben, and the grouping result is:

[0090] Group value: ben; element value within the group: 001,003.

[0091] Similarly, the values ​​of the variable list corresponding to the other two grouping and aggregation columns are lily and tina respectively. The grouping results are:

[0092] Group value: lily; element value within the group: 002,004.

[0093] Group value: tina; element value within the group: 005.

[0094] Each time the loop A is executed, a grouping result is obtained and step 3.4 is entered once.

[0095] Step 3.4: Execute the inner cursor. For the first grouping result, the inner cursor loops twice, taking out elements 001 and 003 respectively. The aggregation result of the concat_ws function is "001, 003", which is stored in the temporary table t_tmp. The example is as follows:

[0096] gbase>select concat_ws(',','001','003') as aa from t;

[0097] +------------------+

[0098] | aa|

[0099] +------------------+

[0100] |001,003|

[0101] +------------------+

[0102] 1 rows in set (Elapsed: 00:00:00.08).

[0103] Step 3.5: Determine whether all groups have been processed. The loop of step 3.3-step 3.4 is executed three times, all groups are processed, and the outer cursor is exited. There are three groups in the example. The result after the second group is processed is "002, 004", and the result after the third group is processed is "005".

[0104] Query the data in the temporary table t_tmp and get the stored procedure query results. The results are as follows:

[0105] gbase>select column1 from t_tmp;

[0106] +------------------+

[0107] | column1|

[0108] +------------------+

[0109] |001,003|

[0110] |002,004|

[0111] |005|

[0112] +------------------+.

[0113] Step 4: Compare the query result of the temporary table t_tmp with the query result of the column-to-row function. The contents of the two are exactly the same, indicating that the column-to-row function works correctly.

[0114] The comparison process can be implemented using the diff command that comes with Linux. When there are many use cases, you can also use automated scripts for batch execution. If the comparison results are consistent, the use case is executed successfully and the next use case is executed; if the comparison results are inconsistent, analyze the reasons for the inconsistency. After the comparison is completed, delete the temporary table t_tmp to avoid affecting the execution result of the next stored procedure call.

[0115] In this embodiment, Figure 3 As shown, a column-to-row function correctness test system based on stored procedures is also provided, and the technical solution adopted is as follows: it includes: a data acquisition module 1, a stored procedure module 2 and a result comparison module 3, the data acquisition module 1 is connected to the stored procedure module 2 and the result comparison module 3 respectively, and the stored procedure module 2 is connected to the result comparison module 3.

[0116] The data acquisition module 1 is used to obtain a column-to-row function query statement and a column-to-row function query result, extract column-to-row function parameters, aggregate columns and table name from the column-to-row function query statement; and obtain the table to be queried by the column-to-row function query statement according to the table name.

[0117] The stored procedure module 2 is used to group the data in the table according to the clustering column to obtain a grouping result; query the grouping result according to the column-to-row function parameter, connect the query results to obtain a group connection result; and aggregate all the group connection results to obtain a stored procedure query result.

[0118] The result comparison module 3 is used to compare the stored procedure query result and the column-to-row function query result, and obtain and display the correctness of the column-to-row function.

[0119] The working process of this system is:

[0120] The data acquisition module 1 obtains the column-to-row function query statement and the column-to-row function query result. Then, the column-to-row function parameters, the aggregated columns and the table name are extracted from the column-to-row function query statement; and the table to be queried by the column-to-row function query statement is obtained according to the table name. The column-to-row function parameters include deduplication keywords, columns to be connected, sorting columns, the number of connection strings and separators. Finally, the row conversion function parameters, aggregated columns, table names and tables are sent to the stored procedure module 2; and the column-to-row function query result is sent to the result comparison module 3.

[0121] The stored procedure module 2 first creates a temporary table with only one column, and the temporary table is used to store the group connection results.

[0122] Then, define an outer cursor, which is used to receive the elements aggregated in the group, and the elements are the values ​​of the columns to be connected in the table. Define loop A and variable list in the outer cursor. The number of loops A is the number of groups, and the number of groups is the number of values ​​of the aggregated column. The variable list is used to store the value of the aggregated column of the current group. Define an inner cursor, which is used to receive the connection result of the elements aggregated in a single group. Define loop B in the inner cursor, and the number of loops of loop B is the number of connection strings. Define dynamic sql and connection function in loop B, and the dynamic sql is a query statement formed by splicing the deduplication keyword, the column to be connected, the sorting column, the aggregated column, the table name and the variable list. The connection function uses the concat_ws function.

[0123] Then, the outer cursor is executed. Each time loop A in the outer cursor is executed, a grouping result is obtained, and the grouping result includes the value of the cluster column and the corresponding values ​​of all the columns to be connected. After loop A is executed once, the inner cursor is executed, and the elements are sequentially taken out one by one from the grouping result using the query statement, and then the taken out elements are connected using the concat_ws(separator,str1,str2,...) function, where separator is the separator obtained in step 1, and str1,str2,... are the elements sequentially taken out one by one from the grouping result. Each time loop B is looped once, an element is appended to the connection result. When loop B is completed, the group connection result is obtained. Then the group connection result is stored in a temporary table.

[0124] Finally, it is determined whether all groups have been processed, that is, whether loop A is completed. If not, loop A is continued to be executed; if completed, the stored procedure query result is obtained. The temporary table summarizes all the group connection results, that is, the content in the temporary table is the stored procedure query result. The stored procedure module 2 sends the stored procedure query result to the result comparison module 3.

[0125] The result comparison module 3 compares the stored procedure query result and the column-to-row function query result. If the stored procedure query result is the same as the column-to-row function query result, the column-to-row function function is correct; if the stored procedure query result is different from the column-to-row function query result, the column-to-row function function is incorrect. The comparison result is displayed.

[0126] This embodiment also provides a computer program product, including a computer program, which, when executed by a processor, implements the above-mentioned column-to-row function correctness testing method based on stored procedures.

[0127] The present invention uses a stored procedure in a database to achieve: 1. string concatenation of input fields according to a specified separator; 2. data deduplication, processing of clustered columns and sorted columns; 3. processing of the number of connected strings; 4. display of query results. The present invention obtains the stored procedure query result by calling the stored procedure in the database, and uses the stored procedure query result to check the correctness of the column-to-row function query result. The present invention is particularly suitable for use in databases with frequent queries and huge query volumes.

[0128] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. Correctness test method of column-to-row function based on stored procedure, It is characterized in that include: Obtain a column-to-row function query statement and a column-to-row function query result, and extract column-to-row function parameters, aggregation columns, and table names from the column-to-row function query statement; the column-to-row function parameters include a deduplication keyword, a column to be connected, a sorting column, the number of connection strings, and a separator; Obtaining the table to be queried by the column-to-row function query statement according to the table name; Grouping the data in the table according to the clustering column to obtain a grouping result; According to the column-to-row function parameter, query the grouping result, connect the query results, and obtain the group connection result; Grouping the data in the table according to the clustering column to obtain a grouping result; According to the column-to-row function parameter, the grouping result is queried, and the query result is connected to obtain the group connection result in the following process: An outer cursor is defined, the outer cursor is used to receive the elements aggregated in the group, the elements are the values ​​of the columns to be connected in the table; a loop A and a variable list are defined in the outer cursor, the number of loop A is the number of groups, the number of groups is the number of values ​​of the aggregated column, and the variable list is used to store the value of the aggregated column of the current group; An inner cursor is defined, wherein the inner cursor is used to receive a connection result of elements aggregated in a single group; Define loop B in the inner cursor, and the number of loops B is the number of the connection strings; A query statement and a connection function are defined in the loop B, wherein the query statement is formed by splicing the deduplication keyword, the column to be connected, the sorting column, the aggregation column, the table name and the variable list; Execute the outer cursor to obtain a grouping result; execute the inner cursor, use the query statement to sequentially extract elements from the grouping result one by one, use the connection function to connect the elements, and use the separator to separate the elements to obtain a group connection result; The loop A of the outer cursor is executed once to obtain the grouping result, and then the inner cursor is executed to obtain the group connection result; Connect the query results using the concat_ws function; The grouping result includes the value of the aggregation column and the corresponding values ​​of all the columns to be connected; Summarize all the group connection results to obtain the stored procedure query result; Compare the query result of the stored procedure with the query result of the column-to-row function to obtain the correctness of the column-to-row function.

2. The method for testing the correctness of a column-to-row function based on a stored procedure as claimed in claim 1, It is characterized in that If the query result of the stored procedure is the same as the query result of the column-to-row function, the function of the column-to-row function is correct; If the query result of the stored procedure is different from the query result of the column-to-row function, the function of the column-to-row function is incorrect.

3. Column-to-row function correctness test system based on stored procedure, It is characterized in that The method for testing the correctness of a column-to-row function based on a stored procedure as claimed in any one of claims 1 to 2 comprises: a data acquisition module, a stored procedure module and a result comparison module, wherein the data acquisition module is connected to the stored procedure module and the result comparison module respectively, and the stored procedure module is connected to the result comparison module. The data acquisition module is used to obtain a column-to-row function query statement and a column-to-row function query result, extract column-to-row function parameters, aggregation columns and table names from the column-to-row function query statement; obtain the table to be queried by the column-to-row function query statement according to the table name; the column-to-row function parameters include a deduplication keyword, a column to be connected, a sorting column, the number of connection strings and a separator; The stored procedure module is used to group the data in the table according to the clustering column to obtain a grouping result; query the grouping result according to the column-to-row function parameter, connect the query results to obtain a group connection result; and aggregate all the group connection results to obtain a stored procedure query result; The data in the table are grouped according to the clustering column to obtain a grouping result; the grouping result is queried according to the column-to-row function parameter, and the query result is connected to obtain the group connection result. The process is as follows: An outer cursor is defined, the outer cursor is used to receive the elements aggregated in the group, the elements are the values ​​of the columns to be connected in the table; a loop A and a variable list are defined in the outer cursor, the number of loop A is the number of groups, the number of groups is the number of values ​​of the aggregated column, and the variable list is used to store the value of the aggregated column of the current group; An inner cursor is defined, and the inner cursor is used to receive the connection result of the elements aggregated in a single group; a loop B is defined in the inner cursor, and the number of loops B is the number of the connection strings; a query statement and a connection function are defined in the loop B, and the query statement is formed by splicing the deduplication keyword, the column to be connected, the sorting column, the aggregation column, the table name and the variable list; Execute the outer cursor to obtain a grouping result; execute the inner cursor, use the query statement to sequentially extract elements from the grouping result one by one, use the connection function to connect the elements, and use the separator to separate the elements to obtain a group connection result; The loop A of the outer cursor is executed once to obtain the grouping result, and then the inner cursor is executed to obtain the group connection result; Connect the query results using the concat_ws function; The grouping result includes the value of the aggregation column and the corresponding values ​​of all the columns to be connected; The result comparison module is used to compare the stored procedure query result and the column-to-row function query result, and obtain and display the correctness of the column-to-row function.

4. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the method for testing the correctness of a column-to-row function based on a stored procedure according to any one of claims 1 to 2 is implemented.