CN115712645A - Data processing method, device, equipment and storage medium - Google Patents

Data processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN115712645A
CN115712645A CN202211506106.XA CN202211506106A CN115712645A CN 115712645 A CN115712645 A CN 115712645A CN 202211506106 A CN202211506106 A CN 202211506106A CN 115712645 A CN115712645 A CN 115712645A
Authority
CN
China
Prior art keywords
query
query statement
operation type
branch
type corresponding
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211506106.XA
Other languages
Chinese (zh)
Inventor
徐家辉
朱仲颖
韩朱忠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Dameng Database Co Ltd
Original Assignee
Shanghai Dameng Database Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Dameng Database Co Ltd filed Critical Shanghai Dameng Database Co Ltd
Priority to CN202211506106.XA priority Critical patent/CN115712645A/en
Publication of CN115712645A publication Critical patent/CN115712645A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a data processing method, a data processing device, data processing equipment and a storage medium. The method comprises the following steps: acquiring a set query statement; if the set query statement comprises two query branches which are the same, acquiring a set operation type corresponding to the set query statement; and rewriting the set query statement according to the set operation type corresponding to the set query statement to obtain a target query statement.

Description

Data processing method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a data processing method, a data processing device, data processing equipment and a storage medium.
Background
Aggregate queries are a common Query approach in Structured Query Language (Structured Query Language). Since the query result of the SQL statement is a set of tuples, the results of multiple SQL statements may perform a set operation. The set operation mainly includes UNION (UNION), intersection (INTERSECT), difference (EXCEPT), and the like.
In the set operation, the two query branches on both sides of the operator are equivalent, so the result set is also the same. When the conventional method actually executes the set operation, after the result sets of the left query branch and the right query branch are respectively calculated, the set operation needs to be performed on the two result sets. When a single branch is executed inefficiently, it needs to be executed twice in the overall execution, which is even less efficient.
Disclosure of Invention
Embodiments of the present invention provide a data processing method, apparatus, device, and storage medium, which can improve query efficiency.
According to an aspect of the present invention, there is provided a data processing method including:
acquiring a set query statement;
if the set query statement comprises two query branches which are the same, acquiring a set operation type corresponding to the set query statement;
and rewriting the set query statement according to the set operation type corresponding to the set query statement to obtain a target query statement.
According to another aspect of the present invention, there is provided a data processing apparatus comprising:
the first acquisition module is used for acquiring the set query statement;
a second obtaining module, configured to obtain a set operation type corresponding to the set query statement if the set query statement includes two query branches that are the same;
and the rewriting module is used for rewriting the set query statement according to the set operation type corresponding to the set query statement to obtain the target query statement.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the first and the second end of the pipe are connected with each other,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the data processing method according to any of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer-readable storage medium storing computer instructions for causing a processor to implement a data processing method according to any one of the embodiments of the present invention when the computer instructions are executed.
The embodiment of the invention acquires the set query statement; if the set query statement comprises two query branches which are the same, acquiring a set operation type corresponding to the set query statement; and rewriting the set query statement according to the set operation type corresponding to the set query statement to obtain a target query statement, so that the query efficiency can be improved.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present invention, nor do they necessarily limit the scope of the invention. Other features of the present invention will become apparent from the following description.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
FIG. 1 is a flow chart of a data processing method in an embodiment of the invention;
FIG. 2 is a flow chart of another data processing method in an embodiment of the invention;
FIG. 3 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device in the embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It is understood that before the technical solutions disclosed in the embodiments of the present disclosure are used, the type, the use range, the use scene, etc. of the personal information related to the present disclosure should be informed to the user and obtain the authorization of the user through a proper manner according to the relevant laws and regulations.
Example one
Fig. 1 is a flowchart of a data processing method according to an embodiment of the present invention, where the embodiment is applicable to a case where a set query statement including the same query branch is rewritten, and the method may be executed by a data processing apparatus according to an embodiment of the present invention, where the apparatus may be implemented in a software and/or hardware manner, as shown in fig. 1, the method specifically includes the following steps:
s110, acquiring a set query statement.
The set query statement may be a set query statement for performing union operation, a set query statement for performing intersection operation, or a set query statement for performing difference set operation.
S120, if the set query statement comprises two query branches, and the two query branches are the same, acquiring a set operation type corresponding to the set query statement.
The two query branches included in the set query statement may be a single query statement, for example, the set query statement: the select from t1 on the left side of the aggregate operation unit is the left branch, the select from t1 on the right side of the aggregate operation unit is the right branch, and the left branch and the right branch are single query statements; the two query branches included in the aggregate query statement may not be a single query statement, and may be, for example, an aggregate query statement: (select from t1. Units from t 1) units (select from t1. Units from t 1) in the set operator, the left branch from t1. Units select from t1. Units to the right of the set operator, the right branch from t1. Units, neither the left branch nor the right branch is a single query statement.
It should be noted that there may be one query branch other than a single query statement in the two query branches included in the set query statement, and one query branch is a single query statement.
Wherein, the same determination manner of the two query branches may be: and comparing the element items forming the two query branches, and if the element items forming the two branches are the same, determining that the two query branches are the same. For example, if the left branch is composed of query terms, FROM terms, and grouping terms, the right branch is composed of query terms, FROM terms, and grouping terms, the query terms of the left branch are the same as the query terms of the right branch, the FROM terms of the left branch are the same as the FROM terms of the right branch, and the grouping terms of the left branch are the same as the grouping terms of the right branch, it may be determined that the left branch is the same as the right branch.
Wherein the set operation type comprises: union operation, intersection operation, and difference operation.
Specifically, if the set query statement includes two query branches, and the two query branches are the same, the manner of obtaining the set operation type corresponding to the set query statement may be: if the set query statement comprises two query branches, and the two query branches are both single query statements, acquiring element items forming each query branch, and if the element items forming each query branch are the same, acquiring a set operator in the set query statement; and determining the set operation type corresponding to the set query statement according to the set operator in the set query statement.
S130, rewriting the set query statement according to the set operation type corresponding to the set query statement to obtain a target query statement.
Specifically, the manner of rewriting the set query statement according to the set operation type corresponding to the set query statement to obtain the target query statement may be: if the set operation type corresponding to the set query statement is a UNION operation type and the set operator is UNION, determining any query branch added with the duplicate removal item as a target query statement; if the set operation type corresponding to the set query statement is an intersection operation type and the set operator is INTERSECT, determining any query branch added with the duplication removal item as a target query statement; if the set operation type corresponding to the set query statement is an intersection operation type and the set operator is INTERSECT ALL, determining any query branch as a target query statement; and if the set operation type corresponding to the set query statement is the difference set operation type, replacing the filtering condition with any query branch of the target Boolean expression to determine the target Boolean expression as the target query statement, wherein the value of the target Boolean expression is FALSE.
Optionally, rewriting the set query statement according to the set operation type corresponding to the set query statement to obtain a target query statement, where the method includes:
if the set operation type corresponding to the set query statement is a union operation type and the set operator is a first operator, determining any query branch added with the duplicate removal item as a target query statement;
if the set operation type corresponding to the set query statement is an intersection operation type and the set operator is a second operator, determining any query branch added with the duplicate removal item as a target query statement;
if the set operation type corresponding to the set query statement is an intersection operation type and the set operator is a third operator, determining any query branch as a target query statement;
and if the set operation type corresponding to the set query statement is the difference set operation type, replacing the filtering condition with any query branch of the target Boolean expression to determine the target Boolean expression as the target query statement, wherein the value of the target Boolean expression is FALSE.
Wherein, the first operator is UNION, the second operator is INTERSECT, and the third operator is INTERSECT ALL.
Specifically, if the set operation type corresponding to the set query statement is a union operation type and the set operator is a first operator, determining any query branch to which the deduplication item is added as the target query statement, for example, the set query statement may be: select from t1 unit select from t1; the target query statement is: select distintint from t1.
It should be noted that the principle of UNION ALL operation is to take the UNION of the result sets of the left and right query branches without deduplication, and the result set is ALL records in the result sets of the two query branches, so the two query branches cannot be eliminated by merging.
Specifically, if the set operation type corresponding to the set query statement is an intersection operation type and the set operator is a second operator, any query branch to which the duplicate removal item is added is determined as the target query statement. For example, the set query statement may be: select from t1 intersector select from t1; the target query statement is: select distintint from t1.
Specifically, if the set operation type corresponding to the set query statement is an intersection operation type and the set operator is a third operator, any query branch is determined as the target query statement. For example, the set query statement may be: select all from t1 intersectant, from t1; the target query statement is: select from t1.
Specifically, if the set operation type corresponding to the set query statement is the difference set operation type, replacing the filtering condition with any query branch of the target boolean expression to determine that the set query statement is the target query statement. For example, the set query statement may be: select from t1except all select from t1; or, select from t1except select from t1, the target query statement is: select from t1 where FALSE.
Optionally, if the set query statement includes two query branches, and the two query branches are the same, obtaining a set operation type corresponding to the set query statement, including:
if the set query statement comprises two query branches which are both single query statements, acquiring element items forming each query branch;
and if the element items forming each query branch are the same, acquiring the set operation type corresponding to the set query statement.
Wherein the element term includes: at least one of query terms, FROM terms, grouping terms, and ranking terms.
Specifically, if the element items forming each query branch are the same, the manner of obtaining the set operation type corresponding to the set query statement may be: and if the corresponding element items of the two query branches are the same, acquiring the set operation type corresponding to the set query statement.
Optionally, the obtaining of the set operation type corresponding to the set query statement includes:
acquiring a set operator in the set query statement;
and determining the set operation type corresponding to the set query statement according to the set operator in the set query statement.
Wherein the set operator can be any one of UNION, UNION ALL, INTERSECT, INTERSECT ALL, EXCEPT and EXCEPT ALL.
Specifically, the manner of determining the set operation type corresponding to the set query statement according to the set operator in the set query statement may be: if the set operator in the set query statement is UNION or UNION ALL, determining that the set operation type corresponding to the set query statement is a UNION operation type; if the set operator in the set query statement is INTERSECT or INTERSECT ALL, determining that the set operation type corresponding to the set query statement is an intersection operation type; and if the set operator in the set query statement is EXCEPT or EXCEPT ALL, determining that the set operation type corresponding to the set query statement is a difference set operation type.
It should be noted that the meaning of the set operator is basically the same as that of the set operation in mathematics, and the difference is that the operations in the database remove the repeated tuples in the result set. If duplicate tuples are allowed in the result set, then ALL keys should be added for use, such as UNION ALL, INTERSECT ALL, exceptall, etc. set operators.
Optionally, if the set query statement includes two query branches, and the two query branches are the same, obtaining a set operation type corresponding to the set query statement, including:
if the set query statement comprises two query branches and at least one query branch is not a single query statement, acquiring a set operation type corresponding to the query branch of the non-single query statement;
rewriting the query branches of the non-single query statement according to the set operation type corresponding to the query branches of the non-single query statement until the two rewritten query branches are single query statements, and acquiring element items forming each rewritten query branch;
and if the element items forming each query branch are the same, acquiring the set operation type corresponding to the set query statement.
In one specific example, two query branches on both sides of the set operator may be equally encountered during the execution of the set operation, such as: create table t1 (c 1 int); select from t1 unit select from t1; select from t1 intersector select from t1, etc. When the conventional method actually executes the set operation, after the result sets of the left query branch and the right query branch are respectively calculated, the set operation needs to be performed on the two result sets. When a single branch is inefficient to execute, it needs to be executed twice in the overall execution, which is even less efficient. According to the embodiment of the invention, on the premise that the left query branch and the right query branch are equivalent, the overall operation result can be obtained by only calculating the result set of a single query branch, and the execution efficiency is improved.
In another specific example, as shown in FIG. 2, the present invention provides a method for optimizing the efficiency of a set query by eliminating equivalent query branches on both sides of the set operator in the set query. First, two query statements are considered equivalent, where all the element terms making up the query statement, such as query terms, FROM terms, rank terms, grouping terms, etc., are the same. On the basis, the following optimization means are provided for the three sets of operations:
1. UNION operation (UNION operation and UNION ALL operation)
The principle of the UNION operation is to take the result sets of the left and right query branches and then remove the duplicate. Because the two query branches are equivalent, for any result set tuple of any branch, the same tuple can be found in the result set of the other branch, and at most one of the two tuples can be reserved after the duplication removal of the UNION operation. Thus, when two query branches of a UNION operation are equivalent, the result set is the same as the result set after deduplication by a single branch. For example:
select*from t1 union select*from t1;
is equivalent to
select distinct*from t1;
The principle of UNION ALL operation is to take a UNION of the result sets of the left and right query branches without deduplication, the result set being ALL the records in the result sets of the two query branches, so that the two query branches cannot be eliminated by merging.
The processing steps are as follows:
1) Judging whether two branches of union set operation are equivalent, if the two branches do not contain set operation, namely the two branches are single query statements, sequentially judging whether the components of the two branch query statements are equivalent, for example: query terms, FROM terms, grouping terms, ranking terms, etc., only two query statements with all components being the same are considered equivalent; if any branch contains set operation, judging whether the branch recursion is equivalent or not and whether the branch recursion can be combined or not, namely, recursively performing the steps 1-3), and returning upwards after each branch is processed until the top-level set operation is combined.
2) If the two branches are equivalent, the UNION operation is continuously judged to be UNION or UNION ALL, the UNION needs to perform de-duplication processing on the result set, and the result set inquired by the two equivalent branches is subjected to de-duplication after being taken and collected, and the result is the same as the result of de-duplication of the result set inquired by a single branch, so that the two inquiry branches can be combined into an inquiry statement of the single branch, and the equivalent inquiry branches on the two sides are eliminated; while UNION ALL does not do deduplication, its result set needs to keep ALL records of both branches, so when the operation is UNION ALL, the two branches cannot be merged.
3) When the operation is UNION, the left branch of the operation is used for replacing the query statement, if the query statement does not have the DISTINCT attribute originally, the DISTINCT attribute is set for the query statement, and the query statement is returned as a combined result.
2. Intersection operation (INTERSECT operation and INTERSECT ALL operation)
The principle of the INTERSECT operation is to remove the duplication after taking the intersection of the result sets of the left and right query branches, and the result set after taking the intersection is the result set after the duplication of the single query branch. For example:
select*from t1 intersect select*from t1;
is equivalent to
select distinct*from t1;
INTERSECT ALL does not require deduplication after intersection of the result sets of the left and right query branches, and the result set is directly equivalent to the result set of a single query branch. For example:
select*from t1 intersect all select*from t1;
is equivalent to
select*from t1;
The processing steps are as follows:
1) If the branch is a non-single query statement, performing steps 1) -3) on the branch recursion, judging whether the left branch and the right branch of the intersection operation are equivalent and a merging mode, and returning upwards after each branch is processed until the top-level set operation is merged; and if the two branches are single query statements, normally executing the step 2) and the step 3) downwards.
2) If the two branches are equivalent, whether the intersection operation is the INTERSECT operation or the INTERSECT ALL operation is continuously judged, and the processing of the two operations is different. The INTERSECT operation needs to duplicate the result set after the intersection is taken, and the combined query statement needs to set a DISTINCT attribute; while INTERSECT ALL operation retains all records, without deduplication, the merged query statement is consistent with its left and right branches. If the operation is an interrupt operation and the query statement itself does not contain DISTINCT, a DISTINCT attribute needs to be set for the query statement of the left branch.
3) And replacing the left branch of the intersection operation statement with the left branch of the intersection operation statement, and returning the replaced query statement.
3. Difference set operation (EXCEPT operation and EXCEPT ALL operation)
The principle of the EXCEPT operation is to perform the difference set operation after the result sets of the left and right query branches are de-duplicated, i.e. the tuples appearing in the result set of the right branch are removed from the result set of the left branch.
The EXCEPT ALL operation differs from the EXCEPT operation in that it performs the difference set operation directly without first deduplication the result sets of the left and right query branches.
When the left and right query branches are equivalent, the difference set operation result should be the same and both are empty sets regardless of whether deduplication is needed. For example:
select*from t1 except all select*from t1;
or
select*from t1 except select*from t1;
Is equivalent to
select*from t1 where FALSE;
The processing steps are as follows:
1) If the branch is a non-single query statement, performing steps 1) -3) on the branch recursion, judging whether the left branch and the right branch of difference set operation are equivalent, and returning upwards after each branch is processed until the top-level set operation is merged; and if the two branches are single query statements, normally executing the step 2) and the step 3) downwards.
2) If the two branches are equivalent, constructing a Boolean expression with a value of FALSE, replacing the filtering condition of the left branch with the Boolean expression, and returning the query statement to the empty set after replacement. For example: select from t1except select from t1; the replacement is followed by select from t1 where false except select from t1.
3) And replacing the left branch of the difference set operation statement with the left branch of the difference set operation statement, and returning the replaced query statement.
According to the technical scheme of the embodiment, a set query statement is obtained; if the set query statement comprises two query branches which are the same, acquiring a set operation type corresponding to the set query statement; and rewriting the set query statement according to the set operation type corresponding to the set query statement to obtain a target query statement, so that the query efficiency can be improved.
Example two
Fig. 3 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present invention. The present embodiment is applicable to the case of rewriting a set query statement containing the same query branch, and the apparatus may be implemented in software and/or hardware, and the apparatus may be integrated in any device providing a data processing function, as shown in fig. 3, where the data processing apparatus specifically includes: a first obtaining module 210, a second obtaining module 220, and a rewriting module 230.
The first acquisition module is used for acquiring a set query statement;
a second obtaining module, configured to obtain a set operation type corresponding to the set query statement if the set query statement includes two query branches that are the same;
and the rewriting module is used for rewriting the set query statement according to the set operation type corresponding to the set query statement to obtain the target query statement.
The product can execute the method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
According to the technical scheme of the embodiment, a set query statement is obtained; if the set query statement comprises two query branches which are the same, acquiring a set operation type corresponding to the set query statement; and rewriting the set query statement according to the set operation type corresponding to the set query statement to obtain a target query statement, so that the query efficiency can be improved.
EXAMPLE III
FIG. 4 shows a schematic block diagram of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 4, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, and the like, wherein the memory stores a computer program executable by the at least one processor, and the processor 11 can perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from a storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data necessary for the operation of the electronic apparatus 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to the bus 14.
A number of components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, or the like; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The processor 11 performs the various methods and processes described above, such as a data processing method.
In some embodiments, the data processing method may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the data processing method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the data processing method by any other suitable means (e.g. by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. A computer program can execute entirely on a machine, partly on a machine, as a stand-alone software package partly on a machine and partly on a remote machine or entirely on a remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the Internet.
The computing system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present invention may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired results of the technical solution of the present invention can be achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A data processing method, comprising:
acquiring a set query statement;
if the set query statement comprises two query branches which are the same, acquiring a set operation type corresponding to the set query statement;
and rewriting the set query statement according to the set operation type corresponding to the set query statement to obtain a target query statement.
2. The method of claim 1, wherein rewriting the set query statement according to the set operation type corresponding to the set query statement to obtain a target query statement comprises:
if the set operation type corresponding to the set query statement is a union operation type and the set operator is a first operator, determining any query branch added with the duplicate removal item as a target query statement;
if the set operation type corresponding to the set query statement is an intersection operation type and the set operator is a second operator, determining any query branch added with the duplicate removal item as a target query statement;
if the set operation type corresponding to the set query statement is an intersection operation type and the set operator is a third operator, determining any query branch as a target query statement;
and if the set operation type corresponding to the set query statement is the difference set operation type, replacing the filtering condition with any query branch of the target Boolean expression to determine the target Boolean expression as the target query statement, wherein the value of the target Boolean expression is FALSE.
3. The method of claim 1, wherein if the set query statement includes two query branches, and the two query branches are the same, obtaining the set operation type corresponding to the set query statement comprises:
if the set query statement comprises two query branches which are both single query statements, acquiring element items forming each query branch;
and if the element items forming each query branch are the same, acquiring the set operation type corresponding to the set query statement.
4. The method of claim 1, wherein obtaining the set operation type corresponding to the set query statement comprises:
acquiring a set operator in the set query statement;
and determining a set operation type corresponding to the set query statement according to a set operator in the set query statement.
5. The method of claim 1, wherein if the set query statement includes two query branches, and the two query branches are the same, obtaining the set operation type corresponding to the set query statement comprises:
if the set query statement comprises two query branches and at least one query branch is not a single query statement, acquiring a set operation type corresponding to the query branch of the non-single query statement;
rewriting the query branches of the non-single query statement according to the set operation type corresponding to the query branches of the non-single query statement until the two rewritten query branches are single query statements, and acquiring element items forming each rewritten query branch;
and if the element items forming each query branch are the same, acquiring the set operation type corresponding to the set query statement.
6. A data processing apparatus, characterized by comprising:
the first acquisition module is used for acquiring a set query statement;
a second obtaining module, configured to obtain a set operation type corresponding to the set query statement if the set query statement includes two query branches that are the same;
and the rewriting module is used for rewriting the set query statement according to the set operation type corresponding to the set query statement to obtain the target query statement.
7. The apparatus of claim 6, wherein the rewrite module is specifically configured to:
if the set operation type corresponding to the set query statement is a union operation type and the set operator is a first operator, determining any query branch added with the duplicate removal item as a target query statement;
if the set operation type corresponding to the set query statement is an intersection operation type and the set operator is a second operator, determining any query branch added with the duplicate removal item as a target query statement;
if the set operation type corresponding to the set query statement is an intersection operation type and the set operator is a third operator, determining any query branch as a target query statement;
and if the set operation type corresponding to the set query statement is a difference set operation type, replacing the filtering condition with any query branch of a target Boolean expression to determine the target Boolean expression as the target query statement, wherein the value of the target Boolean expression is FALSE.
8. The apparatus of claim 6, wherein the second obtaining module is specifically configured to:
if the set query statement comprises two query branches, and the two query branches are both single query statements, acquiring element items forming each query branch;
and if the element items forming each query branch are the same, acquiring the set operation type corresponding to the set query statement.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the data processing method of any one of claims 1-5.
10. A computer-readable storage medium, characterized in that it stores computer instructions for causing a processor to implement the data processing method of any of claims 1-5 when executed.
CN202211506106.XA 2022-11-28 2022-11-28 Data processing method, device, equipment and storage medium Pending CN115712645A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211506106.XA CN115712645A (en) 2022-11-28 2022-11-28 Data processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211506106.XA CN115712645A (en) 2022-11-28 2022-11-28 Data processing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115712645A true CN115712645A (en) 2023-02-24

Family

ID=85235111

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211506106.XA Pending CN115712645A (en) 2022-11-28 2022-11-28 Data processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115712645A (en)

Similar Documents

Publication Publication Date Title
US11442930B2 (en) Method, apparatus, device and storage medium for data aggregation
CN113987086A (en) Data processing method, data processing device, electronic device, and storage medium
CN116471174B (en) Log data monitoring system, method, device and storage medium
CN116340318A (en) Method, device, equipment and storage medium for processing secondary index record
CN115080607A (en) Method, device, equipment and storage medium for optimizing structured query statement
CN112887426B (en) Information stream pushing method and device, electronic equipment and storage medium
CN115905322A (en) Service processing method and device, electronic equipment and storage medium
CN114817223A (en) Service data extraction method and device, electronic equipment and storage medium
CN115329150A (en) Method and device for generating search condition tree, electronic equipment and storage medium
CN115712645A (en) Data processing method, device, equipment and storage medium
CN115328917A (en) Query method, device, equipment and storage medium
CN114564149A (en) Data storage method, device, equipment and storage medium
CN116383454B (en) Data query method of graph database, electronic equipment and storage medium
CN116303578A (en) Query expression processing method, device, equipment and storage medium
CN118132533A (en) Data processing method, device, equipment and storage medium
CN115421665A (en) Data storage method, device, equipment and storage medium
CN115601172A (en) Data processing method, device, equipment and storage medium
CN115964387A (en) Data query method and device, distributed database system and medium
CN115757928A (en) Data query method and device, electronic equipment and storage medium
CN115203246A (en) Linked list query method and device, electronic equipment and storage medium
CN116401269A (en) Data query method and device, electronic equipment and storage medium
CN116595110A (en) Data storage method and device, electronic equipment and storage medium
CN117827840A (en) Index creation method and device, electronic equipment and storage medium
CN114722264A (en) Data query method and device, electronic equipment and storage medium
CN117171206A (en) Query method, query device, electronic equipment and storage medium

Legal Events

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