Data comparison method, device, computer equipment, and storage medium
By performing syntax tree conversion and node processing on the data comparison, fast and effective comparison of multi-party data sources is achieved, and the problem of multi-table query and calculation difficulties caused by data silos is solved.
Patent Information
- Application Number
- CN202210607353.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-31
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2042-05-31
AI Technical Summary
It is difficult for the prior art to quickly and effectively compare data sources of multiple parties, especially in the case of serious data island phenomena, which leads to the inability to conduct multi-table query and calculation across multiple parties.
By converting the data contrast into the first contrast syntax tree and cropping and moving its nodes, the second contrast syntax tree is obtained. Based on the comparison syntax branch tree representing the first data source in the second comparison syntax tree, the data of the first data source is processed to obtain the processing results, and the processing results and the comparison syntax branch tree representing the second data source in the second comparison syntax tree are sent to the target device for data comparison.
It realizes the rapid and effective data comparison of multi-party data sources, so that each participant does not need to expose data, and solves the problem that multi-table query and calculation comparison of data processing tasks containing multi-party data sources is not possible.
Smart Images

Figure CN115114360B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data comparison method, apparatus, computer equipment, storage medium and computer program product. Background Art
[0002] With the development of computer technology and Internet technology, data has become the core asset of enterprises. Protecting data is one of the effective means to protect corporate assets. In the process of analyzing and processing data, it is often necessary to compare data between different institutions to provide more intuitive data analysis results.
[0003] However, in the current data comparison method, it is usually necessary to merge the data sources of different participants, parse and calculate the data after merging, or access multiple original data sources. But in actual scenarios, the data of different institutions are mostly stored and maintained independently, which makes it impossible to centralize the data sources scattered in different institutions, forming a "data island" phenomenon, which easily leads to the inability to perform multi-table queries and calculations across multiple parties. In particular, for data processing tasks involving multiple data sources, it brings great difficulties to data analysis. How to quickly and effectively compare data from multiple data sources has become a problem that needs to be solved urgently. Summary of the invention
[0004] Based on this, it is necessary to provide a data comparison method, device, computer equipment, computer-readable storage medium and computer program product that can quickly and effectively compare data from multiple data sources in order to address the above technical problems.
[0005] In the first aspect, the present application provides a data comparison method. The method includes: converting a data comparison formula into a first comparison syntax tree; pruning and moving the nodes of the first comparison syntax tree to obtain a second comparison syntax tree; based on the comparison syntax branch tree representing the first-party data source in the second comparison syntax tree, processing the data corresponding to the first-party data source to obtain a first processing result; sending the first processing result and the comparison syntax branch tree representing the second-party data source in the second comparison syntax tree to a target device, so that the target device processes the data corresponding to the second-party data source based on the comparison syntax branch tree of the second-party data source, and compares the second processing result obtained by processing with the first processing result to obtain a data comparison result.
[0006] In the second aspect, the present application also provides a data comparison device. The device includes: a conversion module, which is used to convert the data comparison formula into a first comparison syntax tree; a processing module, which is used to perform pruning and item shifting processing on the nodes of the first comparison syntax tree to obtain a second comparison syntax tree; based on the comparison syntax branch tree representing the first-party data source in the second comparison syntax tree, the data corresponding to the first-party data source is processed to obtain a first processing result; a sending module is used to send the first processing result and the comparison syntax branch tree representing the second-party data source in the second comparison syntax tree to a target device, so that the target device processes the data corresponding to the second-party data source based on the comparison syntax branch tree of the second-party data source, and compares the second processing result obtained by processing with the first processing result to obtain a data comparison result.
[0007] In a third aspect, the present application also provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program: converting a data comparison formula into a first comparison syntax tree; performing pruning and item shifting processing on the nodes of the first comparison syntax tree to obtain a second comparison syntax tree; based on the comparison syntax branch tree representing the first-party data source in the second comparison syntax tree, processing the data corresponding to the first-party data source to obtain a first processing result; sending the first processing result and the comparison syntax branch tree representing the second-party data source in the second comparison syntax tree to a target device, so that the target device processes the data corresponding to the second-party data source based on the comparison syntax branch tree of the second-party data source, and compares the second processing result obtained by processing with the first processing result to obtain a data comparison result.
[0008] In a fourth aspect, the present application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented: converting a data comparison formula into a first comparison syntax tree; performing pruning and item shifting processing on the nodes of the first comparison syntax tree to obtain a second comparison syntax tree; processing the data corresponding to the first-party data source based on the comparison syntax branch tree representing the first-party data source in the second comparison syntax tree to obtain a first processing result; sending the first processing result and the comparison syntax branch tree representing the second-party data source in the second comparison syntax tree to a target device, so that the target device processes the data corresponding to the second-party data source based on the comparison syntax branch tree of the second-party data source, and compares the second processing result obtained by processing with the first processing result to obtain a data comparison result.
[0009] In a fifth aspect, the present application also provides a computer program product. The computer program product includes a computer program, which implements the following steps when executed by a processor: converting a data comparison formula into a first comparison syntax tree; pruning and moving the nodes of the first comparison syntax tree to obtain a second comparison syntax tree; based on the comparison syntax branch tree representing the first-party data source in the second comparison syntax tree, processing the data corresponding to the first-party data source to obtain a first processing result; sending the first processing result and the comparison syntax branch tree representing the second-party data source in the second comparison syntax tree to a target device, so that the target device processes the data corresponding to the second-party data source based on the comparison syntax branch tree of the second-party data source, and compares the second processing result obtained by processing with the first processing result to obtain a data comparison result.
[0010] The above-mentioned data comparison method, device, computer equipment, storage medium and computer program product are achieved by converting the data comparison formula into a first comparison syntax tree; pruning and moving the nodes of the first comparison syntax tree to obtain a second comparison syntax tree; based on the comparison syntax branch tree representing the first-party data source in the second comparison syntax tree, processing the data corresponding to the first-party data source to obtain a first processing result; sending the first processing result and the comparison syntax branch tree representing the second-party data source in the second comparison syntax tree to a target device, so that the target device processes the data corresponding to the second-party data source based on the comparison syntax branch tree of the second-party data source, and compares the second processing result obtained by processing with the first processing result to obtain a data comparison result. Since the nodes of the first comparison syntax tree are trimmed and moved, a second comparison syntax tree is obtained. In the second syntax tree, the first-party data source and the second-party data source are separated on both sides of the comparison operator. Therefore, based on the comparison syntax branch tree representing the first-party data source in the second comparison syntax tree, the data corresponding to the first-party data source can be processed to obtain a first processing result, and the first processing result and the comparison syntax branch tree representing the second-party data source in the second comparison syntax tree are sent to the target device, so that the target device processes the data corresponding to the second-party data source based on the comparison syntax branch tree of the second-party data source, and compares the second processing result obtained by processing with the first processing result to obtain a data comparison result, thereby enabling fast and effective data comparison of multiple data sources, so that each participant does not need to expose the data to other participants, thereby solving the problem of being unable to perform multi-table query and calculation comparison on data processing tasks involving multiple data sources. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 An application environment diagram of a data comparison method in an embodiment;
[0012] Figure 2A schematic diagram of a data comparison method in one embodiment;
[0013] Figure 3 A schematic diagram of a tree structure syntax tree in one embodiment;
[0014] Figure 4 A schematic diagram of a process of pruning and moving nodes of a first comparison syntax tree to obtain a second comparison syntax tree in an embodiment;
[0015] Figure 5 A schematic diagram of a data structure for storing a syntax tree in one embodiment;
[0016] Figure 6 It is a flowchart of the steps of pruning and moving the operator nodes and the data source nodes in the first comparison syntax tree respectively in one embodiment;
[0017] Figure 7 It is a schematic diagram of a process of pruning and moving nodes of a first comparison syntax tree in one embodiment;
[0018] Figure 8 is a schematic diagram of a first value column and a second value column in one embodiment;
[0019] Fig. 9 A flowchart of pruning and moving items of a syntax tree in one embodiment;
[0020] Fig.10 is a structural block diagram of a data comparison device in an embodiment;
[0021] Fig.11 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0023] The data comparison method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the first-party device 102 communicates with the target device 104 through the network. The data storage system can store the data that the target device 104 needs to process. The data storage system can be integrated on the target device 104, or it can be placed on the cloud or other servers. The first-party device 102 converts the data comparison formula into a first comparison syntax tree, and prunes and moves the nodes of the first comparison syntax tree to obtain a second comparison syntax tree; the first-party device 102 processes the data corresponding to the first-party data source based on the comparison syntax branch tree representing the first-party data source in the second comparison syntax tree to obtain a first processing result, and sends the first processing result and the comparison syntax branch tree representing the second-party data source in the second comparison syntax tree to the target device 104, so that the target device 104 processes the data corresponding to the second-party data source based on the comparison syntax branch tree of the second-party data source, and compares the second processing result obtained by processing with the first processing result to obtain a data comparison result. Among them, the data comparison formula in this application, that is, the data source, can be from the fields of cloud technology, big data processing technology of map data sources, and artificial intelligence technology.
[0024] The first-party device 102 and the target device 104 may be, but are not limited to, various desktop computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The target device 104 may also be implemented using an independent server or a server cluster consisting of multiple servers.
[0025] It can be understood that the target device 104 provided in the embodiment of the present application can also be a service node in the blockchain system. The service nodes in the blockchain system form a peer-to-peer (P2P) network. The P2P protocol is an application layer protocol running on the Transmission Control Protocol (TCP) protocol.
[0026] Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool, which can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The backend services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites and more portal websites. With the rapid development and application of the Internet industry, in the future, each item may have its own identification mark, which needs to be transmitted to the backend system for logical processing. Data of different levels will be processed separately. All kinds of industry data need strong system backing support, which can only be achieved through cloud computing.
[0027] Cloud computing is a computing model that distributes computing tasks on a resource pool composed of a large number of computers, so that various application systems can obtain computing power, storage space and information services as needed. The network that provides resources is called a "cloud". From the user's point of view, the resources in the "cloud" can be infinitely expanded, and can be obtained at any time, used on demand, expanded at any time, and paid for by use. As a basic capability provider for cloud computing, a cloud computing resource pool (referred to as a cloud platform, generally referred to as an IaaS (Infrastructure as a Service) platform) will be established, and various types of virtual resources will be deployed in the resource pool for external customers to choose to use. The cloud computing resource pool mainly includes: computing devices (virtualized machines, including operating systems), storage devices, and network devices.
[0028] With the research and advancement of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, automatic driving, drones, robots, smart medical care, smart customer service, Internet of Vehicles, automatic driving, smart transportation, etc. I believe that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0029] In one embodiment, Figure 2 As shown, a data comparison method is provided, which is applied to Figure 1 The first-party device in the example is used to illustrate, including the following steps:
[0030] Step 202: convert the data comparison formula into a first comparison syntax tree.
[0031] Among them, the data comparison formula refers to an expression containing a comparison operator and a data source, and the comparison operator means that the following operators can be used to compare two values. When an operator is used to compare two values, the result is a logical value, which is either a TRUE (true) or a FALSE (false) operator. Among them, the comparison operator may include an equal sign, a greater than sign, a less than sign, a greater than or equal to sign, a less than or equal to sign, and an inequality sign, etc. The data comparison formula in this application may be a federated expression, and a federated expression refers to an expression containing multiple data sources. For example, the data comparison expression is: a.col*5+b.col>10, where a.col indicates that the data source comes from Party A, and b.col indicates that the data source comes from Party B, and Party A and Party B are different parties.
[0032] The first comparison syntax tree refers to a syntax tree obtained by parsing an original data comparison expression into a tree-structured syntax tree. For example, the original data comparison expression a.num+b.num<5 is parsed into a comparison syntax tree with a tree-structured syntax tree.
[0033] Specifically, in the joint data analysis scenario, the calculation or comparison of complex expressions is often involved. For example, in a user-defined function (UDF), the original data needs to undergo certain mathematical transformations and then be grouped and aggregated. When a user initiates a federated task through a trigger operation, the first-party device responds to the user's trigger operation and converts the data comparison formula in the federated task according to the preset parsing rules to obtain a first comparison syntax tree corresponding to the data comparison formula.
[0034] For example, Figure 3 As shown in the figure, it is a schematic diagram of a tree structure syntax tree. Assume that there are two participants in a federated task: A and B, where A is the initiator as the first party and B is the participant as the second party. That is, A needs to calculate an SQL statement expression, which contains a data comparison formula f1. Assuming that the data comparison formula f1 is a.num+b.num<5, the initiator A, i.e. the first party device, can parse the data comparison formula f1 as follows: Figure 3 It can be understood that the structure of converting the data comparison formula into the first comparison syntax tree in the embodiment of the present application includes but is not limited to the following: Figure 3 The tree structure shown may also be other forms of tree structures, which are not specifically limited here.
[0035] Step 204: prune and move the nodes of the first comparison syntax tree to obtain a second comparison syntax tree.
[0036] The node refers to various types of nodes included in the first comparison syntax tree. For example, the nodes of the first comparison syntax tree may include operator nodes and data source nodes. The operator node refers to a node used to represent an operator, and the data source node refers to a node used to represent a data source. For example, Figure 3 The operator nodes shown in include "+" and "<". Figure 3 The data source nodes shown in include "a.num" and "b.num".
[0037] The trimming and moving process refers to trimming and moving the nodes in the first syntax tree. For example, trimming the node A in a branch A in the first comparison syntax tree is a trimming operation, and then moving the trimmed node A to branch B is a moving operation. The syntax tree with a new tree structure formed is the second comparison syntax tree. Branch B of the second comparison syntax tree contains node A, and branch A does not contain node A. Branch B in the first syntax tree does not contain node A, and branch A contains node A.
[0038] The second comparison syntax tree refers to the syntax tree obtained after pruning and moving the first comparison syntax tree, which is the second comparison syntax tree. For example, after pruning the nodes in a branch of the first comparison syntax tree and moving them to another branch, the syntax tree with a new tree structure is the second comparison syntax tree, that is, the tree structures in the first comparison syntax tree and the second comparison syntax tree are different.
[0039] Specifically, after the first-party device converts the data comparison formula into a first comparison syntax tree, the first-party device can traverse the first comparison syntax tree from bottom to top to determine whether the data source to be compared in the first comparison syntax tree is a multi-party data source, that is, determine whether the data source to be compared in the first comparison syntax tree spans multiple parties. When the first-party device determines that the data source to be compared in the first comparison syntax tree includes at least two data sources, the first-party device can trim and move the nodes of the first comparison syntax tree based on various linear transformation methods and rule items defined on the first comparison syntax tree to obtain a second comparison syntax tree.
[0040] For example, the data comparison formula f1 is a.num+b.num<5. Figure 4 As shown in FIG. 1 , the process diagram of pruning and moving the nodes of the first comparison syntax tree to obtain the second comparison syntax tree is shown in FIG. Figure 4 After the first syntax tree of the tree structure shown in (1), the first-party device can Figure 4 The first comparison syntax tree shown in (1) is traversed from bottom to top to determine whether the data source to be compared in the first comparison syntax tree is a multi-party data source. Figure 4 The branch tree on the left of the comparison operator “<” shown in (1) contains the node “a.num” representing the data source of party A and the node “b.num” representing the data source of party B. Therefore, the first-party device traverses Figure 4 After the first comparison syntax tree shown in (1) is compared, it can be determined that the data source to be compared in the first comparison syntax tree spans multiple parties, that is, the first-party device determines that the data source to be compared in the first comparison syntax tree includes the party A data source and the party B data source. Then, the first-party device can perform pruning and item movement processing on the node "b.num" representing the party B data source contained in the left branch tree of the first comparison syntax tree based on the linear transformation method and rule items defined on the first comparison syntax tree. Figure 4 As shown in (2), the first-party device cuts the operator node "+" and the data source node "b.num" from the original left branch tree, transforms the operator node "+" into "-", and then moves the operator node "-" and the data source node "b.num" to the right branch tree of the comparison operator "<". After splicing, the move operation is completed, and the result is as follows: Figure 4 The second comparison syntax tree shown in (3).
[0041] Step 206: Based on the comparison syntax branch tree representing the first-party data source in the second comparison syntax tree, the data corresponding to the first-party data source is processed to obtain a first processing result.
[0042] The comparison grammar branch tree refers to a branch in the comparison grammar tree, for example, Figure 3 The comparison syntax tree shown includes a comparison syntax branch tree on the left and another comparison syntax branch tree on the right.
[0043] The first processing result refers to the result obtained after processing the data corresponding to the first-party data source. For example, the first-party data source is a.num, and the data corresponding to the first-party data source a.num is the a.num field, that is, Party A holds the a.num field, and the a.num field can be a set of data stored in Party A's local database.
[0044] Specifically, the first-party device prunes and moves the nodes of the first comparison syntax tree to obtain the second comparison syntax tree. The first-party device can then prune the comparison syntax branch tree representing the first-party data source in the second comparison syntax tree and restore it to a first expression in string form. The first-party device can then generate a corresponding first code segment based on the first expression and scan the corresponding input data in the local database. The first-party device calculates the first code segment based on the input data to obtain a calculated value column, and uses the calculated value column as the first processing result.
[0045] For example, taking the data comparison formula f1 as a.num+b.num<5 as an example, the first-party device performs pruning and item shifting processing on the nodes of the first comparison syntax tree to obtain the following: Figure 4 After the second comparison syntax tree shown in (3) in FIG. 1 , the first-party device may Figure 4 The left branch tree and the right branch tree of the comparison operator "<" in the second comparison syntax tree shown in (3) are cut off respectively and restored to string form to obtain the first expression a.num and the second expression 5-b.num. Further, the first-party device can obtain the first expression a.num containing its own data source, and generate expression code for the obtained first expression a.num to obtain the corresponding first code segment. The first-party device can scan its own table to obtain the input data of the first code segment. After calculating the first code segment based on the input data, the value column corresponding to the first expression a.num can be obtained, and the obtained value column is used as the first processing result.
[0046] Step 208, the first processing result and the comparison grammar branch tree representing the second-party data source in the second comparison grammar tree are sent to the target device, so that the target device processes the data corresponding to the second-party data source based on the comparison grammar branch tree of the second-party data source, and compares the second processing result obtained by processing with the first processing result to obtain a data comparison result.
[0047] Among them, the target device refers to the device corresponding to the second-party data source. Since the second comparison syntax tree contains a comparison syntax branch tree representing the second-party data source, the comparison syntax branch tree representing the second-party data source needs to be sent to the device corresponding to the second-party data source. For example, the data corresponding to the second-party data source is stored in device B or the data corresponding to the second-party data source is stored in the local database of device B.
[0048] The second processing result refers to the result obtained after processing the data corresponding to the second-party data source. For example, the second-party data source is b.num, and the data corresponding to the second-party data source b.num is the b.num field, that is, Party B holds the b.num field, and the b.num field can be a set of data stored in Party B's local database.
[0049] The data comparison result refers to a result obtained by comparing the second processing result with the first processing result. For example, after comparing the first processing result enc(x) with the second processing result enc(y), the comparison result obtained is enc(x)-enc(y)=1.
[0050] Specifically, after the first-party device cuts out the comparison grammar branch tree representing the first-party data source and the comparison grammar branch tree representing the second-party data source in the second comparison grammar tree respectively, and restores them to the first expression and the second expression in the form of strings, the first-party device can process the data corresponding to the first-party data source based on the first expression to obtain a first processing result, and send the first processing result and the second expression to the target device, so that the target device processes the data corresponding to the second-party data source based on the second expression, and compares the processed second processing result with the first processing result to obtain a data comparison result.
[0051] For example, taking the data comparison formula f1 as a.num+b.num<5 as an example, the first-party device performs pruning and item shifting processing on the nodes of the first comparison syntax tree to obtain the following: Figure 4 After the second comparison syntax tree shown in (3) in FIG. 1 , the first-party device may Figure 4 The left branch tree and the right branch tree of the comparison operator "<" in the second comparison syntax tree shown in (3) are respectively cut off and restored to the string form to obtain the first expression a.num and the second expression 5-b.num. Further, the first-party device can obtain the first expression a.num containing its own data source, and based on the first expression a.num, process the data corresponding to its own data source, and obtain the value column enc(x) corresponding to the first expression a.num, and send the obtained value column enc(x) as the first processing result and the second expression 5-b.num to the second-party device, so that the second-party device processes the data corresponding to the second-party data source based on the second expression 5-b.num, and compares the second processing result enc(y) obtained by processing with the first processing result enc(x), and obtains the data comparison result enc(x)-enc(y)=1.
[0052] Furthermore, the first-party device may match the above-obtained data comparison result enc(x)-enc(y)=1 with the form of the original expression to obtain a final result that matches the original expression, that is, the first-party device converts the above-mentioned data comparison result enc(x)-enc(y)=1 into a.num-(5-b.num)=1, that is, a.num+b.num<5. Therefore, the final comparison result of the original expression a.num+b.num<5 is 1, which indicates true.
[0053] In this embodiment, the data comparison formula is converted into a first comparison syntax tree; the nodes of the first comparison syntax tree are trimmed and moved to obtain a second comparison syntax tree; based on the comparison syntax branch tree representing the first-party data source in the second comparison syntax tree, the data corresponding to the first-party data source is processed to obtain a first processing result; the first processing result and the comparison syntax branch tree representing the second-party data source in the second comparison syntax tree are sent to a target device, so that the target device processes the data corresponding to the second-party data source based on the comparison syntax branch tree of the second-party data source, and compares the second processing result obtained by processing with the first processing result to obtain a data comparison result. Since the nodes of the first comparison syntax tree are trimmed and moved, a second comparison syntax tree is obtained. In the second syntax tree, the first-party data source and the second-party data source are separated on both sides of the comparison operator. Therefore, based on the comparison syntax branch tree representing the first-party data source in the second comparison syntax tree, the data corresponding to the first-party data source can be processed to obtain a first processing result, and the first processing result and the comparison syntax branch tree representing the second-party data source in the second comparison syntax tree are sent to the target device, so that the target device processes the data corresponding to the second-party data source based on the comparison syntax branch tree of the second-party data source, and compares the second processing result obtained by processing with the first processing result to obtain a data comparison result, thereby enabling fast and effective data comparison of multiple data sources, so that each participant does not need to expose the data to other participants, thereby solving the problem of being unable to perform multi-table query and calculation comparison on data processing tasks involving multiple data sources.
[0054] In one embodiment, after converting the data comparison formula into a first comparison syntax tree, the method further includes:
[0055] Traversing the comparison syntax branch tree in the first comparison syntax tree to obtain a first traversal result;
[0056] When it is determined based on the first traversal result that the comparison syntax branch tree in the first comparison syntax tree corresponds to the data sources of different participants, the step of pruning and moving the nodes of the first comparison syntax tree is performed to obtain a second comparison syntax tree.
[0057] The traversal result refers to the traversal result obtained after traversing all nodes in the first comparison syntax tree. For example, when it is detected that the data sources corresponding to the various comparison syntax branch trees in the first comparison syntax tree are all A-party data sources, the traversal result is a unilateral data source. The first traversal result refers to the traversal result obtained after traversing all nodes in the first comparison syntax tree for the first time, which is the first traversal result.
[0058] The data sources of different parties refer to data sources coming from different parties. For example, it is detected that the data source corresponding to a certain comparison grammar branch tree in the first comparison grammar tree is the data source of party A, and the data source corresponding to another comparison grammar branch tree is the data source of party B, that is, the data sources of different parties.
[0059] Specifically, after the first-party device converts the data comparison formula into a first comparison syntax tree, the first-party device can traverse the comparison syntax branch tree in the first comparison syntax tree to obtain a first traversal result; that is, when the first-party device traverses each comparison syntax branch tree in the first comparison syntax tree, if the first-party device detects that the data sources of each comparison syntax branch tree in the first comparison syntax tree are all from the first party, the data source of the first comparison syntax tree is marked as the first-party data source, and the traversal result is the first-party data source; if the data sources of each comparison syntax branch tree in the first comparison syntax tree detected by the first-party device are all from the second party, the data source of the first comparison syntax tree is marked as the second-party data source, and the traversal result is the second-party data source; if the data sources of each comparison syntax branch tree in the first comparison syntax tree detected by the first-party device are from the first party and the second party, the data source of the first comparison syntax tree is marked as a multi-party data source, and the traversal result is a multi-party data source.
[0060] Further, when the first-party device determines based on the first traversal result that the comparison grammar branch trees in the first comparison grammar tree correspond to data sources of different participants, that is, when the first-party device determines based on the first traversal result that the data sources corresponding to each comparison grammar branch tree in the first comparison grammar tree are multi-party data sources, the first-party device performs a step of pruning and moving the nodes of the first comparison grammar tree to obtain a second comparison grammar tree.
[0061] For example, taking the data comparison formula f1 as a.num+b.num<5 as an example, the first-party device can convert the data comparison formula f1 into Figure 3 The first comparison of the tree structure shown in the syntax tree, Figure 3 The first comparison syntax tree shown in includes a left comparison syntax branch tree on the left and a right comparison syntax branch tree on the right. The first-party device can compare Figure 3 The first comparison syntax tree of the tree structure shown in traverses to determine whether the data source included in the first comparison syntax tree spans multiple participants. Figure 3 The left comparison syntax branch tree on the left side of the figure contains data sources of two different parties, "a.num" and "b.num". Therefore, the first-party device Figure 3After traversing the first comparison syntax tree of the tree structure shown in , the first traversal result is obtained as a multi-party data source. Since the data source in the first comparison syntax tree spans multiple participants, it is necessary to execute the step of transforming the nodes of the first comparison syntax tree to obtain the transformed second comparison syntax tree. Therefore, by traversing the comparison syntax branch tree in the first comparison syntax tree, it is possible to quickly and accurately determine whether the data source corresponding to the comparison syntax branch tree in the first comparison syntax tree is a multi-party data source. When a multi-party data source is included, the corresponding steps are executed according to the processing flow of the multi-party data source, so that the expression calculation and comparison process is more accurate and efficient.
[0062] In one embodiment, the method further comprises:
[0063] When it is determined based on the first traversal result that the comparison syntax branch tree in the first comparison syntax tree corresponds to the data source of the same participant, the data corresponding to the data source of the participant is compared according to the comparison syntax branch tree in the first comparison syntax tree to obtain a comparison result.
[0064] The data sources of the same party refer to data sources coming from the same party. For example, if it is detected that the data source corresponding to a certain comparison syntax branch tree in the first comparison syntax tree is the data source of party A and the data source corresponding to another comparison syntax branch tree is also the data source of party A, then they are the data sources of the same party. The data sources of the same party may include data sources all coming from one's own data source or data sources all coming from another party's data source.
[0065] Specifically, after the first-party device converts the data comparison formula into a first comparison syntax tree, the first-party device can traverse the comparison syntax branch tree in the first comparison syntax tree to obtain a first traversal result, wherein the first traversal result includes a first-party data source, a second-party data source, and multiple data sources. Further, when the first-party device determines based on the first traversal result that each comparison syntax branch tree in the first comparison syntax tree corresponds to a data source of the same participant, and the data source is its own data source, i.e., the first-party data source, the first-party device can compare the data corresponding to the first-party data source based on each comparison syntax branch tree in the first comparison syntax tree to obtain a comparison result. In addition, when the first-party device determines based on the first traversal result that each comparison syntax branch tree in the first comparison syntax tree corresponds to a data source of the same participant, and the data source is the other party's data source, i.e., the second-party data source, the first-party device returns to and no longer processes this syntax tree.
[0066] For example, take the data comparison formula f1 as a.num+a.num<5 as an example. After the first-party device converts the data comparison formula f1 into a first comparison syntax tree, the first-party device can traverse the comparison syntax branch tree in the first comparison syntax tree to obtain a first traversal result as the first-party data source; further, if the first-party device determines based on the first traversal result that each comparison syntax branch tree in the first comparison syntax tree corresponds to the data source of the same participant, and the data source is its own data source, that is, the first-party data source, then the first-party device can compare and process the corresponding data in the local database of the first-party data source based on each comparison syntax branch tree in the first comparison syntax tree, and the comparison result obtained is 1, indicating true. If the first-party device determines based on the first traversal result that each comparison syntax branch tree in the first comparison syntax tree corresponds to the data source of the same participant, and the data source is the other party's data source, that is, the second-party data source, then the first-party device returns to and no longer processes this syntax tree. Therefore, by traversing the comparison syntax branch tree in the first comparison syntax tree, it is possible to quickly and accurately determine whether the data source corresponding to the comparison syntax branch tree in the first comparison syntax tree is a multi-party data source. When it is a unilateral data source, the corresponding steps are executed according to the processing flow of the unilateral data source, making the expression calculation and comparison process more accurate and efficient.
[0067] In one embodiment, the method further comprises:
[0068] Constructing a data structure for the first comparison syntax tree to obtain a first comparison syntax tree including an operator node and a data source node;
[0069] The pruning and moving of the nodes of the first comparison syntax tree includes:
[0070] The operator nodes and the data source nodes in the first comparison syntax tree are pruned and moved respectively.
[0071] Specifically, Figure 5 The first party device may construct the first comparison syntax tree as shown in FIG. Figure 5 The data structure shown obtains a first comparison syntax tree including operator nodes and data source nodes. When the first-party device determines that the comparison syntax branch tree in the first comparison syntax tree corresponds to the data sources of different participants, the operator nodes and data source nodes in the first comparison syntax tree are pruned and moved respectively.
[0072] For example, the data comparison formula f1 is a.num+b.num<5. The first-party device parses the data comparison formula f1 as follows: Figure 4 The first syntax tree of the tree structure shown in (1) is Figure 4The first comparison syntax tree shown in (1) constructs a corresponding data structure to obtain a first comparison syntax tree including operator nodes and data source nodes. Figure 4 The operator nodes are "<" and "+", and the data source nodes are "a.num" and "b.num", then the first-party device can Figure 4 The first comparison syntax tree shown in (1) is traversed from bottom to top to determine whether the data source to be compared in the first comparison syntax tree is a multi-party data source. Figure 4 The branch tree on the left of the comparison operator “<” shown in (1) contains the node “a.num” representing the data source of party A and the node “b.num” representing the data source of party B. Therefore, the first-party device traverses Figure 4 After the first comparison syntax tree shown in (1) is compared, it can be determined that the data source to be compared in the first comparison syntax tree spans multiple parties, that is, the first-party device determines that the data source to be compared in the first comparison syntax tree includes the data source of party A and the data source of party B. Then, the first-party device can perform trimming and item shifting processing on the data source node "b.num" and the operator node "+" representing the data source of party B contained in the left branch tree of the first comparison syntax tree based on the item shifting rule defined in the data structure of the first comparison syntax tree. Figure 4 As shown in (2), after completing the shift operation, we can get Figure 4 The second comparison syntax tree shown in (3).
[0073] In this embodiment, by constructing corresponding data structures for different comparison syntax trees, item movement rules in different comparison syntax trees can be defined, so that the first syntax tree can be transformed based on the rule items defined in the data structures of each comparison syntax tree to obtain a more accurate transformed syntax tree.
[0074] In one embodiment, Figure 6 As shown, the comparison syntax branch tree in the first comparison syntax tree includes a first comparison syntax branch tree and a second comparison syntax branch tree; the steps of pruning and moving the operator nodes and the data source nodes in the first comparison syntax tree respectively include:
[0075] Step 602: When the first comparison syntax branch tree includes a first-party data source node and a second-party data source node, the second-party data source node and the corresponding operator node are pruned from the first comparison syntax tree;
[0076] Step 604, performing symbol transformation on the pruned operator node to obtain a transformed operator node;
[0077] Step 606, moving the transformed operator node and the second-party data source node to the second comparison syntax branch tree of the first comparison syntax tree;
[0078] Step 608: In the first comparison grammar branch tree after the term is moved, the pruned operator node is connected to the adjacent nodes at the original position thereof by using a connecting line.
[0079] Among them, the first comparison grammar branch tree and the second comparison grammar branch tree are used to distinguish different comparison grammar branch trees in the first comparison grammar tree. For example, the first comparison grammar branch tree can be a left comparison grammar branch tree located on the left side of the comparison operator, and the second comparison grammar branch tree can be a right comparison grammar branch tree located on the right side of the comparison operator.
[0080] Specifically, when the first-party device detects that the first comparison grammar branch tree contains a first-party data source node and a second-party data source node, the first-party device clips the second-party data source node and the corresponding operator node from the first comparison grammar tree, and performs symbol transformation on the clipped operator node to obtain a transformed operator node; further, the first-party device may transpose the transformed operator node and the second-party data source node to the second comparison grammar branch tree of the first comparison grammar tree, and in the first comparison grammar branch tree after transposition, the first-party device connects the clipped operator node to the adjacent nodes at the original position using connecting lines.
[0081] For example, the data comparison formula f1 is a.num+b.num<5. The first-party device parses the data comparison formula f1 as follows: Figure 4 After the first syntax tree of the tree structure shown in (1), the first-party device can Figure 4 The first comparison syntax tree shown in (1) is traversed from bottom to top to determine whether the data source to be compared in the first comparison syntax tree is a multi-party data source. When the first-party device detects that the first comparison syntax branch tree is Figure 4 When the left branch tree of the comparison operator “<” shown in (1) contains the first-party data source node “a.num” and the second-party data source node “b.num”, the first-party device cuts the second-party data source node “b.num” and the corresponding operator node “+” from the left branch tree, that is, the first-party device cuts the operator node “+” and the data source node “b.num” from the original left branch tree, and transforms the cut operator node “+” into “-”, and then moves the transformed operator node “-” and the data source node “b.num” to the right branch tree of the comparison operator “<”. After splicing, the move operation is completed. At the same time, in the left branch tree after the move, the first-party device uses a connecting line to connect the original position of the cut operator node with the adjacent nodes, and the result is as follows. Figure 4The second comparison syntax tree shown in (3). Thus, by constructing corresponding data structures for different comparison syntax trees, item movement rules in different comparison syntax trees can be defined, so that the first syntax tree can be transformed based on the rule items defined in the data structures of each comparison syntax tree to obtain a more accurate transformed syntax tree.
[0082] In one embodiment, the first comparison syntax tree includes at least one level of second-party data source nodes, and the pruned second-party data source nodes are data source nodes of the target level; after the pruned operator nodes are connected to adjacent nodes at their original locations using connecting lines, the method further includes:
[0083] Traverse the first comparison grammar branch tree after the item is moved to obtain a second traversal result;
[0084] Based on the second traversal result, when it is determined that the first comparison syntax branch tree after the shift does not contain the second party data source nodes of other levels, the traversal is stopped to obtain the second comparison syntax tree.
[0085] Among them, the target level refers to the level where the pruned data source is located. For example, assuming that the left branch tree of the first comparison syntax tree contains two levels of second-party data sources, namely the second-party data source of the first level and the second-party data source of the second level, then according to the preset various linear transformation methods and rule items, the second-party data source of the first level is pruned and moved, and the second-party data source of the second level has not been processed. At this time, the target level refers to the first level, and the second level refers to other levels.
[0086] The second traversal result is used to distinguish from the first traversal result, and refers to the traversal result obtained after traversing all nodes in the first comparison syntax tree again after moving the item, which is the second traversal result.
[0087] Specifically, when the first-party device detects that the first comparison grammar branch tree contains a first-party data source node and a second-party data source node, the first-party device clips the second-party data source node and the corresponding operator node from the first comparison grammar tree, and performs symbol transformation on the clipped operator node to obtain a transformed operator node; further, the first-party device can move the transformed operator node and the second-party data source node to the second comparison grammar branch tree of the first comparison grammar tree. In the first comparison grammar branch tree after the move, the first-party device connects the clipped operator node with the adjacent node using a connecting line at the original position of the original position, and then the first-party device re-traverses the first comparison grammar branch tree after the move to obtain a second traversal result. The second traversal result may include the first-party data source, the second-party data source, and multiple data sources; when the first-party device determines based on the second traversal result that the first comparison grammar branch tree after the move does not contain the second-party data source node of other levels, the traversal is stopped, that is, the first-party data source and the second-party data source are separated on both sides of the comparison operator in the second grammar tree. When the first-party device detects that the first comparison grammar branch tree only contains the first-party data source, the traversal is stopped to obtain the second comparison grammar tree.
[0088] For example, the data comparison formula f1 is a.num+b.num<5. When the first-party device detects the first comparison grammar branch tree, Figure 4 When the left branch tree of the comparison operator “<” shown in (1) contains the first-party data source node “a.num” and the second-party data source node “b.num”, the first-party device cuts the second-party data source node “b.num” and the corresponding operator node “+” from the left branch tree, and transforms the cut operator node “+” into “-”, and then moves the transformed operator node “-” and the data source node “b.num” to the right branch tree of the comparison operator “<”. After splicing, the move operation can be completed. At the same time, in the left branch tree after the move, the first-party device uses a connecting line to connect the original position of the cut operator node with the adjacent node, and the first-party device can perform the following operations. Figure 4 The left branch tree after the item is moved as shown in (3) is traversed again, and the second traversal result is the first-party data source. Since the left branch tree after the item is moved only contains the first-party data source, the first-party device can determine based on the second traversal result that the first comparison grammar branch tree after the item is moved does not contain the second-party data source nodes of other levels, and stop traversing, that is, the following is obtained. Figure 4 The second comparison syntax tree shown in (3) in FIG. Thus, the first syntax tree can be transformed based on the rule items defined in the data structure of each comparison syntax tree until the first-party data source and the second-party data source are separated on both sides of the comparison operator, so that the transformed syntax tree is more accurate.
[0089] In one embodiment, after traversing the first comparison grammar branch tree after the shifted term to obtain a second traversal result, the method further includes:
[0090] When it is determined based on the second traversal result that the first comparison grammar branch tree after the term shifting contains second-party data source nodes of other levels, the second-party data source nodes of other levels and the corresponding operator nodes are trimmed from the first comparison grammar branch tree;
[0091] Performing symbol transformation on the pruned operator node to obtain a transformed operator node;
[0092] Move the transformed operator nodes and the second-party data source nodes at other levels to the second comparison syntax branch tree of the first comparison syntax tree;
[0093] In the first comparison grammar branch tree after the term is moved, the pruned operator node is connected to the adjacent nodes at the original position thereof by using a connecting line.
[0094] Specifically, the first-party device moves the transformed operator node and the second-party data source node to the second comparison grammar branch tree of the first comparison grammar tree. In the first comparison grammar branch tree after the move, the first-party device connects the original position of the pruned operator node with the adjacent nodes using connecting lines, and then the first-party device re-traverses the first comparison grammar branch tree after the move to obtain a second traversal result, and the second traversal result may include the first-party data source, the second-party data source, and the multi-party data sources; when the first-party device determines based on the second traversal result that the first comparison grammar branch tree after the move contains the second-party data source nodes of other levels, the first-party device prunes the second-party data source nodes and the corresponding operator nodes of other levels from the first comparison grammar branch tree, and performs symbol transformation on the pruned operator nodes to obtain the transformed operator nodes; further, the first-party device moves the transformed operator node and the second-party data source nodes of other levels to the second comparison grammar branch tree of the first comparison grammar tree. In the first comparison grammar branch tree after the move, the first-party device connects the original position of the pruned operator node with the adjacent nodes using connecting lines.
[0095] For example, the data comparison formula f3 is a.num*b.num+b.num<5. Figure 7 As shown, it is a schematic diagram of the process of pruning and moving the nodes of the first comparison syntax tree. Figure 7When the left branch tree of the comparison operator “<” shown in (1) contains the first-party data source node “a.num” and the second-party data source node “b.num”, the first-party device cuts the second-party data source node “b.num” and the corresponding operator node “+” in the first level from the left branch tree, and transforms the cut operator node “+” into “-”, and then moves the transformed operator node “-” and the data source node “b.num” to the right branch tree of the comparison operator “<”. After splicing, the move operation can be completed. At the same time, in the left branch tree after the move, the first-party device uses a connecting line to connect the original position of the cut operator node with the adjacent node, and the first-party device can perform the following operations. Figure 7 The left branch tree after the shift shown in (3) is traversed again, and the second traversal result is obtained as multiple data sources. Since the left branch tree after the shift still contains the first-party data source and the second-party data source, when the first-party device determines based on the second traversal result that the first comparison grammar branch tree after the shift contains second-party data source nodes of other levels, the first-party device cuts the second-party data source nodes "b.num" and the corresponding operator nodes "*" of other levels from the first comparison grammar branch tree, and transforms the cut operator node "*" to "÷", and then moves the transformed operator node "÷" and the data source node "b.num" to the right branch tree of the comparison operator "<". After splicing, the shift operation is completed. At the same time, the first-party device uses connecting lines to connect the adjacent nodes at the original position of the cut operator node in the left branch tree after the shift to obtain the final second comparison grammar tree. As a result, the first syntax tree can be transformed based on the rule items defined in the data structure of each comparison syntax tree, until the transformation is stopped when the first-party data source and the second-party data source are separated on both sides of the comparison operator, so that the transformed syntax tree is more accurate.
[0096] In one embodiment, based on the comparison syntax branch tree representing the first-party data source in the second comparison syntax tree, the step of processing the data corresponding to the first-party data source to obtain the first processing result includes:
[0097] Converting a comparison syntax branch tree representing a first-party data source into a first expression in string form;
[0098] The data corresponding to the first-party data source is processed based on the first expression to obtain a first processing result.
[0099] The first processing result is calculated based on the first expression and input data, and the first data processing result may be a value column.
[0100] Specifically, the first-party device can convert the comparison syntax branch tree representing the first-party data source in the second comparison syntax tree into a first expression in string form, and generate a corresponding first code segment based on the first expression, scan the data table in the local database according to the grouping column structure, obtain the corresponding grouped data, and use the grouped data as input data to calculate the first code segment to obtain the corresponding first processing result.
[0101] For example, Figure 8 As shown in FIG. 1 , it is a schematic diagram of the first value column and the second value column. Take the data comparison formula f1 as a.num+b.num<5 as an example. Assume that the "a table" held by Party A, i.e. the first party, contains the a.num field. Figure 8 The first-party device obtains the table "a" shown in (1) as follows: Figure 4 After the second comparison syntax tree shown in (3) is obtained, the first-party device can convert the left branch tree representing the first-party data source in the second comparison syntax tree into a first expression in string form as a.num, and generate a corresponding first code segment AA1 based on the first expression a.num. The first-party device scans the local database according to the grouping column structure. Figure 8 The data table "a table" shown in (1) is used to obtain the corresponding grouped data, and the grouped data is used as input data to calculate the first code segment AA1, and the corresponding first processing result is as follows: Figure 8 The first value column A1 in the "a table" shown in (2), that is, the first value column A1 contains {3, 1, 2, 4, 7}.
[0102] In this embodiment, during the calculation process of the expression, the parsing of the expression calculation is skipped, and the expression is directly precompiled as a whole into a code segment. In this way, in subsequent repeated calculations, there is no need to parse and compile the expression multiple times, and the compiled code segment can be directly used for calculation, which greatly improves the code execution speed, thereby effectively improving the calculation and iteration rate, making the comparison process execution of SQL statements more efficient.
[0103] In one embodiment, the step of sending the first processing result and the comparison grammar branch tree representing the second-party data source in the second comparison grammar tree to the target device so that the target device processes the data corresponding to the second-party data source based on the comparison grammar branch tree of the second-party data source, and comparing the second processing result obtained by the processing with the first processing result includes:
[0104] Converting the comparison syntax branch tree representing the second-party data source into a second expression in string form;
[0105] The first processing result and the second expression are sent to the target device, so that the target device processes the data corresponding to the second data source based on the second expression, and compares the second processing result obtained by processing with the first processing result.
[0106] The second processing result is calculated based on the second expression and the input data, and the second data processing result may be a value column.
[0107] Specifically, the first-party device can convert the comparison syntax branch tree representing the second-party data source in the second comparison syntax tree into a second expression in the form of a string, and send the first processing result and the second expression to the target device, so that the target device processes the data corresponding to the second-party data source based on the second expression, and compares the second processing result obtained by processing with the first processing result.
[0108] For example, Figure 8 As shown in FIG. 1 , it is a schematic diagram of the first value column and the second value column. Take the data comparison formula f1 as a.num+b.num<5 as an example. Assume that the "b table" held by Party B, i.e. the second party, contains the b.num field, such as Figure 8 The first-party device obtains the "b table" shown in (1) as follows: Figure 4 After the second comparison syntax tree shown in (3) is obtained, the first-party device can convert the left branch tree representing the first-party data source in the second comparison syntax tree into a first expression in string form as a.num, and generate a corresponding first code segment AA1 based on the first expression a.num. The first-party device scans the local database according to the grouping column structure. Figure 8 The data table "a table" shown in (1) is used to obtain the corresponding grouped data, and the grouped data is used as input data to calculate the first code segment AA1, and the corresponding first processing result is as follows: Figure 8 The first value column A1 in the "a table" shown in (2) of FIG. Further, the first-party device can convert the right branch tree representing the second-party data source in the second comparison syntax tree into a second expression in string form as 5-b.num, and the first-party device sends the first value column A1 and the second expression 5-b.num obtained above to the target device, so that the target device generates a corresponding second code segment BB1 based on the second expression 5-b.num, and the target device scans the local database according to the grouping column structure. Figure 8 The data table "table b" shown in (1) is used to obtain the corresponding grouped data, and the grouped data is used as input data to calculate the second code segment BB1, and the corresponding first processing result is as follows: Figure 8The second value column A2 in the data table "table b" shown in (2) is compared with the first value column A1 to obtain the data comparison result. As a result, in the expression calculation process, the expression calculation parsing is skipped, and the expression is directly precompiled as a whole into a code segment. In this way, in the subsequent repeated calculations, the expression does not need to be parsed and compiled multiple times, and the compiled code segment can be directly used for calculation, which greatly improves the code execution speed, thereby effectively improving the calculation and iteration rate, making the SQL statement comparison process execution more efficient.
[0109] In one embodiment, the step of sending the first processing result and the second expression to the target device so that the target device processes the data corresponding to the second data source based on the second expression, and comparing the second processing result obtained by processing with the first processing result includes:
[0110] Encrypting the first processing result by using a public key to obtain a first ciphertext;
[0111] The first ciphertext, public key and second expression are sent to the target device, so that the target device processes the data corresponding to the second-party data source based on the second expression, encrypts the second processing result obtained based on the public key, and compares the encrypted second ciphertext with the first ciphertext to obtain a data comparison result.
[0112] Specifically, the first-party device can encrypt the first processing result through the public key to obtain a first ciphertext, and send the first ciphertext, the public key and the second expression to the target device, so that the target device processes the data corresponding to the second-party data source based on the second expression, and encrypts the second processing result obtained based on the public key, and compares the encrypted second ciphertext with the first ciphertext to obtain a data comparison result.
[0113] For example, assuming that the first processing result is x and the second processing result is y, the first-party device can encrypt the first processing result x through the public key to obtain the first ciphertext enc(x), and send the first ciphertext enc(x), the public key and the second expression to the target device, so that the target device processes the data corresponding to the second-party data source based on the second expression, and encrypts the second processing result y obtained by the processing based on the public key, and compares the encrypted second ciphertext enc(y) with the first ciphertext enc(x), and the data comparison result can be obtained as (enc(x)^a)*enc(b)-(enc(y)^a)*enc(b)=1. This makes it possible to make the expression calculation and comparison process more secure and efficient, and by using homomorphic encryption, the security of data can be strictly guaranteed even in the data interaction process.
[0114] In one embodiment, the method further comprises:
[0115] The data comparison result is converted according to the data comparison formula to obtain a Boolean target comparison result.
[0116] Among them, Boolean type is a type of variable type in programming languages such as Pascal, VB, and C++. Boolean type has only two values: false and true. The serial number of false is 0, and the serial number of true is 1 (or non-0).
[0117] Specifically, the target device compares the encrypted second ciphertext with the first ciphertext, and after obtaining the data comparison result, the target device can send the obtained data comparison result to the first-party device. After the first-party device receives the data comparison result returned by the target device, the first-party device can convert the received data comparison result according to the original data comparison formula to obtain the final Boolean target comparison result.
[0118] For example, assuming that the data comparison result received by the first-party device is (enc(x)^a)*enc(b)-(enc(y)^a)*enc(b)=1, the first-party device can convert the received data comparison result (enc(x)^a)*enc(b)-(enc(y)^a)*enc(b)=1 according to the original data comparison formula f1 of a.num+b.num<5, and obtain enc(x)<enc(y)→a.num<5-b.num→a.num+b.num<5, and obtain the final Boolean target comparison result of true. As a result, the original sensitive data of the first party and the second party is protected from being obtained by the other party during the data comparison process, the privacy comparison method of the homomorphic encryption technology is used, and the data content of the two parties will not be leaked. The method of using the expression code generation technology helps to accelerate the speed of code execution calculation under large-scale data, and finally enables the first party and the second party to obtain more accurate comparison results.
[0119] In one embodiment, the method is applied to a server; based on the comparison syntax branch tree representing the first-party data source in the second comparison syntax tree, the step of processing the data corresponding to the first-party data source to obtain a first processing result includes:
[0120] Selecting a comparison syntax branch tree representing the first-party data source in the second comparison syntax tree;
[0121] The comparison grammar branch tree of the first-party data source is sent to the first-party device, so that the first-party device processes the data corresponding to the first-party data source to obtain a first processing result.
[0122] Specifically, the server can convert the original data comparison formula into a first comparison syntax tree, and perform pruning and item shifting on the nodes of the first comparison syntax tree to obtain a second comparison syntax tree; the server can select a comparison syntax branch tree representing the first-party data source in the second comparison syntax tree, and send the comparison syntax branch tree of the first-party data source to the first-party device, so that the first-party device processes the data corresponding to the first-party data source to obtain a first processing result; at the same time, the server can also select a comparison syntax branch tree representing the second-party data source in the second comparison syntax tree, and send the comparison syntax branch tree of the second-party data source to the second-party device, so that the second-party device processes the data corresponding to the second-party data source to obtain a second processing result. Further, when the server receives the first processing result returned by the first-party device and the second processing result returned by the second-party device, the server can compare the second processing result with the first processing result to obtain a data comparison result. Thus, data comparison can be performed quickly and effectively on multiple data sources, so that each participant does not need to expose the data to other participants, solving the problem of being unable to perform multi-table query and calculation comparison on data processing tasks involving multiple data sources.
[0123] The present application also provides an application scenario, and the application scenario applies the above data comparison method. Specifically, the application of the data comparison method in the application scenario is as follows:
[0124] When it is necessary to compare the data of multiple parties, the above data comparison method can be used, that is, in a multi-party scenario, assuming there are N parties, they can be converted into N-1 two-party scenarios to solve the problem. For example, assuming there are 4 parties, and the group column belongs to party A, the parties are party A, party B, party C, and party D. The current 4-party scenario can be converted into 3 two-party scenarios, namely party A and party B, party A and party C, party A and party D, and each two-party scenario can use the above data comparison method. That is, the first-party device can convert the data comparison formula into a first comparison syntax tree, and prune and move the nodes of the first comparison syntax tree to obtain a second comparison syntax tree; based on the comparison syntax branch tree representing the first-party data source in the second comparison syntax tree, process the data corresponding to the first-party data source to obtain a first processing result, and send the first processing result and the comparison syntax branch tree representing the second-party data source in the second comparison syntax tree to the second-party device, so that the second-party device processes the data corresponding to the second-party data source based on the comparison syntax branch tree of the second-party data source, and compares the second processing result obtained by processing with the first processing result to obtain a data comparison result.
[0125] The method provided in the embodiment of the present application can be applied to any data analysis scenario. The following takes the joint data analysis scenario as an example to illustrate the data comparison method provided in the embodiment of the present application.
[0126] In traditional methods, data from different institutions can only be stored and maintained independently. Due to factors such as data privacy protection and data protection regulations, these data scattered in different institutions cannot be centralized, forming a "data island" phenomenon. In traditional SQL methods, when it is necessary to calculate or compare expressions, the detailed data of all data sources contained in the expression must be merged, and then the expression must be further parsed and calculated. That is, in traditional SQL methods, it is necessary to access multiple original data sources to obtain the corresponding detailed data during calculation. When multiple data sources cannot be accessed or do not support acquisition, it is impossible to query and calculate multiple tables across multiple parties, especially comparison statements involving expression calculations of multiple data sources, which brings great difficulties to data analysis.
[0127] Therefore, in order to solve the above problems, the present application provides a privacy-preserving federal expression calculation and comparison method to solve the calculation and comparison problems of expressions in federal scenarios. In this method, according to the composition of the data source, the linear transformation method defined on the parse tree node is used to reasonably prune, symbolize, and move and splice the subtrees in the parse tree to obtain a transformed parse tree. In the transformed parse tree, both parties can obtain part of the original expression, and the expression no longer contains data from the other party's table. Therefore, the obtained expression of the party can be precompiled and scanned to obtain the value column to be compared; then, by means of privacy comparison, the obtained value columns of the two parties are compared by homomorphic encryption, and the comparison results are matched with the form of the original expression to obtain the final result. As a result, data comparison can be performed quickly and effectively on multiple data sources, and each participant stores data locally without the need to centralize or expose the data to other participants, thereby ensuring the security of data during multi-party interaction.
[0128] On the product side, the method provided in this application can be applied to the self-developed PowerFL system. For example, there are two product forms: 1. PowerFL command line to start the task. 2. System platform visual interface to submit tasks. The method provided in this application can also be applied to game scenarios.
[0129] On the technical side, in the scenario of joint data analysis, the calculation or comparison of complex expressions is often involved. For example, in a user-defined function (UDF), the original data needs to undergo certain mathematical transformations and then be grouped, aggregated, and other operations. A federated expression refers to an expression containing multiple data sources. Under the premise of privacy protection, the final result cannot be calculated by any single party. For example, if Party A owns Table a and Party B owns Table b, then the result of a.col*5+b.col>10 cannot be calculated without obtaining the original data of the other party. Therefore, the present application provides a method for calculating and comparing federated expressions for privacy protection.
[0130] Assume that there are two participants A and B in a federated task, where A is the initiator host and B is the participant guest. A needs to calculate an SQL statement expr (expression), which contains expressions f1, f2, ..., fn. The calculation process of f in expr is shown in the following algorithm:
[0131] Step 1. Party A generates a homomorphic encryption public key and transmits the public key to Party B. Party A and Party B each generate a private key;
[0132] Step 2. Party A generates an abstract syntax tree for expr, obtains the subtrees corresponding to f1, f2, …, fn, and performs a post-order traversal on each subtree:
[0133] i. For each node, establish a data structure corresponding to this node, such as Figure 5 As shown. For example, for the expression a.col*5+b.col>10, the ">" symbol is used as the comparison operator, the data type of the result is Boolean, the data value is unknown, the data source of this node is multi-party, the left subtree is a.col*5+b.col, the data source of the left subtree is multi-party, the right subtree is 10, and the data source of the right subtree is unilateral. The item shifting rule can be set as: atomic tree item shifting and adding a minus sign, and the atomic tree is set to 0.
[0134] ii. Replace non-Java operators with Java operators or functions, for example, replace "=" with "equalTo".
[0135] iii. For each subtree, first traverse the left subtree of the subtree, then traverse the right subtree of the subtree, and repeat this process:
[0136] a) If the left and right subtree data sources of the subtree are both from the own side, the data source of this node is marked as the own side;
[0137] b) If the left and right subtree data sources of the subtree both come from the other party, the data source of this node is marked as the other party;
[0138] c) Otherwise, mark as multi-party.
[0139] iv. Check the root node:
[0140] a) If the data source of the entire subtree is on your side, jump to step 3;
[0141] b) If the data source of the entire subtree is on the other side, return and do not process this tree any more;
[0142] c) If the data source is multiple, go to step v.
[0143] v. Perform tree pruning operations. Fig. 9 The figure shows a flowchart of pruning and moving items in the syntax tree. For example, for the expression a.col*5+b.col>10, after checking that the left subtree is a multi-party data source, the left subtree will continue to be traversed until both the left and right subtrees are unilateral data sources, and b.col will be pruned from the left subtree, a minus sign will be added, and the item will be moved to the right of the root node, and the original position will be set to 0. The above step iv will be repeated until the transformation of all trees is completed.
[0144] Step 3. After step 2, the transformed expression parsing tree is obtained as T1, T2, ..., Tm, where the data source and expression of party A are in the left subtree on the left side of the comparison symbol, and the data source and expression of party B are in the right subtree on the right side of the comparison symbol. Traverse each tree:
[0145] i. Restore each tree to a string and filter the expression on one side that contains the data source of the party. For example, the expression required by party A is: a.col*5, while that required by party B is: -b.col+10;
[0146] ii. Take the data source as a parameter and precompile this expression (i.e., the cook method in Java);
[0147] iii. Scan the corresponding data table and calculate the expression (i.e. the evaluate method in Java);
[0148] iv. Privacy comparison using homomorphic encryption:
[0149] a) Party A encrypts the result a of the expression using the public key and sends enc(noiseA*a) and noise enc(noiseA) to the other party;
[0150] b) B receives the noises enc(noiseA) and enc(noiseA*a), and generates the noise noiseB at the same time. The difference is calculated according to the privacy comparison formula to obtain the calculation result;
[0151] c) B sends the calculation result to A.
[0152] v. Get the result of expression comparison and repeat i until all trees are calculated.
[0153] Step 4. Return the result of the calculation of expr.
[0154] Among them, the tree pruning method in the embodiment of the present application is exemplified as follows: when the left and right sides of the node "+" contain a data source respectively, firstly transform the "+" value into "-", then prune the subtree, use the left subtree of the "+" node to replace the original "+" node, replace the right subtree of the root node with the "-" node, and use the original right subtree of the root node as the left subtree of this node. It can be understood that the tree pruning method proposed in the embodiment of the present application is applicable to linear expressions, that is, different data sources can be arbitrarily moved on both sides of the comparison symbol through linear transformation.
[0155] Compared with the traditional method, for each SQL statement, it is first parsed into an abstract syntax tree, and then the abstract syntax tree is summarized into logical operators and physical operators, and finally the result is calculated; when performing calculations, first perform syntax-level analysis, and then optimize the calculation process through methods such as conditional pushdown; the above method has the following disadvantages: it is necessary to access multiple original data sources during calculation, and there are no explicit privacy protection measures; code generation will not be actively triggered during the calculation process, and the time cost of iterative calculation is high; if data from multiple parties is leaked, it may violate existing laws and regulations.
[0156] In this embodiment, each participant stores data locally without centralizing or exposing the data to other participants, ensuring that the expression calculation and comparison process is safer and more efficient. That is, by using homomorphic encryption, the security of data during multi-party interaction is guaranteed; by using code generation, the compilation, calculation and iteration rates are effectively improved, making SQL execution more efficient.
[0157] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0158] Based on the same inventive concept, the embodiment of the present application also provides a data comparison device for implementing the data comparison method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more data comparison device embodiments provided below can refer to the limitations on the data comparison method above, and will not be repeated here.
[0159] In one embodiment, Fig.10 As shown, a data comparison device is provided, including: a conversion module 1002, a processing module 1004 and a sending module 1006, wherein:
[0160] The conversion module 1002 is used to convert the data comparison formula into a first comparison syntax tree.
[0161] The processing module 1004 is used to perform pruning and item shifting processing on the nodes of the first comparison syntax tree to obtain a second comparison syntax tree; based on the comparison syntax branch tree representing the first-party data source in the second comparison syntax tree, process the data corresponding to the first-party data source to obtain a first processing result.
[0162] The sending module 1006 is used to send the first processing result and the comparison grammar branch tree representing the second-party data source in the second comparison grammar tree to the target device, so that the target device processes the data corresponding to the second-party data source based on the comparison grammar branch tree of the second-party data source, and compares the second processing result obtained by processing with the first processing result to obtain a data comparison result.
[0163] In one embodiment, the device also includes: a traversal module, which is used to traverse the comparison syntax branch tree in the first comparison syntax tree to obtain a first traversal result; an execution module, which is used to execute the step of pruning and moving the nodes of the first comparison syntax tree to obtain a second comparison syntax tree when it is determined based on the first traversal result that the comparison syntax branch tree in the first comparison syntax tree corresponds to the data sources of different participants.
[0164] In one embodiment, the device also includes: a comparison module, which is used to compare the data corresponding to the data source of the participant according to the comparison grammar branch tree in the first comparison syntax tree to obtain a comparison result when it is determined based on the first traversal result that the comparison grammar branch tree in the first comparison syntax tree corresponds to the data source of the same participant.
[0165] In one embodiment, the device also includes: a construction module, which is used to construct a data structure for the first comparison syntax tree to obtain a first comparison syntax tree including operator nodes and data source nodes; the processing module is also used to perform pruning and term movement processing on the operator nodes and data source nodes in the first comparison syntax tree, respectively.
[0166] In one embodiment, the device also includes: a clipping module, which is used to clip the second-party data source node and the corresponding operator node from the first comparison syntax tree when the first comparison syntax branch tree contains the first-party data source node and the second-party data source node; a transformation module, which is used to perform symbol transformation on the clipped operator node to obtain the transformed operator node; a transposition module, which is used to transpose the transformed operator node and the second-party data source node to the second comparison syntax branch tree of the first comparison syntax tree; and a connection module, which is used to connect the clipped operator node with the adjacent node at the original position in the first comparison syntax branch tree after the transposition using a connecting line.
[0167] In one embodiment, the device also includes: a traversal module is also used to traverse the first comparison grammar branch tree after the item is moved to obtain a second traversal result; a determination module is used to stop the traversal when it is determined based on the second traversal result that the first comparison grammar branch tree after the item is moved does not contain second-party data source nodes at other levels to obtain a second comparison grammar tree.
[0168] In one embodiment, the clipping module is also used to determine based on the second traversal result that the first comparison grammar branch tree after transposition contains second-party data source nodes at other levels, and to clip the second-party data source nodes and corresponding operator nodes at other levels from the first comparison grammar branch tree; the transformation module is also used to perform symbol transformation on the clipped operator nodes to obtain the transformed operator nodes; the transposition module is also used to transpose the transformed operator nodes and the second-party data source nodes at other levels to the second comparison grammar branch tree of the first comparison grammar tree; the connection module is also used to connect the clipped operator nodes with adjacent nodes at their original positions in the first comparison grammar branch tree after transposition using connecting lines.
[0169] In one embodiment, the conversion module is further used to convert the comparison syntax branch tree representing the first-party data source into a first expression in string form; the processing module is further used to process the data corresponding to the first-party data source based on the first expression to obtain a first processing result.
[0170] In one embodiment, the device also includes: a conversion module is also used to convert the comparison syntax branch tree representing the second-party data source into a second expression in the form of a string; the sending module is also used to send the first processing result and the second expression to the target device, so that the target device processes the data corresponding to the second-party data source based on the second expression, and compares the second processing result obtained by processing with the first processing result.
[0171] In one embodiment, the processing module is also used to encrypt the first processing result through a public key to obtain a first ciphertext; the sending module is also used to send the first ciphertext, the public key and the second expression to the target device, so that the target device processes the data corresponding to the second-party data source based on the second expression, and encrypts the second processing result obtained based on the public key, and compares the encrypted second ciphertext with the first ciphertext to obtain a data comparison result.
[0172] In one embodiment, the conversion module is further used to convert the data comparison result according to the data comparison formula to obtain a Boolean target comparison result.
[0173] In one embodiment, the apparatus further includes: a selection module for selecting a comparison grammar branch tree representing a first-party data source in the second comparison grammar tree; and a sending module for sending the comparison grammar branch tree of the first-party data source to a first-party device, so that the first-party device processes the data corresponding to the first-party data source to obtain a first processing result.
[0174] Each module in the above data comparison device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0175] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.11As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a data comparison method is implemented. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.
[0176] Those skilled in the art will understand that Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0177] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0178] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0179] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the above-mentioned method embodiments.
[0180] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0181] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0182] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0183] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A data comparison method, characterized in that: The method comprises: Convert the data comparison formula into a first comparison syntax tree; Performing pruning and item shifting processing on the nodes of the first comparison syntax tree to obtain a second comparison syntax tree; Based on the comparison syntax branch tree representing the first-party data source in the second comparison syntax tree, processing the data corresponding to the first-party data source to obtain a first processing result; The first processing result and the comparison grammar branch tree representing the second-party data source in the second comparison grammar tree are sent to a target device, so that the target device processes the data corresponding to the second-party data source based on the comparison grammar branch tree of the second-party data source, and compares the second processing result obtained by processing with the first processing result to obtain a data comparison result.
2. The method according to claim 1, characterized in that After converting the data comparison formula into the first comparison syntax tree, the method further includes: Traversing the comparison syntax branch tree in the first comparison syntax tree to obtain a first traversal result; When it is determined based on the first traversal result that the comparison syntax branch trees in the first comparison syntax tree correspond to data sources of different participants, the step of pruning and moving the nodes of the first comparison syntax tree to obtain a second comparison syntax tree is performed.
3. The method according to claim 2, characterized in that The method further comprises: When it is determined based on the first traversal result that the comparison syntax branch tree in the first comparison syntax tree corresponds to the data source of the same participant, the data corresponding to the data source of the participant is compared according to the comparison syntax branch tree in the first comparison syntax tree to obtain a comparison result.
4. The method according to claim 2, characterized in that The method further comprises: Constructing a data structure for the first comparison syntax tree to obtain a first comparison syntax tree including an operator node and a data source node; The pruning and moving of the nodes of the first comparison syntax tree includes: The operator nodes and the data source nodes in the first comparison syntax tree are pruned and moved respectively.
5. The method according to claim 4, characterized in that The comparison grammar branch tree in the first comparison grammar tree includes a first comparison grammar branch tree and a second comparison grammar branch tree; The step of pruning and moving the operator nodes and the data source nodes in the first comparison syntax tree comprises: When the first comparison syntax branch tree includes a first-party data source node and a second-party data source node, pruning the second-party data source node and the corresponding operator node from the first comparison syntax tree; Performing a symbol transformation on the pruned operator node to obtain a transformed operator node; Moving the transformed operator node and the second data source node to a second comparison syntax branch tree of the first comparison syntax tree; In the first comparison grammar branch tree after the term is moved, the original position of the pruned operator node is connected to the adjacent nodes by using a connecting line.
6. The method according to claim 5, characterized in that The first comparison syntax tree includes at least one level of second-party data source nodes, and the pruned second-party data source nodes are data source nodes of a target level; After the original position of the clipped operator node is connected to the adjacent node by using a connecting line, the method further includes: Traversing the first comparison grammar branch tree after the item is moved to obtain a second traversal result; Based on the second traversal result, when it is determined that the first comparison syntax branch tree after the shift does not contain the second party data source nodes of other levels, the traversal is stopped to obtain a second comparison syntax tree.
7. The method according to claim 6, characterized in that After traversing the first comparison grammar branch tree after the shifted items to obtain a second traversal result, the method further includes: When it is determined based on the second traversal result that the first comparison grammar branch tree after the term shifting contains second-party data source nodes of other levels, the second-party data source nodes of other levels and corresponding operator nodes are trimmed from the first comparison grammar branch tree; Performing a symbol transformation on the pruned operator node to obtain a transformed operator node; Moving the transformed operator nodes and the second-party data source nodes at other levels to the second comparison syntax branch tree of the first comparison syntax tree; In the first comparison grammar branch tree after the term is moved, the original position of the pruned operator node is connected to the adjacent nodes by using a connecting line.
8. The method according to claim 1, characterized in that: The step of processing the data corresponding to the first-party data source based on the comparison syntax branch tree representing the first-party data source in the second comparison syntax tree to obtain a first processing result includes: Converting a comparison syntax branch tree representing a first-party data source into a first expression in string form; The data corresponding to the first-party data source is processed based on the first expression to obtain a first processing result.
9. The method according to claim 1, characterized in that: The sending the first processing result and the comparison grammar branch tree representing the second-party data source in the second comparison grammar tree to a target device, so that the target device processes the data corresponding to the second-party data source based on the comparison grammar branch tree of the second-party data source, and compares the second processing result obtained by the processing with the first processing result, includes: Converting the comparison syntax branch tree representing the second-party data source into a second expression in string form; The first processing result and the second expression are sent to a target device, so that the target device processes the data corresponding to the second data source based on the second expression, and compares the second processing result obtained by processing with the first processing result.
10. The method according to claim 9, characterized in that The sending the first processing result and the second expression to the target device so that the target device processes the data corresponding to the second data source based on the second expression, and compares the second processing result obtained by processing with the first processing result, includes: Encrypting the first processing result by using a public key to obtain a first ciphertext; The first ciphertext, the public key and the second expression are sent to a target device, so that the target device processes the data corresponding to the second-party data source based on the second expression, encrypts the second processing result obtained based on the public key, and compares the encrypted second ciphertext with the first ciphertext to obtain a data comparison result.
11. The method according to claim 10, characterized in that The method further comprises: The data comparison result is converted according to the data comparison formula to obtain a Boolean target comparison result.
12. The method according to any one of claims 1 to 11, characterized in that The method is applied to a server; the data corresponding to the first-party data source is processed based on the comparison syntax branch tree representing the first-party data source in the second comparison syntax tree to obtain a first processing result, including: Selecting a comparison syntax branch tree representing the first-party data source in the second comparison syntax tree; The comparison grammar branch tree of the first-party data source is sent to a first-party device, so that the first-party device processes the data corresponding to the first-party data source to obtain a first processing result.
13. A data comparison device, characterized in that: The device comprises: A conversion module, used for converting the data comparison formula into a first comparison syntax tree; A processing module, configured to perform pruning and item shifting processing on the nodes of the first comparison syntax tree to obtain a second comparison syntax tree; and based on the comparison syntax branch tree representing the first-party data source in the second comparison syntax tree, process the data corresponding to the first-party data source to obtain a first processing result; A sending module is used to send the first processing result and the comparison grammar branch tree representing the second-party data source in the second comparison grammar tree to a target device, so that the target device processes the data corresponding to the second-party data source based on the comparison grammar branch tree of the second-party data source, and compares the second processing result obtained by processing with the first processing result to obtain a data comparison result.
14. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 12 are implemented.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
16. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
Citation Information
Patent Citations
Multi-data-source structure analysis method and system, terminal equipment and storage medium
CN112579610A
Data processing system and method
CN112989399A