A method, device and apparatus for determining data comparison results

By building a data comparison table and group aggregation technology, the problem of low full table scanning efficiency in the master-slave database copy data consistency check is solved, efficient comparison and detailed difference analysis are achieved, and data comparison efficiency and visual display capabilities are improved. .

CN112115148BActive Publication Date: 2024-09-10CHINA CONSTRUCTION BANK
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202011043631.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-28
Publication Date
2024-09-10
Estimated Expiration
2040-09-28

AI Technical Summary

Technical Problem

When checking the data consistency of master-slave database copies, the existing technology requires a full table scan, which is inefficient, especially when comparing a large amount of data, resulting in low efficiency and high analysis costs.

Method used

By building a data comparison table, loading main table and secondary table data, setting initial values ​​for comparison fields, grouping and updating comparison fields, determining comparison results based on comparison field values ​​and preset relationships, avoiding full table scans, Improve comparison efficiency.

Benefits of technology

It achieves fast and efficient filtering of missing or redundant records in copy data, records differences where the primary key is the same but other fields are inconsistent, improves comparison efficiency, reduces analysis costs, and provides detailed visual display of difference information and backtracking analysis capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112115148B
    Figure CN112115148B
Patent Text Reader

Abstract

The present specification provides a method, device and equipment for determining data comparison results. The method includes loading the data in the main table and the sub-table into the data comparison table respectively; the table structure of the data comparison table includes the main table field and the comparison field; the initial value of the comparison field corresponding to the row with the same data in the main table field in the data comparison table is updated to the first value to obtain the first data comparison table; based on the primary key field included in the main table field, the rows in the first data comparison table whose comparison field is not the first value are grouped; according to the number of rows included in each group, the initial value of the comparison field of each row in the group is updated to obtain the second data comparison table; according to the preset relationship between the comparison field value and the comparison result, the comparison result corresponding to each row of data in the second data comparison table is determined. The embodiments of the present specification can avoid full table scanning and improve comparison efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing, and in particular to a method, device and apparatus for determining data comparison results. Background Art

[0002] In modern distributed systems, to improve data loading efficiency and protect data integrity, a master-slave storage strategy is often used. This involves creating multiple copies of data, forming a storage architecture with a master and multiple replicas. As changes are made to the master, the replicas synchronize their changes with the master to maintain consistency. However, during data synchronization, network transmission or synchronization anomalies can cause discrepancies between the master and replica data. Therefore, verifying the consistency of the master and replica data and analyzing any discrepancies is crucial for improving data loading efficiency and protecting data integrity.

[0003] In the prior art, when master and replica data are stored in relational databases, consistency between the master and replica data is primarily checked using difference analysis tools. For example, in Oracle relational databases, this is typically done using the minus function. However, this approach requires a full table scan followed by row-by-row analysis, making it inefficient when comparing large amounts of data.

[0004] Therefore, the industry is in urgent need of a technical solution that can solve the above problems. Summary of the Invention

[0005] The embodiments of this specification provide a method, apparatus, and device for determining data comparison results, which can avoid full table scanning and improve comparison efficiency.

[0006] The method, device and apparatus for determining data comparison results provided in this specification are implemented in the following ways.

[0007] A method for determining data comparison results, comprising: loading data from a main table and a sub-table into a data comparison table respectively; the table structure of the data comparison table includes a main table field and a comparison field; wherein, during the loading process, setting an initial value for the comparison field; updating the initial value of the comparison field corresponding to rows in the data comparison table having the same data as the main table field to a first value, thereby obtaining a first data comparison table; based on a primary key field included in the main table field, grouping rows in the first data comparison table whose comparison fields are not the first value; updating the initial value of the comparison field for each row in the group according to the number of rows included in each group, thereby obtaining a second data comparison table; and determining the comparison result corresponding to each row of data in the second data comparison table according to a preset relationship between the comparison field value and the comparison result.

[0008] A device for determining data comparison results, comprising: a loading module, used to load data from a main table and a sub-table into a data comparison table respectively; the table structure of the data comparison table includes a main table field and a comparison field; wherein, during the loading process, an initial value is set for the comparison field; a first data comparison table acquisition module, used to update the initial value of the comparison field corresponding to the rows with the same data corresponding to the main table field in the data comparison table to a first value, thereby obtaining a first data comparison table; a grouping module, used to group the rows in the first data comparison table whose comparison fields are not the first value based on the primary key field included in the main table field; a second data comparison table acquisition module, used to update the initial value of the comparison field of each row in the group according to the number of rows included in each group, thereby obtaining a second data comparison table; a comparison result determination module, used to determine the comparison result corresponding to each row of data in the second data comparison table according to a preset relationship between the comparison field value and the comparison result.

[0009] A device for determining a data comparison result includes a processor and a memory for storing processor-executable instructions. When the processor executes the instructions, the steps of any method embodiment in the embodiments of this specification are implemented.

[0010] A computer-readable storage medium stores computer instructions, which, when executed, implement the steps of any method embodiment in the embodiments of this specification.

[0011] This specification provides a method, device and equipment for determining data comparison results. In some embodiments, by constructing a data table structure for performing data comparison, the master and copy data are written into the data comparison table, which can provide a basis for subsequent inspection of the master and copy data differences. By grouping and aggregating the two data records, not only can the data records with missing or redundant copy data, as well as the specific differences in records with the same primary key but inconsistent other fields, be quickly and efficiently filtered out from a large amount of data, the master and copy data comparison results can be obtained, thereby improving the efficiency of comparing large amounts of data, but also avoiding row-by-row analysis of full table scans and reducing analysis costs. By separately analyzing records with the same primary key but inconsistent other fields, extracting detailed information on the inconsistent fields, and visually displaying the master and copy data comparison results and inconsistent detailed information, not only can the master and copy data differences be intuitively understood, but also guarantees can be provided for subsequent backtracking and analysis of incomplete copy data based on detailed difference information. By adopting the implementation plan provided in this specification, full table scans can be avoided and comparison efficiency can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The accompanying drawings described herein are used to provide a further understanding of this specification, constitute a part of this specification, and do not constitute a limitation of this specification. In the accompanying drawings:

[0013] Figure 1 This is a flow chart of an embodiment of a method for determining data comparison results provided in this specification;

[0014] Figure 2 This is a flowchart of a specific embodiment of the method for determining data comparison results provided in this specification;

[0015] Figure 3 This is a schematic diagram of the module structure of an embodiment of a device for determining data comparison results provided in this specification;

[0016] Figure 4 This is a hardware structure block diagram of an embodiment of a server for determining data comparison results provided in this specification. DETAILED DESCRIPTION

[0017] To help those skilled in the art better understand the technical solutions in this specification, the following will provide a clear and complete description of the technical solutions in the embodiments of this specification, in conjunction with the accompanying drawings. Obviously, the described embodiments are only some of the embodiments in this specification, not all of them. All other embodiments obtained by those skilled in the art based on one or more embodiments in this specification without creative work should fall within the scope of protection of the embodiments of this specification.

[0018] The following describes the implementation plan of this specification using a specific application scenario as an example. Figure 1 The flowchart of one embodiment of a method for determining data comparison results provided in this specification is provided. Although this specification provides method operating steps or device structures as shown in the following embodiments or figures, the method or device may include more or fewer operating steps or module units based on routine or no creative effort.

[0019] An embodiment provided in this specification can be applied to a client, a server, etc. The client can include a terminal device, such as a smartphone, a tablet computer, etc. The server can include a single computer device, a server cluster consisting of multiple servers, or a server structure of a distributed system, etc.

[0020] It should be noted that the following embodiment description does not limit the technical solutions in other application scenarios that can be expanded based on this specification. Figure 1 As shown, in an embodiment of a method for determining data comparison results provided in this specification, the method may include the following steps.

[0021] S0: Load the data in the main table and the sub-table into the data comparison table respectively; the table structure of the data comparison table includes main table fields and comparison fields; wherein, during the loading process, initial values ​​are set for the comparison fields.

[0022] In distributed systems, to improve data loading efficiency and protect data integrity, data often uses a master-slave storage strategy. This involves creating multiple copies of data, forming a master copy. This storage architecture stores multiple copies of data in the database. The master copy can be understood as the data in the primary table, while the copies are the data in the secondary tables. Databases can include relational databases, such as Oracle and SQL Server. A relational database uses a relational model to organize data, storing data in rows and columns for easy understanding. These rows and columns are called tables, and a set of tables constitutes a database. Users retrieve data from the database through queries, which are executed code that restricts access to specific areas of the database. The relational model can be simply understood as a two-dimensional table model, and a relational database is a data organization consisting of two-dimensional tables and the relationships between them.

[0023] In some embodiments, the main table fields can be understood as all the fields included in the main table. The comparison field can be understood as an auxiliary field, and its corresponding value can be used to determine the comparison result corresponding to each row of data in the data comparison table. It can also be called a data difference calculation field. It should be noted that each row in the table is usually called a "record" and the column of the table is called a "field". Each record contains all the information in this row. The field set constitutes a record, and each field describes a certain feature of the document. For example, in the database, name and contact number are common attributes of all rows in the table. These columns can be called name field and contact number field.

[0024] In some embodiments, before loading data from the primary and secondary tables into the data comparison table, the following steps may be performed: obtaining the table structure of the primary table; the primary table structure includes primary table fields; and constructing the table structure of the data comparison table based on the primary table fields and auxiliary fields; the auxiliary fields include at least comparison fields. The table structure can be understood as consisting of basic attributes of a table, such as fields, types, primary keys, foreign keys, and indexes, and can also be referred to as a data structure.

[0025] In some implementation scenarios, auxiliary fields may also include data attribution fields, comparison result fields, batch identification fields, record logic identification fields, etc. Among them, the data attribution field can be used to identify the source of the data, for example, it can be identified as originating from the primary table (P) or the secondary table (C), etc. The comparison result field can be used to store the data comparison results, which can also be called the data difference type field. The batch identification field can be used to indicate the data comparison batch, for example, it can be the first batch (TASK_1), the second batch (TASK_2), etc. The record logic identification field can be used for subsequent association.

[0026] In some embodiments, before loading the data in the main table and the sub-table into the data comparison table, the process may further include: obtaining the table structure of the sub-table; determining whether the table structure of the main table is consistent with the table structure of the sub-table; and when the consistency is determined, loading the data in the main table and the sub-table into the data comparison table in sequence.

[0027] In some implementation scenarios, before loading data from the primary and secondary tables into the data comparison table, you can first check the data structure of the replica data to determine whether the table structure is completely consistent with the primary data. If it is inconsistent, the comparison process will be terminated. In some implementation scenarios, if the table structure of the replica data is completely consistent with the primary data, the data from the primary and secondary tables can be loaded into the data comparison table.

[0028] In some implementation scenarios, after constructing the table structure of the data comparison table, you can first load the data in the primary table into the data comparison table, and then obtain the table structure of the secondary table to determine whether the table structure of the primary table is consistent with the table structure of the secondary table. If they are consistent, then load the data in the secondary table into the data comparison table.

[0029] In some implementation scenarios, determining whether the table structures are consistent may include determining whether the number of fields in the primary and secondary tables is consistent, determining whether the field names and field types in the primary and secondary tables are consistent, determining whether the primary key fields in the primary and secondary tables are consistent, etc.

[0030] In some implementation scenarios, in the process of loading data into the data comparison table, initial values ​​can be assigned to the auxiliary fields. For example, in some implementation scenarios, in the process of loading data into the data comparison table, the data attribution field in the main table can be assigned an initial value of P, the data attribution field in the sub-table can be assigned an initial value of C, the comparison field in the main table can be assigned an initial value of 1, the comparison field in the sub-table can be assigned an initial value of -1, the batch identification field in both the main and sub-tables can be assigned an initial value of TASK_1, and the record logical identification field can be assigned a random value, such as the record logical identification field in the row with the primary key A in the main table can be assigned P_A_ID, the record logical identification field in the row with the primary key B in the main table can be assigned P_B_ID, the record logical identification field in the row with the primary key A in the sub-table can be assigned C_A_ID, the record logical identification field in the row with the primary key B in the sub-table can be assigned C_B_ID, etc. Among them, P indicates that the data comes from the main data, and C indicates that the data comes from the copy data. It can be understood that, usually, the batch identification fields of the main and sub-tables to be compared are the same. Of course, the above is only an exemplary description, and the initial value of the auxiliary field can also be adjusted according to the actual scenario.

[0031] In the embodiment of this specification, by loading the data in the primary table and the secondary table into the data comparison table, a basis can be provided for subsequent rapid checking of whether the primary and secondary data are consistent.

[0032] S2: updating the initial value of the comparison field corresponding to the row with the same data as the main table field in the data comparison table to a first value, to obtain a first data comparison table.

[0033] In the embodiment of this specification, after the data in the main table and the sub-table are loaded into the data comparison table, the initial value of the corresponding comparison field can be updated based on the corresponding data of the main table field in the data comparison table to obtain a first data comparison table.

[0034] In some embodiments, updating the initial value of the comparison field corresponding to the row with the same data corresponding to the main table field in the data comparison table to the first value to obtain the first data comparison table may include: dividing the data in the data comparison table into different groups according to the main table field; determining whether the data corresponding to the main table field in each group is the same; and updating the initial value of the comparison field corresponding to the row with the same data corresponding to the main table field to the first value to obtain the first data comparison table.

[0035] In some implementation scenarios, the data in the data comparison table can be divided into different groups using the GROUP BY method in relational data based on the main table fields. Among them, the GROUP BY statement can be used in combination with aggregate functions to group the result set according to one or more columns. Of course, the above is only an exemplary explanation, and the method of dividing the data in the data comparison table is not limited to the above examples. Technicians in the relevant field may make other changes based on the inspiration of the technical essence of this application, but as long as the functions and effects achieved are the same or similar to those of this application, they should be covered within the scope of protection of this application.

[0036] In some implementation scenarios, a data comparison table may include data from a primary table and data from one or more secondary tables. This way, after the data in the data comparison table is divided into groups based on the primary table fields, each group includes at least one record. For groups containing multiple records, it is further determined whether the corresponding data in the primary table fields is identical. Identical data in the primary table fields within each group indicates that the records in the primary and secondary tables are completely identical.

[0037] In some implementation scenarios, when the data corresponding to the main table fields in each group are the same, the initial value of the comparison field corresponding to the row with the same data corresponding to the main table fields is updated to the first value by summing the values ​​corresponding to the comparison fields in each group after grouping, and using the sum result as the first data value.

[0038] For example, in some implementation scenarios, when a data comparison table includes a main table data and a sub-table data, after the data in the data comparison table is divided into different groups according to the main table fields, each group includes at most two records. At this time, for a group including two records, the values ​​corresponding to the comparison fields in the two records can be summed, and the sum result can be used as the first data value after the initial values ​​of the comparison fields of the two records are updated. For example, a group includes one record each from the main table and the sub-table, wherein the initial value of the comparison field in the main table is 1, and the initial value of the comparison field in the sub-table is -1. At this time, the values ​​corresponding to the comparison fields in the two records can be summed, that is, 1 and -1 can be summed, and the obtained 0 can be used as the first data value to update the data comparison table to obtain the first data comparison table. It should be noted that the above is only an exemplary description and does not constitute a limitation on other embodiments of this specification.

[0039] In some implementation scenarios, when the data corresponding to the primary table field in each group is the same, the initial value of the comparison field corresponding to the row with the same data in the primary table field can be updated to a first value by using a preset value as the first value. For example, in some implementation scenarios, it can be preset that when the data corresponding to the primary table field in each group is the same, the initial value of the comparison field corresponding to the row with the same data in the primary table field can be updated to a first value. The first value can be 0, 1, etc., and the first value can be used to determine the comparison result.

[0040] In some implementation scenarios, after updating the initial value of the comparison field corresponding to the rows with identical data in the master table fields to the first value, the values ​​corresponding to the batch identification field, the record logic identification field, and the comparison field can be recorded in the data comparison process calculation table. Furthermore, based on the value of the record logic identification field, the value of the comparison field can be associated and updated in the data comparison table to obtain a first data comparison table. The record logic identification field is used to associate the same data in the data comparison process calculation table and the data comparison table.

[0041] S4: Based on the primary key field included in the main table field, the rows in the first data comparison table whose comparison fields are not the first value are grouped.

[0042] In an embodiment of the present specification, after obtaining the first data comparison table, the rows in the comparison field of the first data comparison table that are not the first numerical value can be grouped based on the primary key field included in the main table field. The primary key field is a field for storing a primary keyword, and the primary key (primary key) is one or more fields in a table, and its value can be used to uniquely identify a record in the table. In the relationship between two tables, the primary keyword can be used to reference a specific record from another table in one table. The primary keyword is a unique keyword, part of the table definition. The primary key of a table can be composed of multiple keywords, and the column of the primary keyword cannot contain null values.

[0043] In some embodiments, after obtaining the first data comparison table, the rows whose comparison fields are not the first numerical value can be filtered out from the first data comparison table, and then the filtered rows can be grouped according to the primary key field. For example, in some implementation scenarios, GROUP BY KEY can be used to group the filtered rows. Wherein, KEY represents the primary keyword. Of course, the above is only an exemplary explanation, and the way of dividing the data in the data comparison table is not limited to the above examples. Technicians in the relevant field may make other changes under the inspiration of the technical essence of this application, but as long as the functions and effects achieved are the same or similar to those of this application, they should be covered within the scope of protection of this application.

[0044] S6: According to the number of rows included in each group, update the initial value of the comparison field of each row in the group to obtain a second data comparison table.

[0045] In an embodiment of the present specification, after the rows in the first data comparison table whose comparison fields are not the first numerical value are grouped based on the primary key field included in the main table field, the initial value of the comparison field in each row in the group can be updated according to the number of rows included in each group to obtain a second data comparison table.

[0046] In some embodiments, updating the initial value of the comparison field in each row in each group based on the number of rows included in the group to obtain the second data comparison table may include: when the number of rows included in the group is 2, updating the initial value of the comparison field in each row in the group to a second value; and when the number of rows included in the group is 1, updating the initial value of the comparison field in each row in the group to a third value. The number of rows may be used to distinguish between records with consistent primary keys and records with inconsistent primary keys.

[0047] In some implementation scenarios, a data comparison table may include data from a primary table and data from one or more secondary tables. Thus, after grouping rows in the first data comparison table whose comparison fields do not have the first value based on the primary key field included in the primary table field, each group includes at least one record, i.e., one row of data. It will be appreciated that the inclusion of multiple records in a group may indicate that the records included in the group have consistent primary keys, i.e., the primary keys in the primary and secondary tables are consistent. The inclusion of one record in a group may indicate that the records included in the group have inconsistent primary keys, i.e., the primary keys in the primary and secondary tables are inconsistent.

[0048] In some implementation scenarios, when the number of rows included in a group is greater than or equal to 2, the initial value of the comparison field in each row in the group can be updated to a second value. In some implementation scenarios, when the number of rows included in a group is 1, the initial value of the comparison field in each row in the group can be updated to a third value. The second and third values ​​can be used to determine the comparison result. The second and third values ​​can be set according to actual scenarios and are not limited in this specification.

[0049] In some implementation scenarios, the relationship between the number of rows and the numerical value can be preset. For example, it can be preset that when the number of rows is greater than or equal to 2, the corresponding updated numerical value is 2, and when the number of rows is 1, the corresponding updated numerical value is 1, etc. In this way, after determining the number of rows, the updated numerical value of the comparison field can be quickly determined, thereby improving processing efficiency. Of course, the above is only an exemplary description, and the method of setting the relationship between the number of rows and the numerical value is not limited to the above example. Technicians in the relevant field may make other changes based on the inspiration of the technical essence of this application, but as long as the functions and effects achieved are the same or similar to those of this application, they should be included in the scope of protection of this application.

[0050] In some implementation scenarios, after updating the initial value of the comparison field in each row of the group, the values ​​corresponding to the batch identification field, the record logic identification field, and the comparison field can be recorded in the data comparison process calculation table. Furthermore, based on the value of the record logic identification field, the value of the comparison field can be associated and updated in the first data comparison table to obtain a second data comparison table. The record logic identification field is used to associate the same data in the data comparison process calculation table and the data comparison table.

[0051] S8: Determine the comparison result corresponding to each row of data in the second data comparison table according to a preset relationship between the comparison field value and the comparison result.

[0052] In the embodiment of the present specification, after obtaining the second data comparison table, the comparison result corresponding to each row of data in the second data comparison table can be determined according to a preset relationship between the comparison field value and the comparison result.

[0053] In some implementation scenarios, the relationship between the comparison field value and the comparison result can be preset, and then the value corresponding to the comparison field in each row of data in the second data comparison table is compared to determine the corresponding comparison result. Among them, the comparison field value can include a first value, a second value, a third value, etc. The comparison result may include consistent data in the main and secondary tables, consistent data corresponding to the primary key fields in the main and secondary tables, missing data in the secondary table, redundant data in the secondary table, etc. In some implementation scenarios, the preset relationship between the comparison field value and the comparison result may include that when the comparison field value is the first value, the comparison result is consistent data in the main and secondary tables; when the comparison field value is the second value, the comparison result is consistent data corresponding to the primary key fields in the main and secondary tables, and inconsistent data corresponding to the non-primary key fields; when the comparison field value is the third value, the comparison result is missing data in the secondary table or redundant data in the secondary table. In some implementation scenarios, the comparison field value can be associated with the comparison result and stored in the database, so that it can be directly obtained from it when needed, thereby improving processing efficiency.

[0054] In some embodiments, determining the comparison result corresponding to each row of data in the second data comparison table based on a preset relationship between the comparison field value and the comparison result may include: when the comparison field value is a first value, determining that the comparison result is consistent with the data in the primary and secondary tables; when the comparison field value is a second value, determining that the comparison result is consistent with the data corresponding to the primary key fields in the primary and secondary tables, and inconsistent with the data corresponding to the non-primary key fields; when the comparison field value is a third value, determining that the comparison result is missing data in the secondary table or redundant data in the secondary table.

[0055] In some embodiments, the table structure of the data comparison table may further include a data attribution field. Thus, when the comparison field value is a third numerical value, the comparison result may be determined to be missing data from the secondary table or redundant data from the secondary table based on the data attribution field. In some implementation scenarios, when the value corresponding to the data attribution field indicates that the data originates from the main table data, the comparison result may be determined to be missing data from the secondary table based on the data attribution field. In other implementation scenarios, when the value corresponding to the data attribution field indicates that the data originates from the secondary table data, the comparison result may be determined to be redundant data from the secondary table based on the data attribution field.

[0056] In some embodiments, when it is determined that the comparison results show that the data corresponding to the primary key fields in the primary and secondary tables are consistent, and the data corresponding to the non-primary key fields are inconsistent, it can include: comparing the data corresponding to the non-primary key fields one by one to obtain inconsistent non-primary key field information; the inconsistent non-primary key field information includes the non-primary key field name, the data corresponding to the non-primary key field name in the primary table, and the data corresponding to the non-primary key field name in the secondary table; and recording the inconsistent non-primary key field information in a difference record table. The difference record table can also be called an inconsistent field record table, which can be used to record inconsistent information in the primary and secondary tables. The difference record table can include primary key fields, inconsistent non-primary key fields, data fields corresponding to inconsistent non-primary key fields in the primary table, data fields corresponding to inconsistent non-primary key fields in the secondary table, batch identification fields, etc.

[0057] In some embodiments, the table structure of the data comparison table further includes a comparison result field, so that after determining the comparison result corresponding to each row of data in the second data comparison table, the comparison result can be stored in the second data comparison table. The second data comparison table can also be displayed.

[0058] In some embodiments, when the comparison result shows that the data corresponding to the primary key fields in the primary and secondary tables are consistent, and the data corresponding to the non-primary key fields are inconsistent, displaying the second data comparison table may include: obtaining inconsistent non-primary key field information from the difference record table, and then displaying the inconsistent non-primary key field information.

[0059] In some embodiments, the table structure of the data comparison table may further include a batch identification field, so that the comparison results of different batches can be displayed according to the batch identification field, thereby intuitively understanding the comparison results of different batches.

[0060] Of course, the above is only an exemplary description, and the embodiments of this specification are not limited to the above examples. Technical personnel in the relevant field may make other changes based on the technical essence of this application. However, as long as the functions and effects achieved are the same or similar to those of this application, they should be included in the scope of protection of this application.

[0061] The above method is described below with reference to a specific embodiment. However, it should be noted that this specific embodiment is only for better illustrating the present application and does not constitute an improper limitation to the present application. Figure 2 As shown, Figure 2 1 is a flow chart of a specific embodiment of the method for determining data comparison results provided in this specification. In this specific embodiment, the following steps may be included.

[0062] S201: Constructing a data comparison table and auxiliary table.

[0063] In this embodiment, the data comparison table and auxiliary table can be used to calculate and record the data comparison process and result data. The auxiliary table can include a data comparison process calculation table and an inconsistent field recording table. The data comparison process calculation table includes a batch identification field, a record logic identification field, and a data difference calculation field. The inconsistent field recording table includes a batch identification field, a data primary key field (KEY), an inconsistent field name field (COL_NAME), a primary data value field (VAL_A), and a duplicate data value field (VAL_B).

[0064] In this embodiment, three tables can be constructed: a data comparison table, a data comparison process calculation table, and an inconsistent field record table. The data comparison table, based on the structure of the master and copy data tables, can add a data attribution field (SOURCE), a data difference type field (TYPE), a data difference calculation field (CAL), a batch identification field (BATCH), and a record logic identification field (ID).

[0065] In this embodiment, the master-copy data table structure includes a primary key (KEY), value 1 (VAL_1), and value 2 (VAL_2). The master-copy data table structure is shown in Table 1, the data comparison table structure is shown in Table 2, the data comparison process calculation table structure is shown in Table 3, and the inconsistent field record table structure is shown in Table 4.

[0066] Table 1

[0067] KEY VAL_1 VAL_2

[0068] Table 2

[0069] KEY VAL_1 VAL_2 SOURCE TYPE CAL BATCH ID

[0070] Table 3

[0071] BATCH ID CAL

[0072] Table 4

[0073] BATCH KEY COL_NAME VAL_A VAL_B

[0074] S202: Insert the master data into the data comparison table, and add field values ​​to the master table.

[0075] In this example, the master copy data is inserted into the data comparison table, and values ​​are assigned to the added fields. Specifically, a batch identifier is created to record the comparison process. The data attribution field is assigned the value P, indicating that it originates from the master copy data. The data difference calculation field is assigned a value of +1, and the record logic identifier field is assigned a unique random value. Specifically, the master copy data is shown in Table 5. The results of inserting the master copy data into the data comparison table and assigning values ​​to the added fields are shown in Table 6.

[0076] Table 5

[0077] KEY VAL_1 VAL_2 A VAL_A|1 VAL_A|2 B VAL_B|1 VAL_B|2 C VAL_C|1 VAL_C|2

[0078] Table 6

[0079] KEY VAL_1 VAL_2 SOURCE TYPE CAL BATCH ID A VAL_A|1 VAL_A|2 P 1 TASK_1 P_A_ID B VAL_B|1 VAL_B|2 P 1 TASK_1 P_B_ID C VAL_C|1 VAL_C|2 P 1 TASK_1 P_C_ID

[0080] S203: Insert the copy data into the data comparison table, and add fields and assign values ​​to the secondary table.

[0081] In this embodiment, before inserting the replica data into the data comparison table, the table structure of the replica data is first checked to determine whether the secondary table data structure is completely consistent with the primary data table structure. If not, the comparison process is terminated. If the table structures are consistent, the replica data is inserted into the data comparison table, and the attribution field is assigned a value of C, the identifier is derived from the replica data, the data difference calculation field is assigned a value of -1, the record logic identification field is assigned a unique random value, and the batch identification field value is consistent with the primary data. Specifically, the replica data is shown in Table 7. The result after inserting the replica data into the data comparison table and assigning values ​​to the added fields is shown in Table 8.

[0082] Table 7

[0083] KEY VAL_1 VAL_2 A VAL_A|1 VAL_A|2 B VAL_B|1 VAL_B|3 D VAL_D|1 VAL_D|2

[0084] Table 8

[0085] KEY VAL_1 VAL_2 SOURCE TYPE CAL BATCH ID A VAL_A|1 VAL_A|2 C -1 TASK_1 C_A_ID B VAL_B|1 VAL_B|3 C -1 TASK_1 C_B_ID D VAL_D|1 VAL_D|2 C -1 TASK_1 C_D_ID

[0086] S204: Group the data in the data comparison table according to all fields of the master data to obtain a first data comparison table.

[0087] In this embodiment, after grouping the data in the data comparison table according to all fields of the master and copy data, the difference fields of the grouped data can be summed, and then the summation result can be recorded in the data comparison process calculation table, and then the summation result can be updated to the data comparison table.

[0088] Specifically, the data in the data comparison table can be grouped using GROUP BY KEY, VAL1, and VAL2 in the relational database. The grouping results are shown in Table 9.

[0089] In this embodiment, after obtaining the grouping results, the CAL field of the grouped records can be summed. The summed CAL field, BATCH field, and ID field are then inserted into the data comparison process calculation table to obtain the results shown in Table 10. For rows where the master and replica records are completely identical, the CAL field sum is 0. For inconsistent data record fields, the sum is the original value: +1 for the master data record and -1 for the replica data record.

[0090] Furthermore, the value of the data difference field can be associated and updated to the data comparison table according to the value of the ID field to obtain a first data comparison table, as shown in Table 11. The same data in the data comparison table and the data comparison process calculation table is associated through the ID field.

[0091] Table 9

[0092] KEY VAL_1 VAL_2 SOURCE TYPE CAL BATCH ID A VAL_A|1 VAL_A|2 P 1 TASK_1 P_A_ID A VAL_A|1 VAL_A|2 C -1 TASK_1 C_A_ID B VAL_B|1 VAL_B|2 P 1 TASK_1 P_B_ID C VAL_C|1 VAL_C|2 P -1 TASK_1 P_C_ID B VAL_B|1 VAL_B|3 C 1 TASK_1 C_B_ID D VAL_D|1 VAL_D|2 C -1 TASK_1 C_D_ID

[0093] Table 10

[0094] BATCH ID CAL TASK_1 P_A_ID 0 TASK_1 C_A_ID 0 TASK_1 P_B_ID 1 TASK_1 P_C_ID 1 TASK_1 C_B_ID -1 TASK_1 C_D_ID -1

[0095] Table 11

[0096] KEY VAL_1 VAL_2 SOURCE TYPE CAL BATCH ID A VAL_A|1 VAL_A|2 P 0 TASK_1 P_A_ID A VAL_A|1 VAL_A|2 C 0 TASK_1 C_A_ID B VAL_B|1 VAL_B|2 P 1 TASK_1 P_B_ID C VAL_C|1 VAL_C|2 P 1 TASK_1 P_C_ID B VAL_B|1 VAL_B|3 C -1 TASK_1 C_B_ID D VAL_D|1 VAL_D|2 C -1 TASK_1 C_D_ID

[0097] S205: Group the inconsistent data in the first data comparison table according to the primary key field of the master data to obtain a second data comparison table.

[0098] In this embodiment, after the inconsistent data in the first data comparison table are grouped according to the primary key field of the master data, the number of rows included in each group can be counted, and then the row number result can be recorded as the corresponding data difference field value in the data comparison process calculation table, and then the row number result can be updated to the first data comparison table.

[0099] Specifically, GROUP BY KEY can be used to group inconsistent data in the first data comparison table. The grouping result is shown in Table 12.

[0100] Table 12

[0101] KEY VAL_1 VAL_2 SOURCE TYPE CAL BATCH ID A VAL_A|1 VAL_A|2 P 0 TASK_1 P_A_ID A VAL_A|1 VAL_A|2 C 0 TASK_1 C_A_ID B VAL_B|1 VAL_B|2 P 1 TASK_1 P_B_ID B VAL_B|1 VAL_B|3 C 1 TASK_1 C_B_ID C VAL_C|1 VAL_C|2 P -1 TASK_1 P_C_ID D VAL_D1 VAL_D2 C -1 TASK_1 C_D_ID

[0102] Table 13

[0103] BATCH ID CAL TASK_1 P_B_ID 2 TASK_1 0]C_B_ID 2 TASK_1 P_C_ID 1 TASK_1 C_D_ID 1

[0104] Table 14

[0105] KEY VAL_1 VAL_2 SOURCE TYPE CAL BATCH ID A VAL_A1 - P 0 VAL_A2 TASK_1 A [[ID=C26]]P_A_ID VAL_A1 C 0 VAL_AZ TASK_1 B C_A_ID VAL_B1 P 2 VAL_B2 TASK_1 B P_B_ID VAL_B1 C 2 VAL_B3 TASK_1 C C_B_ID VAL_C1 P 1 VAL_C2 ' D [[ID=A1]]TASK_1 P_C_ID C 1 VAL_D1 VAL_D2

[0106] In this embodiment, after obtaining the grouping results, the number of rows included in each group can be counted, and the row count result can be used as the corresponding CAL field value. The CAL field, BATCH field, and ID field are then inserted into the data comparison process calculation table to obtain the results shown in Table 13. The row count result is 2 for rows with completely consistent primary keys in the master and replica, and 1 for rows with inconsistent primary keys.

[0107] Furthermore, the value of the data difference field can be updated into the first data comparison table to obtain a second data comparison table, as shown in Table 14.

[0108] S206: Determine the data difference type corresponding to each row of data in the second data comparison table according to a preset relationship between the data difference field value and the data difference type.

[0109] In this embodiment, the preset relationship between the data difference field value and the data difference type includes that when the data difference field value is 0, the corresponding data difference type is that the primary and replica data are consistent; when the data difference field value is 1, the corresponding data difference type is that the replica has a missing record or a replica has an extra record; when the data difference field value is 2, the corresponding data difference type is that both the primary and replica have this record, and the non-primary key fields are inconsistent.

[0110] In this embodiment, when the data difference field value is 1 and SOURCE is P, the corresponding data difference type is a copy missing record; when the data difference field value is 1 and SOURCE is C, the corresponding data difference type is a copy redundant record.

[0111] In this embodiment, the data difference type of the primary and replica data being consistent can be recorded as TYPE 1, the data difference type of the replica missing record can be recorded as TYPE 3, the data difference type of the replica redundant record can be recorded as TYPE 4, and the data difference type of the primary and replica both having the record but inconsistent non-primary key fields can be recorded as TYPE 2, as shown in Table 15.

[0112] Table 15

[0113] TASK_! C_D_ID KEY VAL_1 VAL_2 SOURCE TYPE CAL A BATCH ID P 1 0 VAL_A1 VAL_A2 A TASK_1 P_A_ID C 1 0 VAL_A1 VAL_A2 B TASK_1 C_A_ID P 2 2 VAL_B1 VAL_B2 B TASK_1 P_B_ID C 2 2 VAL_B1 VAL_B3 C TASK_1 C_B_ID P 3 1 VAL_C1 VAL_C2 D TASK_1 P_C_ID C 4 1 VAL_D1 VAL_D2

[0114] In this embodiment, after determining the data difference type corresponding to each row of data in the second data comparison table, the data with TYPE 2 can be analyzed row by row, and the inconsistent primary and copy data record fields of non-primary keys can be compared one by one, and then the inconsistent field information and field values ​​can be recorded in the inconsistent field record table, as shown in Table 16.

[0115] Table 16

[0116] TASK_1 C_D_ID BATCH KEY COL_NAME VAL_A B VAL_B TASK_1 VAL2

[0117] In this embodiment, the data included in the second data comparison table and the inconsistent field record table can also be visualized to intuitively know the data comparison results. In addition, for records with consistent primary keys but inconsistent other fields, more detailed field value differences can be displayed.

[0118] In this specification, the various embodiments of the above method are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments. For relevant parts, please refer to the partial description of the method embodiment.

[0119] From the above description, it can be seen that the embodiment of the present application can achieve the following technical effects: by constructing a data table structure for performing data comparison, the master and copy data are written into the data comparison table, which can provide a basis for subsequent inspection of the master and copy data differences. Through the grouping and aggregation of the two data records, not only can the data records with missing or redundant copy data, as well as the specific differences in the records with the same primary key but inconsistent other fields, be quickly and efficiently filtered out from a large amount of data, the master and copy data comparison results can be obtained, thereby improving the efficiency of comparing large amounts of data, but also the row-by-row analysis of the full table scan can be avoided, reducing the analysis cost. By separately analyzing the records with the same primary key but inconsistent other fields, extracting the detailed information of the inconsistent fields, and visually displaying the master and copy data comparison results and the inconsistent detailed information, not only can the master and copy data differences be intuitively understood, but also a guarantee can be provided for the subsequent backtracking and analysis of incomplete copy data based on the detailed difference information.

[0120] Based on the above-mentioned method for determining the data comparison result, one or more embodiments of this specification also provide a device for determining the data comparison result. The device may include a system (including a distributed system), software (application), module, component, server, client, etc. using the method described in the embodiment of this specification and combined with a device for implementing the necessary hardware. Based on the same innovative concept, the device in one or more embodiments provided in the embodiment of this specification is as described in the following embodiments. Since the implementation scheme and method for solving the problem of the device are similar, the implementation of the specific device of the embodiment of this specification can refer to the implementation of the aforementioned method, and the repetitions will not be repeated. As used below, the term "unit" or "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.

[0121] Specifically, VAL_B2 This is a schematic diagram of the module structure of an embodiment of a device for determining data comparison results provided in this specification, such as VAL_B3 As shown, the device for determining data comparison results provided in this specification may include: a loading module 120 , a first data comparison table obtaining module 122 , a grouping module 124 , a second data comparison table obtaining module 126 , and a comparison result determining module 128 .

[0122] The loading module 120 can be used to load the data in the main table and the sub-table into the data comparison table respectively; the table structure of the data comparison table includes the main table field and the comparison field; wherein, during the loading process, the initial value is set for the comparison field;

[0123] The first data comparison table obtaining module 122 may be used to update the initial value of the comparison field corresponding to the row with the same data corresponding to the main table field in the data comparison table to a first value, thereby obtaining the first data comparison table;

[0124] The grouping module 124 may be configured to group rows in the first data comparison table whose comparison fields are not the first value based on the primary key field included in the main table fields;

[0125] The second data comparison table obtaining module 126 may be configured to update the initial value of the comparison field of each row in each group according to the number of rows included in the group, thereby obtaining a second data comparison table;

[0126] The comparison result determination module 128 may be configured to determine the comparison result corresponding to each row of data in the second data comparison table according to a preset relationship between the comparison field value and the comparison result.

[0127] It should be noted that the above-mentioned device may also include other implementation methods according to the description of the method embodiment. The specific implementation methods can refer to the description of the relevant method embodiments and will not be described in detail here.

[0128] This specification also provides an embodiment of a device for determining data comparison results, including a processor and a memory for storing processor-executable instructions, wherein the processor can implement any of the above-mentioned method embodiments when executing the instructions. For example, when the instructions are executed by the processor, the following steps are implemented: respectively loading the data in the main table and the sub-table into the data comparison table; the table structure of the data comparison table includes a main table field and a comparison field; wherein, during the loading process, an initial value is set for the comparison field; the initial value of the comparison field corresponding to the row with the same data in the main table field in the data comparison table is updated to a first value to obtain a first data comparison table; based on the primary key field included in the main table field, the rows in the first data comparison table whose comparison field is not the first value are grouped; according to the number of rows included in each group, the initial value of the comparison field of each row in the group is updated to obtain a second data comparison table; according to the preset relationship between the comparison field value and the comparison result, the comparison result corresponding to each row of data in the second data comparison table is determined.

[0129] It should be noted that the above-mentioned device may also include other implementations according to the description of the method or apparatus embodiment. Specific implementations can refer to the description of the relevant method embodiment and will not be described in detail here.

[0130] The method embodiments provided in this specification can be executed in a mobile terminal, a computer terminal, a server or a similar computing device. Taking running on a server as an example, Figure 3This is a hardware structure block diagram of an embodiment of a server for determining data comparison results provided in this specification. The server may be the apparatus for determining data comparison results or the device for determining data comparison results in the above embodiments. Figure 3 As shown, the server 10 may include one or more (only one is shown in the figure) processors 100 (the processor 100 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 200 for storing data, and a transmission module 300 for communication functions. It will be understood by those skilled in the art that Figure 4 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 4 More or fewer components shown in the figure may also include other processing hardware, such as a database or multi-level cache, GPU, or other hardware with Figure 4 Different configurations shown.

[0131] The memory 200 can be used to store software programs and modules of application software, such as the program instructions / modules corresponding to the method for determining data comparison results in the embodiments of this specification. The processor 100 executes various functional applications and data processing by running the software programs and modules stored in the memory 200. The memory 200 may include a high-speed random access memory and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 200 may further include a memory remotely located relative to the processor 100, and these remote memories may be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0132] The transmission module 300 is used to receive or send data via a network. Specific examples of the aforementioned network may include a wireless network provided by a communications provider of a computer terminal. In one embodiment, the transmission module 300 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission module 300 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0133] The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0134] The methods or devices described in the above embodiments provided in this specification can implement business logic through computer programs and record them on storage media, and the storage media can be read and executed by computers to achieve the effects of the solutions described in the embodiments of this specification. The storage medium may include a physical device for storing information, which is usually to digitize the information and then store it in a medium using electrical, magnetic or optical methods. The storage medium may include: devices that use electrical energy to store information, such as various types of memories, such as RAM, ROM, etc.; devices that use magnetic energy to store information, such as hard disks, floppy disks, magnetic tapes, magnetic core memories, bubble memories, and USB flash drives; devices that use optical methods to store information, such as CDs or DVDs. Of course, there are other types of readable storage media, such as quantum memories, graphene memories, and so on.

[0135] The above-mentioned method or device embodiments for determining data comparison results provided in this specification can be implemented by a processor in a computer executing corresponding program instructions, such as using the C++ language of the Windows operating system on a PC, a Linux system, or other systems such as Android or iOS system programming languages ​​on a smart terminal, as well as processing logic based on a quantum computer.

[0136] It should be noted that the devices and equipment described above in the specification may also include other implementation methods according to the description of the relevant method embodiments. The specific implementation methods can refer to the description of the corresponding method embodiments and will not be described one by one here.

[0137] The various embodiments in this application are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, for the hardware + program embodiments, since they are basically similar to the method embodiments, the description is relatively simple. For relevant parts, refer to the partial description of the method embodiments.

[0138] For ease of description, the above devices are described in terms of their functions, divided into various modules. Of course, when implementing one or more of the present inventions, the functions of some modules may be implemented in the same or multiple software and / or hardware, or a module implementing the same function may be implemented by a combination of multiple sub-modules or sub-units.

[0139] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices, and apparatus according to embodiments of the present invention. It should be understood that it can be implemented by computer program instructions, which can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce an apparatus for implementing a specified function. These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which is implemented in the flowchart. Figure 4 a process or multiple processes and / or boxes Figure 4 Figure 1 Figure 1 The function specified in one or more boxes.

[0140] Those skilled in the art will appreciate that one or more embodiments of the present specification may be provided as methods, systems, or computer program products. Thus, one or more embodiments of the present specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware.

[0141] The foregoing is merely an example of one or more embodiments of this specification and is not intended to limit the one or more embodiments of this specification. It will be apparent to those skilled in the art that various modifications and variations may be made to one or more embodiments of this specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this application shall be included within the scope of the claims.

Claims

1. A method for determining data comparison results, It is characterized in that The method comprises: The data in the main table and the sub-table are loaded into the data comparison table respectively; the table structure of the data comparison table includes the main table field and the comparison field; wherein, during the loading process, an initial value is set for the comparison field; The initial value of the comparison field corresponding to the row with the same data corresponding to the main table field in the data comparison table is updated to the first value to obtain the first data comparison table; specifically comprising: dividing the data in the data comparison table into different groups according to the main table field; judging whether the data corresponding to the main table field in each group is the same; updating the initial value of the comparison field corresponding to the row with the same data corresponding to the main table field to the first value to obtain the first data comparison table; Based on the primary key field included in the main table field, the rows in the first data comparison table whose comparison field is not the first value are grouped; wherein the grouping includes: grouping using the GROUP BY method in relational data; According to the number of rows included in each group, the initial value of the comparison field of each row in the group is updated to obtain a second data comparison table; According to a preset relationship between the comparison field value and the comparison result, the comparison result corresponding to each row of data in the second data comparison table is determined.

2. The method according to claim 1, It is characterized in that Before loading the data in the main table and the auxiliary table into the data comparison table, the process includes: Obtaining a table structure of a main table; the table structure of the main table includes main table fields; Based on the main table fields and auxiliary fields, a table structure of a data comparison table is constructed; the auxiliary fields at least include comparison fields.

3. The method according to claim 2, It is characterized in that Before loading the data in the main table and the auxiliary table into the data comparison table, the method further includes: Get the table structure of the secondary table; Determine whether the table structure of the main table is consistent with the table structure of the secondary table; When the consistency is determined, the data in the main table and the secondary table are loaded into the data comparison table in sequence.

4. The method according to claim 1, It is characterized in that The updating, according to the number of rows included in each group, of the initial value of the comparison field of each row in the group to obtain the second data comparison table includes: When the number of rows included in the group is 2, updating the initial value of the comparison field in each row of the group to a second value; When the number of rows included in the group is 1, the initial value of the comparison field in each row of the group is updated to a third value.

5. The method according to claim 4, It is characterized in that Determining the comparison result corresponding to each row of data in the second data comparison table according to a preset relationship between the comparison field value and the comparison result includes: When the comparison field value is the first value, it is determined that the comparison result is consistent with the data in the primary and secondary tables; When the comparison field value is the second value, it is determined that the comparison result shows that the data corresponding to the primary key fields in the primary and secondary tables are consistent, and the data corresponding to the non-primary key fields are inconsistent; When the comparison field value is the third value, it is determined that the comparison result is missing data in the sub-table or redundant data in the sub-table.

6. The method according to claim 5, It is characterized in that The table structure of the data comparison table also includes a data attribution field; When the comparison field value is the third value, the comparison result is determined to be the secondary table missing data or the secondary table redundant data according to the data attribution field.

7. The method according to claim 6, It is characterized in that When the value corresponding to the data attribution field indicates that the data originates from the main table, the comparison result is determined to be the missing data of the secondary table according to the data attribution field; When the value corresponding to the data belonging field indicates that the data originates from the secondary table data, the comparison result is determined to be the secondary table redundant data according to the data belonging field.

8. The method according to claim 5, It is characterized in that When it is determined that the comparison results show that the data corresponding to the primary key fields in the primary and secondary tables are consistent, and the data corresponding to the non-primary key fields are inconsistent, it includes: Compare the corresponding data of the non-primary key fields one by one to obtain inconsistent non-primary key field information; the inconsistent non-primary key field information includes the non-primary key field name, the data corresponding to the non-primary key field name in the primary table, and the data corresponding to the non-primary key field name in the secondary table; The inconsistent non-primary key field information is recorded in a difference record table.

9. The method according to claim 1, It is characterized in that The table structure of the data comparison table also includes a comparison result field, and the comparison result field is used to store the comparison result; After determining the comparison result corresponding to each row of data in the second data comparison table, the method includes: The comparison results are stored in the second data comparison table; The second data comparison table is displayed.

10. The method according to claim 9, It is characterized in that When the comparison result shows that the data corresponding to the primary key fields in the primary and secondary tables are consistent, and the data corresponding to the non-primary key fields are inconsistent, the display of the second data comparison table includes: Get inconsistent non-primary key field information from the difference record table; The inconsistent non-primary key field information is displayed.

11. The method according to claim 1, It is characterized in that The table structure of the data comparison table also includes a batch identification field; According to the batch identification field, the comparison results of different batches are displayed.

12. A device for determining a data comparison result, It is characterized in that include: A loading module, used to load the data in the main table and the sub-table into the data comparison table respectively; the table structure of the data comparison table includes the main table field and the comparison field; wherein, during the loading process, an initial value is set for the comparison field; A first data comparison table obtaining module, used for updating the initial value of the comparison field corresponding to the row with the same data corresponding to the main table field in the data comparison table to a first value, so as to obtain a first data comparison table; A grouping module, configured to group rows in the first data comparison table whose comparison fields are not the first value based on the primary key field included in the main table fields; wherein the grouping comprises: grouping using the GROUP BY method in relational data; A second data comparison table obtaining module, used for updating the initial value of the comparison field of each row in each group according to the number of rows included in the group, to obtain a second data comparison table; A comparison result determination module, used to determine the comparison result corresponding to each row of data in the second data comparison table according to a preset relationship between the comparison field value and the comparison result; Among them, the first data comparison table acquisition module is specifically used to divide the data in the data comparison table into different groups according to the main table fields; determine whether the data corresponding to the main table fields in each group are the same; update the initial value of the comparison field corresponding to the row with the same corresponding data of the main table fields to the first value, and obtain the first data comparison table.

13. A device for determining the result of a data comparison, It is characterized in that The invention comprises a processor and a memory for storing processor executable instructions, wherein the processor implements the steps of the method according to any one of claims 1 to 11 when executing the instructions.

14. A computer-readable storage medium, It is characterized in that Computer instructions are stored thereon, and when the instructions are executed, the steps of the method according to any one of claims 1 to 11 are implemented.

Citation Information

Patent Citations

  • Method and device for detecting hive data table

    CN108958959A

  • A data testing method and device

    CN109933514A

  • Relational database data comparison method and system

    CN111143368A

  • Efficient set operation execution using a single group-by operation

    US20150220600A1