CN113051882A - Data difference comparison method, device, medium and product - Google Patents

Data difference comparison method, device, medium and product Download PDF

Info

Publication number
CN113051882A
CN113051882A CN202110445589.6A CN202110445589A CN113051882A CN 113051882 A CN113051882 A CN 113051882A CN 202110445589 A CN202110445589 A CN 202110445589A CN 113051882 A CN113051882 A CN 113051882A
Authority
CN
China
Prior art keywords
data
list
compared
data list
difference comparison
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110445589.6A
Other languages
Chinese (zh)
Inventor
谢帅虎
李兵
夏扬
夏冬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202110445589.6A priority Critical patent/CN113051882A/en
Publication of CN113051882A publication Critical patent/CN113051882A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/177Editing, e.g. inserting or deleting of tables; using ruled lines
    • G06F40/18Editing, e.g. inserting or deleting of tables; using ruled lines of spreadsheets
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/194Calculation of difference between files

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure provides a data difference comparison method, and belongs to the technical field of big data. The data difference comparison method is used for carrying out difference comparison on data in a first data list and a second data list, and comprises the following steps: sequentially reading the data in the second data list as data to be compared; traversing and comparing each data to be compared read in sequence with the data in the first data list; when data which are the same as the data to be compared exist in the first data list, storing the data to be compared into a position corresponding to the position of the same data in the first data list, and deleting the data to be compared in the second data list; after all the data in the second data list are compared with the data in the first data list in a traversing mode, the residual data in the second data list are stored in a centralized mode. The method can realize data difference comparison without manual sequencing in advance, and improves the data processing and comparison efficiency.

Description

Data difference comparison method, device, medium and product
Technical Field
The present disclosure relates to the field of data processing technology, and in particular, to the field of big data technology. And more particularly, to a data variance comparison method, apparatus, medium, and article of manufacture.
Background
In the daily OFFICE process using OFFICE, Excel is usually used to process data, and the difference between the contents of two Excel files is often needed to be compared. If the data in the two Excel files are arranged in a descending or ascending manner, the data in the two Excel files are only required to be copied and pasted on the left window and the right window of the relevant software for data difference comparison, the difference part of the data in the two Excel files can be highlighted, and the sorting result is shown in fig. 1.
However, in many scenarios, the generation of data in an Excel file has no absolutely uniform requirement in order. If the data in the two Excel files are ordered in different manners, the data in the Excel files can be generally arranged in a descending or ascending manner, and then the data in the two Excel files are compared, so that the difference of the data in the two Excel files can be displayed.
The above process is illustrated by taking the data sorting process in fig. 2 and 3 as an example:
as shown in FIG. 2, the left window is data in Sheet A and the right window is data in Sheet B. Some same data in the two are different in sequence, if the same data are directly copied and pasted to left and right windows of related software for data difference comparison for comparison, because the same data cannot be automatically arranged at the same row position, some originally same data can also be directly highlighted to be displayed as difference, such as 'water flow transmission' in fig. 2, which exists in both sheets, but the sequence in the two sheets is different, so that the 'water flow transmission' is marked as difference data after the comparison is performed by using the related software for data difference comparison.
As shown in fig. 3, if an operator manually sorts the data in the two sheets, and then pastes the sorted data to left and right windows of software related to data difference comparison for data difference comparison, the data in the left and right windows that are the same are not highlighted, and only the data difference part is highlighted.
For the above case that the same data is labeled as difference, there is a solution, as shown in fig. 4, that is, two file paths are input to the designated positions of the related software for data difference comparison, and at this time, the left and right windows will automatically sort the data, and because of automatic sorting, only the difference part of the data is displayed after the difference comparison is performed.
For the two methods for solving the problem that the same data to be compared is marked as difference, operators are required to have certain computer knowledge, the original positions of the lines of the original data of the left window and the original data of the right window are disturbed by ascending or descending operation, and if the data amount is too much, the marking of related difference information on the basis of the original data in an Excel table is difficult, and time and labor are wasted.
Disclosure of Invention
In view of the above-mentioned defects in the prior art, the present disclosure provides a data difference comparison method, apparatus, medium, and product, which can implement data difference comparison without manual sorting in advance, so as to solve the problems of difficult operation, time consuming, and labor consuming of the existing data comparison method.
According to a first aspect of the present disclosure, there is provided a data difference comparison method for performing difference comparison on data in a first data list and a second data list, the data difference comparison method comprising the steps of:
sequentially reading the data in the second data list as data to be compared;
traversing and comparing each piece of the data to be compared which is read in sequence with the data in the first data list;
when the data which is the same as the data to be compared exists in the first data list, storing the data to be compared into a position corresponding to the position of the same data in the first data list, and deleting the data to be compared in the second data list;
after all the data in the second data list are compared with the data in the first data list in a traversing mode, the rest data in the second data list are stored in a centralized mode.
According to an embodiment of the present disclosure, before the sequentially reading the data in the second data list as the data to be compared, the data difference comparison method further includes: receiving the first data list and the second data list, wherein the first data list and the second data list comprise one or more data.
According to an embodiment of the present disclosure, the data in the first data list and the second data list are arranged in a row or column manner.
According to an embodiment of the present disclosure, the sequentially reading the data in the second data list as the data to be compared specifically includes: and sequentially reading the data in the second data list as the data to be compared according to the arrangement mode of the data in the second data list.
According to an embodiment of the present disclosure, the second data list includes a row of data or a column of data, and the sequentially reading the data in the second data list as the data to be compared specifically includes: and sequentially reading data from the first row or the first column of the row data or the column data according to the arrangement mode of the row or the column as the data to be compared.
According to an embodiment of the present disclosure, the performing traversal comparison on each of the sequentially read data to be compared and the data in the first data list specifically includes: and traversing and comparing each piece of data to be compared which is read in sequence with the data in the first data list according to the arrangement mode of the data in the first data list.
According to an embodiment of the present disclosure, the first data list includes a row of data or a column of data, and the performing traversal comparison on each of the sequentially read data to be compared and the data in the first data list specifically includes: and starting from the first row or the first column of the first data list, performing the traversal comparison on each piece of the data to be compared, which is read in sequence, and the data in the first data list according to the sequence of the rows or the columns.
According to an embodiment of the present disclosure, the data difference comparison method further includes: when it is determined that the data identical to the data to be compared does not exist in the first data list, the step of sequentially reading the data in the second data list is continuously executed.
According to an embodiment of the present disclosure, the sequentially reading the data in the second data list as the data to be compared specifically includes: identifying the number of data in the second data list, and recording as the maximum data number N of the second data list, wherein N is more than or equal to 1; setting a data reading serial number n, and setting an initial value of n as 1; judging whether the data reading sequence number N is less than or equal to N, reading the nth data in the second data list as the data to be compared when the data reading sequence number N is less than or equal to N, and executing the step of traversing and comparing the data to be compared with the data in the first data list; and when the data reading sequence number N is judged to be larger than N, executing the step of intensively storing the residual data in the second data list.
According to an embodiment of the present disclosure, when it is determined that there is data that is the same as the data to be compared in the first data list, the storing the data to be compared in a position corresponding to a position of the same data in the first data list, and deleting the data to be compared in the second data list specifically includes:
determining whether the same data as the data to be compared exists in the first data list;
when it is determined that the data which is the same as the data to be compared exists in the first data list, storing the data to be compared into a position corresponding to the position of the same data in the first data list, deleting the data to be compared in the second data list, and executing the following steps; when determining that the data which is the same as the data to be compared does not exist in the first data list, continuing to execute the following steps;
and adding 1 to the data reading sequence number N, and continuing to execute the step of judging whether the data reading sequence number N is less than or equal to N.
According to an embodiment of the present disclosure, before the step of performing traversal comparison on each of the sequentially read data to be compared and the data in the first data list, the method further includes: and reserving a third data list which has the same data arrangement mode as the first data list, wherein the third data list is empty in an initial state.
According to an embodiment of the present disclosure, the storing the data to be compared in the position corresponding to the position of the same data in the first data list specifically includes: and storing the data to be compared into the corresponding position in the third data list corresponding to the position of the same data in the first data list.
According to an embodiment of the present disclosure, the first data list includes a row of data or a column of data, and the third data list includes a blank row or a blank column having the same number of rows or columns as the first data list; the storing the data to be compared into the corresponding position in the third data list corresponding to the position of the same data in the first data list specifically includes: and storing the data to be compared into the row or the column in the third data list, wherein the row or the column is the same as the row or the column of the same data in the first data list.
According to an embodiment of the present disclosure, the intensively storing the remaining data in the second data list specifically includes: storing the remaining data in the second data list after the third data list.
According to an embodiment of the present disclosure, the data difference comparison method further includes: and marking the residual data in the second data list after the first data list.
According to an embodiment of the present disclosure, the data difference comparison method further includes: and marking the data in the position in the first data list corresponding to the position of the third data list, in which the data is empty, behind the third data list.
According to an embodiment of the present disclosure, the first data list and the third data list include row data or column data, and labeling data in a position in the first data list corresponding to a position in the third data list where the data is empty after the third data list specifically includes: and marking the data in the row or column in the first data list corresponding to the row or column with empty data in the third data list after the third data list.
A second aspect of the present disclosure provides a data difference comparison apparatus for performing difference comparison on data in a first data list and a second data list, the data difference comparison apparatus including:
the reading module is used for sequentially reading the data in the second data list as data to be compared;
the comparison module is used for performing traversal comparison on each piece of data to be compared, which is read in sequence, and the data in the first data list;
the execution module is used for storing the data to be compared into a position corresponding to the position of the same data in the first data list when the data which is the same as the data to be compared exists in the first data list, and deleting the data to be compared in the second data list; and
and the storage module is used for intensively storing the residual data in the second data list after all the data in the second data list are compared with the data in the first data list in a traversing way.
A third aspect of the present disclosure provides an electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform a data contrast method as described above.
A fourth aspect of the present disclosure provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform one of the data difference comparison methods described above.
A fifth aspect of the present disclosure provides a computer program product comprising a computer program which, when executed by a processor, implements a data difference comparison method as described above.
Compared with the prior art, the data difference comparison method provided by the disclosure can realize data difference comparison without manual sequencing in advance, quickly locate the difference part of two file data in a traversal comparison mode, and improve the efficiency of data processing and comparison.
Drawings
The foregoing and other objects, features and advantages of the disclosure will be apparent from the following description of embodiments of the disclosure, which proceeds with reference to the accompanying drawings, in which:
FIG. 1 is a diagram schematically illustrating a difference comparison result of data arranged in a fixed manner in the prior art;
FIG. 2 is a graph schematically illustrating the difference comparison of data arranged in different ways in the prior art;
FIG. 3 is a graph schematically showing the difference comparison result of data arranged in a manual manner in the prior art;
FIG. 4 is a diagram schematically illustrating a difference comparison result of data arranged in an automatic manner in the prior art;
FIG. 5 schematically illustrates a flow chart of a data variance comparison method according to an embodiment of the present disclosure;
FIG. 6 schematically shows a flow chart of a refinement of a data difference comparison method according to an embodiment of the present disclosure;
fig. 7 schematically shows a schematic diagram of reserving a third data list according to an embodiment of the present disclosure;
FIG. 8 schematically illustrates storing data in a third data list after a traversal comparison according to an embodiment of the disclosure;
FIG. 9 schematically illustrates a diagram of storing remaining data after a traversal comparison according to an embodiment of the disclosure;
FIG. 10 schematically illustrates a schematic comparing interchanging positions of two data tables according to an embodiment of the disclosure;
fig. 11 schematically shows a block diagram of a data difference comparison apparatus according to an embodiment of the present disclosure;
fig. 12 schematically shows a block diagram of an electronic device adapted to implement a data difference comparison method according to an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
Embodiments of the present disclosure provide a data difference comparison method, apparatus, medium, and product. The data difference comparison method is used for carrying out difference comparison on data in a first data list and data in a second data list, and comprises the following steps: sequentially reading the data in the second data list as data to be compared; traversing and comparing each piece of the data to be compared which is read in sequence with the data in the first data list; when the data which is the same as the data to be compared exists in the first data list, storing the data to be compared into a position corresponding to the position of the same data in the first data list, and deleting the data to be compared in the second data list; after all the data in the second data list are compared with the data in the first data list in a traversing mode, the rest data in the second data list are stored in a centralized mode.
Compared with the prior art, the data difference comparison method provided by the disclosure can realize data difference comparison without manual sequencing in advance, quickly locate the difference part of two file data in a traversal comparison mode, and improve the data processing and comparison efficiency.
A data difference comparison method, apparatus, medium, and article of manufacture of embodiments of the present disclosure will be described in detail below with reference to fig. 5-12.
Fig. 5 and 6 schematically show a flowchart of a data difference comparison method according to an embodiment of the present disclosure, wherein the flowchart in fig. 6 is a refinement of the flowchart in fig. 5, and the embodiment provided by the present disclosure is described by means of two flowcharts.
As shown in fig. 5 and 6, this embodiment provides a data difference comparison method for performing difference comparison on data in a first data list and a second data list, and the method includes operations S101 to S105, which are described as follows.
In operation S101, a first data list and a second data list are received, where the first data list and the second data list contain one or more data.
The data in the first data list and the second data list are arranged in a row or column arrangement mode.
More specifically, the first data list and the second data list may be excel data tables.
Referring to fig. 6, as shown in operation S1011, the operation S101 further includes: and reserving a third data list which has the same data arrangement mode as the first data list, wherein the third data list is empty in an initial state. Of course, the step of reserving the third data list having the same data arrangement as the first data list may be performed before the step of performing the traversal comparison is performed, and is not necessarily limited to the operation S101 or S1011.
More specifically, when the first data list includes a row of data or a column of data, the third data list includes the same number of blank rows or columns as the row of the first data list.
More specifically, when the first data list is an excel data table, the third data list is also a blank row or a blank column with the same number of rows or columns as that of the first data list. In addition, the second data list is also an excel data table.
More specifically, when the first data list, the second data list and the third data list are excel data tables, the receiving the first data list and the second data list, and reserving the third data list in the same data arrangement manner as the first data list specifically include: pasting the data in the first data list to a left window of an excel data table, reserving blanks with the same line number on the right side of the left window as a third data list, and pasting the data in the second data list to another excel data table.
As shown in fig. 7, taking the first data list, the second data list and the third data list as excel data tables as an example, paste the data of the first data list (for example, Sheet a) to the left window, and the right window automatically recognizes that the same row number of blank spaces are reserved as the third data list.
In operation S102, the data in the second data list are sequentially read as data to be compared.
The sequentially reading the data in the second data list as the data to be compared specifically includes: and sequentially reading the data in the second data list as the data to be compared according to the arrangement mode of the data in the second data list. Of course, the data in the second data list may be sequentially read as the data to be compared in other manners as long as all the data in the second data list can be completely read.
In order to complete the traversal comparison between all data in the second data list and data in the first data list in sequence, more specifically, as shown in fig. 6, the reading data in the second data list as data to be compared specifically includes:
in operation S1021, identifying the number of data in the second data list, and recording as the maximum number N of data in the second data list, where N is greater than or equal to 1;
specifically, when the second data list is an excel data table, identifying the maximum row number or the maximum column number of data in the excel data table as N.
In operation S1022, a data read sequence number n is set, and an initial value of n is set to 1;
in operation S1023, determining whether the data reading sequence number N is less than or equal to N, and executing operation S1024 when determining that the data reading sequence number N is less than or equal to N; when the data reading sequence number N is greater than N, the following operation S105 is performed;
in operation S1024, the nth data in the second data list is read as the data to be compared, and the following operation S103 is performed.
More specifically, when the second data list includes a row of data or a column of data, the data is sequentially read from a first row or a first column of the row of data or the column of data in an arrangement manner of the row or the column. More specifically, when the second data list is an excel data table, data is sequentially read from a first row or a first column of the excel data table.
In operation S103, each of the sequentially read data to be compared is subjected to traversal comparison with data in the first data list.
The step of performing traversal comparison on each piece of the sequentially read data to be compared and the data in the first data list specifically includes: and traversing and comparing each piece of data to be compared which is read in sequence with the data in the first data list according to the arrangement mode of the data in the first data list.
When the first data list is a row of data or a column of data, performing traversal comparison on each of the sequentially read data to be compared and the data in the first data list specifically includes: and starting from the first row or the first column of the first data list, performing the traversal comparison on each piece of the data to be compared, which is read in sequence, and the data in the first data list according to the sequence of the rows or the columns.
And when the first data list and the second data list are excel data lists, comparing the nth data in the second data list with the data in the first data list according to the sequence of rows or columns.
In operation S104, when it is determined that the same data as the data to be compared exists in the first data list, the data to be compared is stored in a position corresponding to a position of the same data in the first data list, and the data to be compared in the second data list is deleted.
The operation S104 further includes: when it is determined that the same data as the data to be compared does not exist in the first data list, the step of sequentially reading the data in the second data list in operation S102 is continuously performed.
More specifically, the operation 104 specifically includes the following steps.
In operation S1041, it is determined whether data identical to the data to be compared exists in the first data list.
Specifically, when the first data list and the second data list are excel data lists, it is determined whether the first data list has the same data as the nth data in the second data list.
In operation S1042, when it is determined that data identical to the data to be compared exists in the first data list, the data to be compared is stored in a position corresponding to a position of the identical data in the first data list, the data to be compared in the second data list is deleted, and the following operation S1043 is performed; when it is determined that the same data as the data to be compared does not exist in the first data list, the following operation S1043 is continuously performed.
Specifically, the storing the data to be compared into a position corresponding to the position of the same data in the first data list specifically includes: and storing the data to be compared into a corresponding position in a third data list corresponding to the position of the same data in the first data list.
More specifically, when the first data list is a row of data or a column of data, the third data list is a blank row or a blank column having the same number of rows or columns as the first data list. Further, the storing the data to be compared into a position corresponding to the position of the same data in the first data list specifically includes: and storing the data to be compared into the same row or the same column in the third data list which is the same as the row or the column of the same data in the first data list, specifically, storing the data to be compared into the nth row or the nth column in the third data list.
More specifically, when the first data list is an excel data table, the third data list is also a blank row or a blank column with the same number of rows or columns as that of the first data list. Further, the storing the data to be compared into a position corresponding to the position of the same data in the first data list specifically includes: and storing the data to be compared into the same row or the same column in a third data list, specifically, storing the data to be compared into the nth row or the nth column in an excel data table of the third data list.
As shown in fig. 8, taking the first data list, the second data list, and the third data list as excel data tables as an example, the present disclosure may automatically identify the number of rows of the second data list (e.g., Sheet B). And traversing and comparing the data in the first row of the Sheet B with all the data in the left window, namely the first data list (namely the Sheet A), if the same data are found in the left window, replacing the corresponding blank of the right window, namely the third data list with the data, and deleting the data in the first row of the Sheet B. Otherwise, directly taking the next row of data of the Sheet B, and traversing and comparing again until all the data in the Sheet B are traversed.
More specifically, when the first data list and the second data list are data in a row or a column, the deleting the data to be compared in the second data list specifically includes: deleting the nth row or nth column data in the second data list.
In operation S1043, add 1 to the data reading sequence number N, and continue to execute the step of determining whether the data reading sequence number N is less than or equal to N.
In operation 105, after comparing all the data in the second data list with the data in the first data list, the remaining data in the second data list is centrally stored.
The intensively storing the remaining data in the second data list specifically includes:
in operation S1051, it is determined whether the second data list further includes remaining data, if so, operation S1052 is performed, and if not, the entire data difference comparison process is ended;
in operation S1052, the remaining data is stored, and the entire data difference comparison process is ended;
the intensively storing the remaining data in the second data list specifically includes: storing the remaining data in the second data list after the third data list. More specifically, when the third data list is row data or column data, the remaining data is stored after the row data or column data.
As shown in fig. 9, taking the first data list, the second data list and the third data list all as excel data tables as an example, if Sheet B is determined that the second data list has remaining data, the remaining data is directly placed after the original reserved blank, i.e., the third data list, as shown in fig. 9, and "chat book" is placed after the reserved blank.
The data difference comparison method further comprises the following steps:
and marking the residual data in the second data list after the first data list. Specifically, when the first data list is row data or column data, the remaining data in the second data list is stored after the row data or column data.
The data difference comparison method further comprises the following steps:
and marking the data in the position in the first data list corresponding to the position of the third data list, in which the data is empty, behind the third data list. Further, when the first data list and the third data list are row data or column data, the marking, after the third data list, data in a position in the first data list corresponding to a position in the third data list where data is empty specifically includes: and marking the data in the row or column in the first data list corresponding to the row or column with empty data in the third data list after the third data list.
As shown in fig. 10, taking the first data list, the second data list and the third data list as Excel data tables as an example, the difference between the first data list, i.e., Sheet a original data in the original Excel, and the second data list can be marked by referring to the final comparison result as needed. On the contrary, if the second data list, namely the Sheet B original data, needs to be labeled, the Sheet B and Sheet A data can be exchanged in position and respectively placed in the left window and the right window.
According to the data difference comparison method provided by the embodiment of the disclosure, data difference comparison can be realized without manual sorting in advance, the difference part of two file data is rapidly positioned in a traversal comparison mode, and the data processing and comparison efficiency is improved.
Based on the data difference comparison method shown in fig. 5 and fig. 6, the present disclosure also provides a data difference comparison apparatus. The apparatus will be described in detail below with reference to fig. 11.
Fig. 11 schematically shows a block diagram of a data difference comparison apparatus according to an embodiment of the present disclosure.
As shown in fig. 11, this embodiment provides a data difference comparison apparatus 1100, where the apparatus 1100 includes a receiving module 1101, a reading module 1102, a comparing module 1103, an executing module 1104, and a storing module 1105.
The receiving module 1101 is configured to receive a first data list and a second data list, where the first data list and the second data list include one or more data.
In an embodiment, the receiving module 1101 may be configured to perform the operation S101 described above, which is not described herein again.
The reading module 1102 is configured to sequentially read data in the second data list as data to be compared.
In an embodiment, the reading module 1102 may be configured to perform the operation S102 described above, which is not described herein again.
The comparing module 1103 is configured to perform traversal comparison on each of the sequentially read data to be compared and the data in the first data list.
In an embodiment, the comparing module 1103 may be configured to perform the operation S103 described above, which is not described herein again.
The executing module 1104 is configured to, when it is determined that data that is the same as the data to be compared exists in the first data list, store the data to be compared in a position corresponding to the position of the same data in the first data list, and delete the data to be compared in the second data list.
In an embodiment, the executing module 1104 may be configured to execute the operation S104 described above, which is not described herein again.
The storing module 1105 is configured to intensively store the remaining data in the second data list after all the data in the second data list are compared with the data in the first data list.
In an embodiment, the storage module 1105 may be configured to perform the operation S105 described above, which is not described herein again.
Based on the data difference comparison device provided by the embodiment of the present disclosure shown in fig. 11, data difference comparison can be achieved without manual sorting in advance, and the difference part of two file data is quickly located in a traversal comparison manner, so that data processing and comparison efficiency is improved.
Fig. 12 schematically shows a block diagram of an electronic device adapted to implement a data difference comparison method according to an embodiment of the present disclosure.
As shown in fig. 12, an electronic apparatus 1200 according to an embodiment of the present disclosure includes a processor 1201, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)1202 or a program loaded from a storage section 1208 into a Random Access Memory (RAM) 1203. The processor 1201 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 1201 may also include on-board memory for caching purposes. The processor 1201 may include a single processing unit or multiple processing units for performing the different actions of the method flows according to embodiments of the present disclosure.
In the RAM1203, various programs and data necessary for the operation of the electronic apparatus 1200 are stored. The processor 1201, the ROM 1202, and the RAM1203 are connected to each other by a bus 1204. The processor 1201 performs various operations of the method flow according to the embodiments of the present disclosure by executing programs in the ROM 1202 and/or the RAM 1203. Note that the programs may also be stored in one or more memories other than the ROM 1202 and the RAM 1203. The processor 1201 may also perform various operations of method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
Electronic device 1200 may also include input/output (I/O) interface 1205, according to an embodiment of the disclosure, input/output (I/O) interface 1205 also connected to bus 1204. The electronic device 1200 may also include one or more of the following components connected to the I/O interface 1205: an input section 1206 including a keyboard, a mouse, and the like; an output portion 1207 including a display device such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 1208 including a hard disk and the like; and a communication section 1209 including a network interface card such as a LAN card, a modem, or the like. The communication section 1209 performs communication processing via a network such as the internet. A driver 1210 is also connected to the I/O interface 1205 as needed. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like, is mounted on the drive 1210 as necessary, so that a computer program read out therefrom is mounted into the storage section 1208 as necessary.
The present disclosure also provides a computer-readable storage medium, which may be contained in the apparatus/device/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example but is not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, a computer-readable storage medium may include the ROM 1202 and/or the RAM1203 and/or one or more memories other than the ROM 1202 and the RAM1203 described above.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the method illustrated in the flow chart. When the computer program product runs in a computer system, the program code is used for causing the computer system to realize the item recommendation method provided by the embodiment of the disclosure.
The computer program performs the above-described functions defined in the system/apparatus of the embodiments of the present disclosure when executed by the processor 1201. The systems, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
In one embodiment, the computer program may be hosted on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed in the form of a signal on a network medium, downloaded and installed through the communication section 1209, and/or installed from the removable medium 1211. The computer program containing program code may be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 1209, and/or installed from the removable medium 1211. The computer program, when executed by the processor 1201, performs the above-described functions defined in the system of the embodiments of the present disclosure. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
In accordance with embodiments of the present disclosure, program code for executing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, these computer programs may be implemented using high level procedural and/or object oriented programming languages, and/or assembly/machine languages. The programming language includes, but is not limited to, programming languages such as Java, C + +, python, the "C" language, or the like. The program code may execute entirely on the user computing device, partly on the user device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used in advantageous combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the present disclosure, and such alternatives and modifications are intended to be within the scope of the present disclosure.

Claims (21)

1. A data difference comparison method is used for carrying out difference comparison on data in a first data list and a second data list, and is characterized by comprising the following steps:
sequentially reading the data in the second data list as data to be compared;
traversing and comparing each piece of the data to be compared which is read in sequence with the data in the first data list;
when the data which is the same as the data to be compared exists in the first data list, storing the data to be compared into a position corresponding to the position of the same data in the first data list, and deleting the data to be compared in the second data list;
after all the data in the second data list are compared with the data in the first data list in a traversing mode, the rest data in the second data list are stored in a centralized mode.
2. The data difference comparison method according to claim 1, wherein before the sequentially reading the data in the second data list as the data to be compared, the data difference comparison method further comprises:
receiving the first data list and the second data list, wherein the first data list and the second data list comprise one or more data.
3. The data difference comparison method according to claim 1 or 2, wherein the data in the first data list and the second data list are arranged in a row or a column.
4. The data difference comparison method according to claim 1, wherein the sequentially reading the data in the second data list as the data to be compared specifically comprises:
and sequentially reading the data in the second data list as the data to be compared according to the arrangement mode of the data in the second data list.
5. The data difference comparison method according to claim 1 or 4, wherein the second data list includes a row of data or a column of data, and the sequentially reading the data in the second data list as the data to be compared specifically includes:
and sequentially reading data from the first row or the first column of the row data or the column data according to the arrangement mode of the row or the column as the data to be compared.
6. The data difference comparison method according to claim 1, wherein the step of performing traversal comparison on each of the sequentially read data to be compared and the data in the first data list specifically comprises:
and traversing and comparing each piece of data to be compared which is read in sequence with the data in the first data list according to the arrangement mode of the data in the first data list.
7. The data difference comparison method according to claim 1 or 6, wherein the first data list includes a row of data or a column of data, and the step of performing the traversal comparison on each of the sequentially read data to be compared and the data in the first data list specifically includes:
and starting from the first row or the first column of the first data list, performing the traversal comparison on each piece of the data to be compared, which is read in sequence, and the data in the first data list according to the sequence of the rows or the columns.
8. The data difference comparison method according to claim 1, further comprising:
when it is determined that the data identical to the data to be compared does not exist in the first data list, the step of sequentially reading the data in the second data list is continuously executed.
9. The data difference comparison method according to claim 1, wherein the sequentially reading the data in the second data list as the data to be compared specifically comprises:
identifying the number of data in the second data list, and recording as the maximum data number N of the second data list, wherein N is more than or equal to 1;
setting a data reading serial number n, and setting an initial value of n as 1;
judging whether the data reading sequence number N is less than or equal to N, reading the nth data in the second data list as the data to be compared when the data reading sequence number N is less than or equal to N, and executing the step of traversing and comparing the data to be compared with the data in the first data list; and when the data reading sequence number N is judged to be larger than N, executing the step of intensively storing the residual data in the second data list.
10. The data difference comparison method according to claim 9, wherein when it is determined that the same data as the data to be compared exists in the first data list, the step of storing the data to be compared in a position corresponding to the same data in the first data list, and deleting the data to be compared in the second data list specifically includes:
determining whether the same data as the data to be compared exists in the first data list;
when it is determined that the data which is the same as the data to be compared exists in the first data list, storing the data to be compared into a position corresponding to the position of the same data in the first data list, deleting the data to be compared in the second data list, and executing the following steps; when determining that the data which is the same as the data to be compared does not exist in the first data list, continuing to execute the following steps;
and adding 1 to the data reading sequence number N, and continuing to execute the step of judging whether the data reading sequence number N is less than or equal to N.
11. The data difference comparison method according to claim 1, 9 or 10, wherein before the step of performing the traversal comparison of each of the sequentially read data to be compared with the data in the first data list, the method further comprises:
and reserving a third data list which has the same data arrangement mode as the first data list, wherein the third data list is empty in an initial state.
12. The data difference comparison method according to claim 11, wherein the storing the data to be compared in the position corresponding to the position of the same data in the first data list specifically comprises: and storing the data to be compared into the corresponding position in the third data list corresponding to the position of the same data in the first data list.
13. The data difference comparison method according to claim 12, wherein the first data list comprises a row of data or a column of data, and the third data list comprises a same number of blank rows or columns as the row of the first data list;
the storing the data to be compared into the corresponding position in the third data list corresponding to the position of the same data in the first data list specifically includes: and storing the data to be compared into the row or the column in the third data list, wherein the row or the column is the same as the row or the column of the same data in the first data list.
14. The data difference comparison method according to claim 13, wherein the collectively storing the remaining data in the second data list specifically comprises: storing the remaining data in the second data list after the third data list.
15. The data difference comparison method according to claim 1 or 12, further comprising: and marking the residual data in the second data list after the first data list.
16. The data difference comparison method according to claim 12, further comprising:
and marking the data in the position in the first data list corresponding to the position of the third data list, in which the data is empty, behind the third data list.
17. The data difference comparison method according to claim 16, wherein the first data list and the third data list include row data or column data, and the labeling the data in the position in the first data list corresponding to the position in the third data list where the data is empty after the third data list specifically includes:
and marking the data in the row or column in the first data list corresponding to the row or column with empty data in the third data list after the third data list.
18. A data difference comparing apparatus for performing difference comparison on data in a first data list and a second data list, the data difference comparing apparatus comprising:
the reading module is used for sequentially reading the data in the second data list as data to be compared;
the comparison module is used for performing traversal comparison on each piece of data to be compared, which is read in sequence, and the data in the first data list;
the execution module is used for storing the data to be compared into a position corresponding to the position of the same data in the first data list when the data which is the same as the data to be compared exists in the first data list, and deleting the data to be compared in the second data list; and
and the storage module is used for intensively storing the residual data in the second data list after all the data in the second data list are compared with the data in the first data list in a traversing way.
19. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-17.
20. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to perform the method of any one of claims 1 to 17.
21. A computer program product comprising a computer program which, when executed by a processor, implements a method according to any one of claims 1 to 17.
CN202110445589.6A 2021-04-23 2021-04-23 Data difference comparison method, device, medium and product Pending CN113051882A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110445589.6A CN113051882A (en) 2021-04-23 2021-04-23 Data difference comparison method, device, medium and product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110445589.6A CN113051882A (en) 2021-04-23 2021-04-23 Data difference comparison method, device, medium and product

Publications (1)

Publication Number Publication Date
CN113051882A true CN113051882A (en) 2021-06-29

Family

ID=76520239

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110445589.6A Pending CN113051882A (en) 2021-04-23 2021-04-23 Data difference comparison method, device, medium and product

Country Status (1)

Country Link
CN (1) CN113051882A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115905273A (en) * 2022-11-10 2023-04-04 贝壳找房(北京)科技有限公司 Data detection method in digital warehouse table, electronic equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115905273A (en) * 2022-11-10 2023-04-04 贝壳找房(北京)科技有限公司 Data detection method in digital warehouse table, electronic equipment and storage medium
CN115905273B (en) * 2022-11-10 2023-09-26 贝壳找房(北京)科技有限公司 Data detection method in digital bin table, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US20170017569A1 (en) Resource management in mapreduce architecture and architectural system
US10275333B2 (en) Risk analysis of codebase using static analysis and performance data
US20210224252A1 (en) Method and device for segmenting list, storage medium and terminal
US20160371814A1 (en) Generating a tree map
CN112395188B (en) Test-oriented software project development method and device, electronic equipment and storage medium
EP3907680A1 (en) Material assignment method and system, and computer device readable storage medium
CN111213126A (en) Asynchronously processing sequential data blocks
CN113051882A (en) Data difference comparison method, device, medium and product
CN107909164B (en) Operation and maintenance processing method, system, electronic equipment and computer readable medium
CN106775970A (en) The window operation synchronous method of striding course, device and electronic equipment
CN111738316A (en) Image classification method and device for zero sample learning and electronic equipment
CN110110320B (en) Automatic contract checking method, device, medium and electronic equipment
CN110635961B (en) Pressure measurement method, device and system of server
CN110569308A (en) Data file assembling method, device, equipment and storage medium
CN108038125B (en) Method, device, equipment and storage medium for automatically comparing fund system test values
CN108696554B (en) Load balancing method and device
CN113233069A (en) Intelligent warehousing ex-warehouse control method and device, electronic equipment and storage medium
CN111612387B (en) Flow direction distribution method, device, equipment and storage medium
CN115511292B (en) Production scheduling method, system, intelligent terminal and storage medium
CN111291959A (en) Resource allocation method, device, equipment and storage medium
US20150135050A1 (en) Form field creation systems and methods
CN111679885B (en) Method, device, medium and electronic equipment for determining virtual machine drift
CN110322531B (en) Automatic marking method, system, equipment and storage medium for flat steel support
CN113326079A (en) Service version switching method, switching device, electronic equipment and storage medium
CN112527276A (en) Data updating method and device in visual programming tool and terminal equipment

Legal Events

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