CN106570022A - Cross-data-source query method, apparatus and system - Google Patents

Cross-data-source query method, apparatus and system Download PDF

Info

Publication number
CN106570022A
CN106570022A CN201510651622.5A CN201510651622A CN106570022A CN 106570022 A CN106570022 A CN 106570022A CN 201510651622 A CN201510651622 A CN 201510651622A CN 106570022 A CN106570022 A CN 106570022A
Authority
CN
China
Prior art keywords
data
tables
field
sentence
query
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.)
Granted
Application number
CN201510651622.5A
Other languages
Chinese (zh)
Other versions
CN106570022B (en
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.)
Cainiao Smart Logistics Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201510651622.5A priority Critical patent/CN106570022B/en
Publication of CN106570022A publication Critical patent/CN106570022A/en
Application granted granted Critical
Publication of CN106570022B publication Critical patent/CN106570022B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation

Abstract

The invention provides a cross-data-source query method, apparatus and system. The method comprises the steps of analyzing a target search statement to obtain a mapping relationship between a common field of two data tables involved by the target search statement and a grouping field in the target search statement; determining a second query result corresponding to the second database in a process of querying the second data table by utilizing a second query statement and a second condition limitation statement, and obtaining intermediate query results grouped according to a virtual grouping field; determining a first query result corresponding to the first data table in a process of querying the first database by utilizing a first query statement and an additional condition limitation statement, and obtaining query results grouped according to the grouping field; and integrating the first query result and the second query result according to the target search statement, thereby obtaining a final query result. According to the method, the apparatus and the system, the two data tables are directly subjected to separate query, so that the integration process of the two data tables is omitted and the data query efficiency and accuracy are improved.

Description

A kind of across data source query method, apparatus and system
Technical field
The application is related to database technical field, more particularly to across the data source query method of one kind, device and System.
Background technology
At present in software development process, data query is very important link;Once data exactly Inquiry can provide strong basic data for follow-up software development.Current data query is predominantly based on The inquiry of data base.At present, it is generally based on database data query script, is being counted by query statement According to inquiring desired data in the tables of data in storehouse.
With the increase of data bulk in data base, desired data is likely distributed in two and plural In tables of data;This causes data query process to need to combine two and plural tables of data in data base Inquired about, desired data could be obtained.Query script in two and two or more tables of data is referred to as Across data source query.
Because the data query for same tables of data can directly inquiry be obtained by query statement, but Have no idea by directly directly being inquired about by query statement for the inquiry across data source.Therefore, for It is generally across the processing procedure of data source query:Using two public fields with two tables of data, to two Individual and plural tables of data carries out Data Integration, so as to two and plural tables of data are whole Same tables of data is closed, data query is then carried out in same tables of data.
Because error rate is very high during Data Integration, enter with resource furthermore, it is desirable to take considerable time Row Data Integration, this causes search efficiency across data source query process, accuracy rate relatively low and to resource Waste serious.
The content of the invention
The application provides a kind of across data source query method, apparatus and system, can be not carry out data whole Complete on the premise of conjunction across data source query, disappear so as to improving search efficiency, accuracy rate and reducing resource Consumption.
To achieve these goals, the application provides following technological means:
A kind of across data source query method, including:
By parsing target search sentence, two tables of data involved by the acquisition target search sentence The mapping relations between grouping field in field in common and the target search sentence;Wherein, described two The tables of data comprising the grouping field is the first tables of data in individual tables of data, not comprising the grouping field Tables of data be the second tables of data, the mapping relations are to limit sentence inquiry according to first condition described Determine in the Query Result that first tables of data is obtained;
Sentence is limited using the second query statement and second condition second tables of data is inquired about and obtained In the intermediate queries result that must be grouped by virtual group field, it is determined that corresponding with second tables of data the Two Query Results;Wherein, the virtual group field is in second data using the mapping relations Virtual field create in table, equivalent to the grouping field in first tables of data;
Sentence is limited using the first query statement and additional conditions first tables of data is inquired about and obtained In must be by the Query Result of grouping field packet, it is determined that corresponding with first tables of data first looks into Ask result;Wherein, the additional conditions limit the number that sentence is the grouping field in first tables of data Value is equal with the numerical value of virtual group field in second Query Result;
First Query Result and described second are integrated according to the logical relation in the target search sentence Query Result, obtains final Query Result.
Preferably, the first condition limit sentence be in the target search sentence with first data The related condition of table limits sentence.
Preferably, it is the target search language that second query statement and the second condition limit sentence The query statement related to second tables of data and condition limit sentence in sentence.
Preferably, first query statement include the target search sentence in first tables of data Related query statement.
Preferably, it is described by parsing target search sentence, obtain involved by the target search sentence The mapping relations between grouping field in the field in common of two tables of data and the target search sentence, Including:
Sentence is limited with reference to the first condition, is inquired about in first tables of data and the grouping field With the corresponding first mapping data set of the field in common;Wherein, the first mapping data set includes Grouped data collection corresponding with the grouping field and corresponding first data set of the field in common, and And the grouped data of the packet data convergence and the first data in first data set are in correspond Relation;Wherein, the grouped data collection includes several grouped datas, if first data set is included Dry the first data;
In the described first mapping data set, by the grouped data of the packet data convergence and described first The one-to-one relationship between the first data in data set, is defined as the grouping field common with described The mapping relations between field.
Preferably, it is described in the described first mapping data set, by the packet count of the packet data convergence According to the one-to-one relationship between the first data in first data set, it is defined as the packet word The mapping relations between section and the field in common, including:
The partial data collection that will be chosen by order from top to bottom in the described first mapping data set, it is determined that For the second mapping data set;
In the described second mapping data set, by the grouped data of the packet data convergence and described first The one-to-one relationship between the first data in data set, is defined as the grouping field common with described The mapping relations between field.
Preferably, it is described to limit sentence to second data using the second query statement and second condition Table is inquired about and obtained in the intermediate queries result by the packet of virtual group field, it is determined that counting with described second According to corresponding second Query Result of table, including:
In second tables of data, using virtual group field described in the mapping relations dynamic creation; Wherein, the virtual group field correspondence virtual group data set;Wherein, the virtual group data set In the determination process of each virtual group data include:In second tables of data and the field in common pair Second data are determined in the second data set answered, one in second data with the mapping relations In the case that individual first data are equal, will correspondingly divide with first data in the mapping relations Group data, are defined as virtual group data corresponding with second data;
Sentence is limited according to second query statement and the second condition, second tables of data is entered Row inquiry, and export by the intermediate queries result after virtual group field packet.
Preferably, it is described to determine second Query Result corresponding with second tables of data, including:
In the case where the target search sentence limits sentence not comprising quantity, by intermediate queries knot Fruit is defined as second Query Result;
In the case where the target search sentence limits sentence comprising quantity, the intermediate queries knot is judged Whether the data bulk of fruit is less than predetermined number;Wherein, predetermined number is to limit in sentence in the condition Extract;
If the data bulk of the intermediate queries result is not less than the predetermined number, will be in the centre The data of the predetermined number extracted in Query Result, are defined as second Query Result.
Preferably, also include:
If the data bulk of the intermediate queries result is less than the predetermined number, following step is repeated Suddenly till the data bulk of all intermediate queries results for obtaining is not less than the predetermined number:
The partial data collection that will be reselected in the described first mapping data set, is defined as described second and reflects Penetrate data set;Described second mapping data set in, determine the grouping field and the field in common it Between the mapping relations;Using the second query statement and second condition sentence is limited to second data The intermediate queries result by the packet of virtual group field is inquired about and obtained to table.
Preferably, the logical relation according in the target search sentence integrates the first inquiry knot Fruit and second Query Result, obtain final Query Result, including:
If the Query Result summation of first Query Result and second Query Result is searched with the target Target query result in rope sentence does not meet, then in first Query Result and the second inquiry knot At least two intermediate results for not meeting the target query result are filtered out in fruit;
According to the logical operator of at least two intermediate result, at least two intermediate result is calculated Operation result;
By meet in first Query Result and second Query Result target query result its Its Query Result and the operation result, are defined as the final Query Result.
A kind of across data source query device, including:
Acquiring unit, for by parsing target search sentence, obtaining involved by the target search sentence Two tables of data field in common and the target search sentence in grouping field between mapping close System;Wherein, the tables of data comprising the grouping field is the first tables of data in described two tables of data, no Tables of data comprising the grouping field is the second tables of data, and the mapping relations are according to first condition Limit sentence and inquire about what is determined in the Query Result that first tables of data is obtained;
First processing units, for limiting sentence to described the using the second query statement and second condition Two tables of data inquire about and obtain by virtual group field be grouped intermediate queries result in, it is determined that with it is described Corresponding second Query Result of second tables of data;Wherein, the virtual group field is using the mapping It is that relation is created in second tables of data, equivalent to the grouping field in first tables of data Virtual field;
Second processing unit, for limiting sentence to described the using the first query statement and additional conditions One tables of data is inquired about and obtained in the Query Result that is grouped by the grouping field, it is determined that with described first Corresponding first Query Result of tables of data;Wherein, it is first data that the additional conditions limit sentence The numerical value of the grouping field in table is equal with the numerical value of virtual group field in second Query Result;
Integral unit, for integrating first inquiry according to the logical relation in the target search sentence As a result with second Query Result, final Query Result is obtained.
Preferably, the acquiring unit, including:
First query unit, for limiting sentence with reference to the first condition, in first tables of data Inquiry and the corresponding first mapping data set of the grouping field and the field in common;Wherein, it is described First mapping data set includes grouped data collection corresponding with the grouping field and the field in common pair In the first data set answered, and the grouped data of the packet data convergence and first data set First data are in one-to-one relationship;Wherein, the grouped data collection includes several grouped datas, institute The first data set is stated comprising several first data;
First determines mapping relations unit, in the described first mapping data set, by the packet count According to concentrate grouped data and first data set in the first data between one-to-one relationship, really The mapping relations being set between the grouping field and the field in common.
Preferably, described first determines mapping relations unit, including:
It is determined that mapping data set unit, for will be suitable by from top to bottom in the described first mapping data set The partial data collection that sequence is chosen, is defined as the second mapping data set;
Second determines mapping relations unit, in the described second mapping data set, by the packet count According to concentrate grouped data and first data set in the first data between one-to-one relationship, really The mapping relations being set between the grouping field and the field in common.
Preferably, the first processing units include:
Second query unit, for limiting sentence to described second using the second query statement and second condition The intermediate queries result by the packet of virtual group field is inquired about and obtained to tables of data;
First determining unit, in the intermediate queries result, it is determined that with second tables of data pair The second Query Result answered.
Preferably, second query unit, including:
Creating unit, in second tables of data, using described in the mapping relations dynamic creation Virtual group field;Wherein, the virtual group field correspondence virtual group data set;Wherein, it is described The determination process of each virtual group data includes in virtual group data set:Second tables of data with In corresponding second data set of the field in common, determine second data, second data with In the case that first data are equal in the mapping relations, by the mapping relations with described first The one-to-one grouped data of data, is defined as virtual group data corresponding with second data;
Output unit, for limiting sentence according to second query statement and the second condition, to institute State the second tables of data to be inquired about, and export by the intermediate queries result after virtual group field packet.
Preferably, first determining unit, including:
Second determining unit, in the case of limiting sentence not comprising quantity in the target search sentence, The intermediate queries result is defined as into second Query Result;
Judging unit, in the case of limiting sentence comprising quantity in the target search sentence, judges Whether the data bulk of the intermediate queries result is less than predetermined number;Wherein, predetermined number is described Condition limits what is extracted in sentence;
3rd determining unit, if the data bulk for the intermediate queries result is not less than the present count Amount, then by the data of the predetermined number extracted in the intermediate queries result, be defined as described second and look into Ask result.
Preferably, also include:
It is described to determine mapping data set unit, if the data bulk for being additionally operable to the intermediate queries result is less than The predetermined number, the partial data collection that will be reselected in the described first mapping data set, is defined as The second mapping data set.
Preferably, the integral unit, including:
Screening unit, if the Query Result for first Query Result and second Query Result is total And do not meet with the target query result in the target search sentence, then in first Query Result and At least two intermediate results for not meeting the target query result are filtered out in second Query Result;
Computing unit, for described according to the logical operator of at least two intermediate result, calculating extremely The operation result of few two intermediate result;
Final result unit is determined, for will accord with first Query Result and second Query Result Other Query Results and the operation result of the target query result are closed, is defined as described finally looking into Ask result.
A kind of across data source query system, including:
Be stored with the processor of data base, and the input equipment being connected with the processor;
The input equipment, for obtaining target search sentence, and by the target search sentence send to Processor;
The processor is used for, and according to target search sentence data query is carried out;It is specifically as follows:Pass through Parsing target search sentence, obtains the field in common of two tables of data involved by the target search sentence With the mapping relations between the grouping field in the target search sentence;Wherein, described two tables of data In comprising the grouping field tables of data be the first tables of data, the tables of data not comprising the grouping field For the second tables of data, the mapping relations are to limit sentence inquiry first data according to first condition Determine in the Query Result that table is obtained;Sentence pair is being limited using the second query statement and second condition Second tables of data is inquired about and obtained in the intermediate queries result by the packet of virtual group field, it is determined that The second Query Result corresponding with second tables of data;Wherein, the virtual group field is to utilize institute State it is that mapping relations are created in second tables of data, equivalent to first tables of data in described in point The virtual field of group field;Count to described first sentence is limited using the first query statement and additional conditions According to table inquire about and obtain by the grouping field be grouped Query Result in, it is determined that with first data Corresponding first Query Result of table;Wherein, it is in first tables of data that the additional conditions limit sentence Grouping field numerical value it is equal with the numerical value of virtual group field in second Query Result;According to institute The logical relation stated in target search sentence integrates first Query Result and second Query Result, Obtain final Query Result.
A kind of across data source query system, including:
Processor, the input equipment being connected with the processor, and be connected with the processor, use In the memorizer in data storage storehouse;
The input equipment, for obtaining target search sentence, and by the target search sentence send to Processor;
The processor is used to call the data base in the memorizer, and carries out according to target search sentence Data query;It is specifically as follows:For by parsing target search sentence, obtaining the target search language Between grouping field in the field in common and the target search sentence of two tables of data involved by sentence Mapping relations;Wherein, the tables of data comprising the grouping field is the first data in described two tables of data Table, the tables of data not comprising the grouping field is the second tables of data, and the mapping relations are according to the One condition limits sentence and inquires about what is determined in the Query Result that first tables of data is obtained;Utilizing Two query statements and second condition limit sentence and second tables of data are inquired about and obtained by virtual group In the intermediate queries result of field packet, it is determined that the second Query Result corresponding with second tables of data; Wherein, the virtual group field be created in second tables of data using the mapping relations, Equivalent to the virtual field of the grouping field in first tables of data;Using the first query statement Sentence is limited with additional conditions to inquire about first tables of data and obtain what is be grouped by the grouping field In Query Result, it is determined that the first Query Result corresponding with first tables of data;Wherein, it is described additional Condition is limited in numerical value that sentence is grouping field in first tables of data and second Query Result The numerical value of virtual group field is equal;Described the is integrated according to the logical relation in the target search sentence One Query Result and second Query Result, obtain final Query Result.
From above content, it can be seen that the application has the advantages that:
The application carries out separate query script to two tables of data.In order to realize the purpose of separate inquiry, In the second tables of data not comprising grouping field, according to first condition limit sentence create one equivalent to point The virtual group field of group field, so as to smoothly realize the query script in the second tables of data.With reference to second Inquiry Query Result is inquired about the first tables of data, due to limiting comprising second condition in the second Query Result Sentence processed, it is possible to smoothly complete the query script to the first tables of data.
Unlike the prior art, the application does not carry out whole to two tables of data in target search sentence Closing operation, but directly separate inquiry is carried out to two tables of data, so as to omit to the whole of two tables of data Conjunction process, and then improve the efficiency and accuracy rate of data query.
Description of the drawings
In order to be illustrated more clearly that the embodiment of the present application or technical scheme of the prior art, below will be to reality Apply the accompanying drawing to be used needed for example or description of the prior art to be briefly described, it should be apparent that, below Accompanying drawing in description is only some embodiments of the present application, for those of ordinary skill in the art, On the premise of not paying creative work, can be with according to these other accompanying drawings of accompanying drawings acquisition.
Fig. 1 is a kind of structural representation of across data source query system embodiment one disclosed in the embodiment of the present application Figure;
Fig. 2 is a kind of structural representation of across data source query system embodiment two disclosed in the embodiment of the present application Figure;
Fig. 3 is a kind of flow chart across data source query method disclosed in the embodiment of the present application;
Fig. 4 is another flow chart across data source query method disclosed in the embodiment of the present application;
Fig. 5 is another flow chart across data source query method disclosed in the embodiment of the present application;
Fig. 6 is another flow chart across data source query method disclosed in the embodiment of the present application;
Fig. 7 is another flow chart across data source query method disclosed in the embodiment of the present application;
Fig. 8 is another flow chart across data source query method disclosed in the embodiment of the present application;
Fig. 9 is a kind of syntax tree schematic diagram across data source query method disclosed in the embodiment of the present application;
Figure 10 is a kind of structural representation across data source query device disclosed in the embodiment of the present application;
Figure 11 is the signal of acquiring unit in a kind of across data source query device disclosed in the embodiment of the present application Figure;
Figure 12 is that first processing units are shown in a kind of across data source query device disclosed in the embodiment of the present application It is intended to;
Figure 13 is that the second query unit is shown in a kind of across data source query device disclosed in the embodiment of the present application It is intended to;
Figure 14 is that the first determining unit is shown in a kind of across data source query device disclosed in the embodiment of the present application It is intended to;
Figure 15 is the signal of integral unit in a kind of across data source query device disclosed in the embodiment of the present application Figure.
Specific embodiment
Before the detailed content of the application is introduced, a target search sentence is introduced first, so as to reader It is apparent that follow-up detailed content.
Generally, target search sentence can include that query statement, condition limit sentence, packet language Sentence and quantity limit sentence, it is, of course, also possible to including other sentences, here will not enumerate.Wherein, Query statement includes searching keyword and its corresponding inquiry field, and condition limits sentence and limits including condition Key word and its corresponding condition field, packet sentence includes packet key word and its corresponding grouping field, Quantity limits sentence includes that quantity limits key word and its constant, and constant is used to represent the data for limiting output Quantity.
For example, it is assumed that having two tables of data " register " and " list of results ", " register " includes " student number ", " name ", " class ", the data set of " department of the Chinese Academy of Sciences " and each field;" achievement Data set of the table " comprising " student number ", " fraction " and each field;The common word of two tables of data Section is " student number ".
On the basis of above-mentioned tables of data, a target search sentence example is enumerated:
Select student numbers, name, class
From register and list of results
Where registers. student number=list of results. student number and registers. the department of the Chinese Academy of Sciences=the first department of the Chinese Academy of Sciences and list of results. Fraction > 60
Group by registers. class
limit 0,10
" select student numbers, name, class " is query statement in above-mentioned query statement, and " select " is Searching keyword " student number, name, class " is 3 inquiry fields.
" from register and list of results where registers. student number=list of results. student number and registers. learn Portion=the first department of the Chinese Academy of Sciences and list of results. fraction > 60 " sentence is limited for condition, wherein, " from " and " where " Limit key words for 2 conditions, " register and list of results " and " register. student number=list of results. Number and registers. the department of the Chinese Academy of Sciences=the first department of the Chinese Academy of Sciences and list of results. fraction > 60 " limit sentences for 2 conditions.
" group by registers. class " to be grouped sentence, wherein, " group by " is packet key word, " register. class " it is grouping field.
" limit 0,10 " limits sentence for quantity, wherein, " limit " is that quantity limits key word, " 0,10 " For constant.
The example of the above-mentioned target search sentence meaning to be expressed is:Pass through in register and list of results Student number field sets up the association of two tables of data, then searches for and searches for first department of the Chinese Academy of Sciences in all classmate's data , achievement more than the student number of 60 points of classmates, name and class, and after being grouped by class, by up to The lower student number for exporting top 10, name and class.
It is more than one to target search sentence simple introduction, searches so that reader more has a clear understanding of target The structure of rope sentence.
Below in conjunction with the accompanying drawing in the embodiment of the present application, the technical scheme in the embodiment of the present application is carried out Clearly and completely describe, it is clear that described embodiment is only some embodiments of the present application, and It is not all, of embodiment.Based on the embodiment in the application, those of ordinary skill in the art are not doing Go out the every other embodiment obtained under the premise of creative work, belong to the scope of the application protection.
Before the specific embodiment of the application is introduced, across data source query system is introduced first, so as to clear The application scenarios of the application are introduced by Chu.
As shown in figure 1, a kind of embodiment one across data source query system provided for the application, including:
Be stored with the processor 11 of data base, the input equipment 12 being connected with the processor 11.
Wherein, the input equipment 12, for obtaining target search sentence, and by the target search language Sentence is sent to processor 11;Processor 11 is used to carry out data query according to target search sentence.
In the system shown in figure 1, input equipment 12 can obtain the target search sentence of user input, Or, the target search sentence for obtaining miscellaneous equipment transmission and coming, and target search sentence is sent to place Reason device 11.Because processor 11 itself just has data base, it is possible to call the data base of therein Carry out data query.
As shown in Fig. 2 a kind of embodiment two across data source query system provided for the application, including:
Processor 21, the input equipment 22 being connected with the processor 21, and with the processor 21 Memorizer 23 connected, for data storage storehouse.
The input equipment 22, for obtaining target search sentence, and the target search sentence is sent To processor;The processor 21 is used to call the data base in the memorizer 23, and according to target Search statement carries out data query.
In the embodiment shown in Figure 2, input equipment 22 can obtain the target search sentence of user input, Or, the target search sentence for obtaining miscellaneous equipment transmission and coming, and target search sentence is sent to place Reason device 21.Because, without data base, processor 21 can be with far call memorizer 23 on processor 21 Data base, so as to realize data query process.
On the basis of across the data source query system shown in Fig. 1 and Fig. 2, depending on processor can To realize data query process.Carry out the process of data query according to target search sentence to processor below Describe in detail.
The purpose of the application is to carry out data query in two of data base and plural tables of data, And there is incidence relation between each tables of data, that is, realize across data source query.The pass of each tables of data Connection relation can be represented by the field in common between two tables of data.
For example, data base has three tables of data, respectively tables of data 1, tables of data 2 and tables of data 3;And And, tables of data 1 and tables of data 2 have a field in common A, and tables of data 2 and tables of data 3 have one Individual field in common B.So tables of data 1 can be associated by field in common A with tables of data 2, tables of data 2 Can be associated with tables of data 3 by field in common B, tables of data 1 can be with number indirectly by tables of data 2 Associate according to table 3, so tables of data 1, tables of data 2 and tables of data 3 can pass through field in common A and be total to It is interrelated with field B.
The application can be carried out across data source query to two and plural tables of data, carried out data and looked into The general procedure of inquiry is to carry out data query in field in common two tables of data first, is obtained Query Result carry out data query with another tables of data with field in common again, the like, until Till all of tables of data inquiry is finished.
For example, the example above is continued, the query script of the application can first to field in common A's Tables of data 1 and tables of data 2 carry out data query, so as to obtain Query Result 1.It is understood that by There is field in common B in tables of data 2, so also having field in common B in Query Result 1.Then, Again data query is carried out to the Query Result 1 with field in common B and tables of data 3, it is final so as to obtain Query Result.
From the above, it is seen that the application has the number of field in common in one query process to two Data query is carried out according to table;For example, data query is carried out to tables of data 1 and tables of data 2, or, it is right Query Result 1 (Query Result is also tables of data) and tables of data 3 carry out data query.Due to inquiry every time Process is only the difference of tables of data, and performed comprising the concrete steps that is consistent, so the application is follow-up only One query process is described in detail, the data query that remainder data query script is provided with the application Process is similar to, therefore repeats no more.
The application is applied to processor, processor can with receiving user's input, or, receive at other The target search sentence that reason device sends;Then call the data base of its memory, or far call its The data base of its memorizer, so as to realize that the purpose of data base is inquired about according to target search sentence.
The application is directed to across data source query, and target search sentence can be related to two tables of data.With existing skill Unlike art, the application does not carry out integrated operation to two tables of data, but directly to two data Table carries out separate inquiry, so as to omit the integration process to two tables of data, and then improves data query Efficiency and accuracy rate.
If two tables of data being related in target search sentence are respectively the first tables of data and the second tables of data, Also, the tables of data comprising grouping field is the first tables of data, the tables of data not comprising grouping field is the Two tables of data.In order to realize the inquiry to the first tables of data and the second tables of data, target search sentence certainty Comprising the first search statement and the second search statement for the second tables of data for the first tables of data.
In order to realize that two tables of data are separately inquired about with purpose, needs are extracted respectively in target search sentence Go out the first search statement and with the second search statement.First search statement includes the first query statement and first Condition limits sentence;Sentence is limited in second search statement comprising the second query statement and second condition.Such as Fruit is directly inquired about using the first search statement in the first tables of data, is directly existed using the second search statement Second tables of data is inquired about, then cannot smoothly complete the inquiry to two tables of data.Its reason is: The second condition without the second tables of data limits sentence in first search statement, does not have in the second tables of data The first condition of the first tables of data limits the grouping field of sentence and the first tables of data.
For example, first example of description is continued, can be according to the first search statement in " register " Carry out data query (to inquire about " first department of the Chinese Academy of Sciences ", " student number ", " name " and " class ", and press Grouping field " class " is grouped), but, have no idea with reference to the condition limit in " list of results " Sentence processed is inquired about (inquiry that cannot complete " fraction > 60 ").Can be with " list of results " Second search statement is inquired about (inquire about " student number " and complete the inquiry of " fraction > 60 "), but First condition in " register " cannot be completed limit sentence and packet sentence (cannot to inquire about and obtain " the The data of one department of the Chinese Academy of Sciences ", and be grouped by grouping field " class ").
For the purpose for realizing separately inquiring about two tables of data, present techniques personnel envision:Since the Two tables of data query scripts are limited in that, sentence and the are limited without first condition in the second search statement Two tables of data are without grouping field, then in order to eliminate limitation, and first can be combined in the second tables of data Condition limits sentence and creates a virtual group field, to complete first condition in the second tables of data Sentence and the query script being grouped according to virtual group field are limited, is counted to second so as to smoothly complete According to the inquiry of table, and obtain the second Query Result.
The implication of virtual group field is not include grouping field, the application in real second tables of data A field equivalent to grouping field is created, its effect is consistent with grouping field, therefore be referred to as virtual Grouping field.Because the first tables of data and the second tables of data have field in common, wrap in the first tables of data Mapping relations containing grouping field and field in common, by common in the first tables of data and the second tables of data The cascade connection of field, can create virtual group field in the second tables of data.
The query script of the first tables of data is limited in that:Limit without second condition in first search statement Sentence.Sentence is limited because the second Query Result has met second condition, so, can only to first The data of the second Query Result are met in tables of data, is inquired about in conjunction with the first search statement;Although the Sentence is limited without second condition in one search statement, but the second Query Result has met second condition Sentence is limited, so can cause covert in the first search statement to increased the with reference to the second Query Result Two conditions limit sentence, so as to smoothly complete the inquiry to the first tables of data, and obtain the first Query Result.
Therefore, the major technique thinking of the application is:Language is limited with reference to the first condition of the first search statement Sentence, determines virtual group field in the second tables of data, and using the second search statement combined with virtual word is grouped Section carries out data query in the second tables of data, obtains the second Query Result.Then, using the first search phrase First query statement of sentence combines the second Query Result, data query is carried out in the first tables of data, so as to obtain Obtain the first Query Result.And Data Integration is carried out to the first Query Result and the second Query Result, so as to obtain Obtain final Query Result.
The concrete implementation procedure of the application is described in detail below.As shown in figure 3, the application is provided A kind of across data source query method, specifically includes following steps S301~S304:
Step S301:By parsing target search sentence, two involved by the target search sentence are obtained The mapping relations between grouping field in the field in common of individual tables of data and the target search sentence;Its In, the tables of data comprising the grouping field is the first tables of data in described two tables of data, not comprising institute The tables of data for stating grouping field is the second tables of data, and the mapping relations are to limit language according to first condition Determine in the Query Result that sentence inquiry first tables of data is obtained, the first condition limits sentence Sentence is limited for condition related to first tables of data in the target search sentence.
Processor parses target search sentence after target search sentence is obtained, first, so that it is determined that mesh Two tables of data involved by mark search statement, and then the field included by two tables of data, therefrom Determine the field in common having of two tables of data.Parsing target search sentence can obtain being grouped sentence, Comprising packet key word and grouping field in packet sentence, the tables of data comprising grouping field is defined as into the One tables of data, another tables of data is referred to as the second tables of data.
After being parsed to target search sentence, it should perform and first is combined in the second tables of data Part limits the process that sentence creates a virtual group field.Due in the process for creating virtual group field Need according to the mapping relations in the first tables of data between grouping field and field in common;For this purpose, tying first Close first condition and limit sentence, the mapping between grouping field and field in common is determined in the first tables of data Relation.
As shown in figure 4, determining the process of mapping relations, specifically may include steps of:
Step S401:Sentence is limited with reference to the first condition, inquiry and institute in first tables of data State grouping field and the corresponding first mapping data set of the field in common;Wherein, first mapping Data set includes grouped data collection corresponding with the grouping field, and the field in common corresponding The first number in one data set, and the grouped data of the packet data convergence and first data set According in one-to-one relationship.Wherein, the grouped data collection include several grouped datas, described first Data set includes several first data.
Due to limiting sentence without first condition in the second tables of data, therefore virtual group field is created building Mapping relations when, with reference in the first search statement first condition limit sentence the first tables of data is carried out Inquiry, so that obtaining the first mapping data set and meeting first condition sentence is limited, and this is follow-up existing The data query of the second tables of data lays the first stone.
Detailed process can be:Parsing target search sentence after, in target search sentence extract with The related condition of first tables of data limits sentence, is defined as first condition and limits sentence.For example, first is real Applying the where registers of example. the department of the Chinese Academy of Sciences=the first department of the Chinese Academy of Sciences, then be related to the first tables of data (register) Condition limits sentence.
Sentence is limited with reference to first condition, inquiry packets field and field in common are right in the first tables of data The the first mapping data set answered.First mapping data set includes grouped data collection corresponding with grouping field, And the first data set corresponding with field in common, and the grouped data of packet data convergence and the first number There is one-to-one relationship according to the first data concentrated.
For example, so that the first tables of data is as register as an example, referring to the instantiation that table 1 is register:
Table 1
It is where registers that the condition related to the first tables of data (register) limits sentence. the department of the Chinese Academy of Sciences=the One department of the Chinese Academy of Sciences, then limit sentence and the first tables of data inquired about, so as to obtain comprising altogether according to first condition With field and the first mapping data set of grouping field.Referring to table 2, after this step is performed, can delete Except department of the Chinese Academy of Sciences's field is not the data of first department of the Chinese Academy of Sciences, only it is left the data that the department of the Chinese Academy of Sciences is first department of the Chinese Academy of Sciences.
Table 2
Student number Class
(field in common) (grouping field)
001 One class
002 One class
003 Two classes
004 Two classes
005 Class Three
…… ……
Step S402:In the described first mapping data set, by the grouped data of the packet data convergence One-to-one relationship between the first data in first data set, is defined as the grouping field The mapping relations between the field in common.
In Table 2, it can be seen that including packet count corresponding with grouping field in the first mapping data set According to collection (one class, one class, two classes ...), and the first data set corresponding with field in common (001, 002nd, 003 ...), the first data of the grouped data of grouped data collection and the first data set have one by one Corresponding relation;The one-to-one relationship is defined as into mapping relations.
For example, one class of the correspondence of student number 001, two classes of the correspondence of student number 003, the corresponding class Three of student number 005;Point The corresponding relation of group data and the first data can be mapping relations.
After the mapping relations of grouping field and field in common are determined in the first tables of data, just can foundation Mapping relations create virtual group field in the second tables of data, it is possible to using the second search statement set Virtual group field carries out data query to the second tables of data.
Fig. 3 is then returned to, into step S302:Language is being limited using the second query statement and second condition Sentence is inquired about second tables of data and obtained in the intermediate queries result by the packet of virtual group field, It is determined that the second Query Result corresponding with second tables of data;Wherein, the virtual group field is profit It is being created in second tables of data with the mapping relations, equivalent to the institute in first tables of data State the virtual field of grouping field;It is described that second query statement and the second condition limit sentence The query statement related to second tables of data and condition limit sentence in target search sentence.
There is field in common in the second tables of data and the first tables of data, with field in common in the second tables of data Corresponding data set is the second data set;Second data set includes several the second data.By second Data set and mapping relations, create virtual group field in the second tables of data.
The process of virtual group field is built in the second tables of data, as shown in figure 5, specifically including following Step:
Step S501:With the second tables of data the second data set corresponding with field in common, one is determined Second data.
Step S502:Judge that the second data whether there is in mapping relations;Whether judge the second data It is equal with first data in mapping relations;If exist step S503 is entered, otherwise into step S504.
First mapping data set it is corresponding with field in common is the first data set, in the second tables of data and It is the second data set that field in common is corresponding.The second data in only the second data set and the first data set In the first data it is equal in the case of, the first tables of data and the second tables of data just have incidence relation.If In the case of second data are unequal with the first data, do not have between the first tables of data and the second tables of data Incidence relation.Only virtual point can be created according to the incidence relation of the first tables of data and the second tables of data Group field.
Step S503:By in the mapping relations with the one-to-one grouped data of first data, really It is set to virtual group data corresponding with second data.
In the case where the second data and the first data are equal, illustrate to be stored with mapping relations and second The corresponding mapping relations of data, thus in mapping relations inquiry with the first data (or with the first data The second equal data) corresponding grouped data, the grouped data for being obtained is corresponding with the second data Virtual group data.
For example, so that the second tables of data is as list of results as an example, referring to the example that table 3 is list of results:
Table 3
The second data for assuming selection are 001, by being contrasted with the mapping relations shown in table 2, are found Second data 001 are equal with the first data 001 in mapping relations, therefore, it can the first data 001 Corresponding in mapping relations " one class " is defined as and the corresponding virtual group data of the second data 001. For another example, if the second data are 006, first data consistent with the second data cannot be found in table 2, Then illustrate that the second data cannot obtain corresponding virtual group data in mapping relations.
Virtual group field and virtual group number corresponding with virtual group field can be obtained by this step According to collection.For example, continue examples detailed above, be the second tables of data for increasing virtual group field, referring to table 4:
Table 4
Step S504:Judge whether there are the second data not matched in second tables of data, enter if having Enter step S501, if nothing program is terminated.
Mistake shown in Fig. 5 referred to as creates the process of virtual group field, it is to be understood that said process Can carry out before the second tables of data is inquired about, it is also possible to which dynamic is raw in the query script of the second tables of data Into here does not limit the creation time of virtual group field.
Create after virtual group field in the second tables of data, data can be carried out to the second tables of data and be looked into Ask.For this purpose, can extract in target search sentence the second query statement corresponding with the second tables of data and The second condition limits sentence, and (the second query statement and second condition limit sentence and are the second search phrase Sentence), second tables of data is inquired about.Then, by output after virtual group field packet Intermediate queries result, determines the second Query Result corresponding with the second tables of data in intermediate queries result.
For example, table 3 is after the inquiry of the second search statement, delete data of the fraction less than 60 and It is empty data to delete grouping field (class), and the result for obtaining is grouped by class, is obtained The second Query Result can be as shown in table 4.
Table 4
The above is the query script to the second tables of data, is described below and is combined using the first query statement Second Query Result, the query script to the first tables of data.
Fig. 3 is then returned to, into step S303:Language is being limited using the first query statement and additional conditions Sentence is inquired about first tables of data and obtained in the Query Result by grouping field packet, it is determined that The first Query Result corresponding with first tables of data;Wherein, it is institute that the additional conditions limit sentence State the numerical value of grouping field in the first tables of data and the number of virtual group field in second Query Result Value is equal;First query statement includes related to first tables of data in the target search sentence Query statement.
Second Query Result limits sentence, the second query statement and Article 2 to have met first condition Part limits the Query Result of sentence.So, the second Query Result has substantially been final result set. So when the first tables of data is inquired about, the second Query Result can be combined to the merely with the first query statement One tables of data carries out data query.
In actual applications, it is possible to use additional conditions limit sentence to realize combining the second Query Result Purpose.Because the second Query Result includes field in common, field in common is also included in the first tables of data, When the field in common numerical value of a data in the first tables of data is equal to the field in common numerical value of the second Query Result When, it is believed that the data has met all of search statement, such that it is able to export inquiry field Content.
For example, so that the first tables of data is as register as an example, the first query statement for " select student numbers, name, Class ".With reference to the first tables of data (table 1) and the second Query Result (table 4), in the first tables of data (table 1) data that field in common (student number) is included in the second Query Result (table 4) are searched in;I.e. student number 002, 003rd, 004 and 005 corresponding data.Then export student number 002,003,004 and 005 corresponding student number, Name and class, and be grouped by grouping field (class), so as to obtain the first Query Result.Ginseng 5 are shown in Table, are the example of the first Query Result.
Table 5
Step S304:First Query Result is integrated according to the logical relation in the target search sentence With second Query Result, final Query Result is obtained.
In some cases, in the first Query Result and the Query Result summation of the second Query Result, not It is final Query Result;Also need to carrying out corresponding logic to the first Query Result and the second Query Result Relation is integrated, and can just access final Query Result.
As shown in fig. 6, the detailed process of this step is described below:
Step S601:Judge target search sentence target query result with the first Query Result and the second inquiry Whether Query Result summation as a result meets, and if so, then terminates program, otherwise into step S602.
For example, it is assumed that the target query result of target search sentence is field A, sum (field B)/sum (words Section C) and field D, and the first Query Result is only comprising field A and sum (field B), the second inquiry knot Fruit includes sum (field C) and field D.By contrast it is found that field A and field D and target Query Result is consistent, accordingly, it is determined that field A and field D are final Query Result.But sum (fields B) do not correspond with sum (field C) and sum (field the B)/sum (field C) in target query result;So, Sum (field B) and sum (field C) is intermediate result, rather than finally Query Result.
Step S602:Filter out in first Query Result and second Query Result and do not meet institute State at least two intermediate results of target query result.
In the first Query Result and the second Query Result, do not meet target query result is not then final Query Result, but intermediate result.Accordingly, it would be desirable to intermediate result is screened, and according to intermediate result Corresponding logical relation, carry out logical operationss.
For example, continue a upper example, in the first Query Result and the second Query Result middle knot is filtered out Fruit is sum (field B) and sum (field C).
Step S603:According to the logical operator of at least two intermediate result, calculate described at least two The operation result of individual intermediate result.
The logical operator of at least two intermediate results is determined in target query result, using logical operationss Symbol carries out logical operationss at least two intermediate results, so as to obtain operation result.
For example, sum (field B) and sum (field C) are contrasted with target query result, is found It is "/" that sum (field B) and sum (field C) needs the logical operationss for carrying out;I.e. to sum (field B) Division arithmetic is carried out with sum (field C), so as to obtain final Query Result.
Step S604:Look into the target is met in first Query Result and second Query Result Other Query Results and the operation result of result are ask, is defined as the final Query Result.
For example, field A and field D are determined in the first Query Result and the second Query Result, and Sum (field B) after logical operationss/sum (field C), then by field A, sum (field B)/sum (field C), and field D is defined as final Query Result.
From above content, it can be seen that the application has the advantages that:
The application carries out separate query script to two tables of data.In order to realize the purpose of separate inquiry, In the second tables of data not comprising grouping field, according to first condition limit sentence create one equivalent to point The virtual group field of group field, so as to smoothly realize the query script in the second tables of data.With reference to second Inquiry Query Result is inquired about the first tables of data, due to limiting comprising second condition in the second Query Result Sentence processed, it is possible to smoothly complete the query script to the first tables of data.
Unlike the prior art, the application does not carry out whole to two tables of data in target search sentence Closing operation, but directly separate inquiry is carried out to two tables of data, so as to omit to the whole of two tables of data Conjunction process, and then improve the efficiency and accuracy rate of data query.
Introduce some special implementation procedures of separate step in the application again below:
Recall step S402 shown in Fig. 4:In the described first mapping data set, by the packet The one-to-one relationship between the first data in grouped data and first data set in data set, The mapping relations being defined as between the grouping field and the field in common.
It is determined that during mapping relations, it is possible to use the full content of the first mapping data set, can also utilize The partial content of the first mapping data set.Because the data volume of the first mapping data set is than larger, typically most Whole Query Result is arranged at forward position, it is possible to select arrangement forward in the first mapping data set Partial content determine mapping relations.
The selected section content in the first mapping data set is described in detail below, the process of mapping relations is determined. As shown in fig. 7, specifically including:
Step S701:The part number that will be chosen by order from top to bottom in the described first mapping data set According to collection, it is defined as the second mapping data set.Because the data in the first mapping data set are arranged in order, Generally, desired data is at the position for arranging before examination, it is possible to select arrangement portion before examination Divided data collection.A specified quantity can specifically be set.Specified quantity is used to limit selected section data The quantity of collection.
It is assumed that specified quantity is 1000, then sequence number 0- sequence number 1000 is selected in the first mapping data set 1000 datas, as second mapping data set.
Step S702:In the described second mapping data set, by the grouped data of the packet data convergence One-to-one relationship between the first data in first data set, is defined as the grouping field The mapping relations between the field in common.
The mapping relations of grouping field and field in common are determined in the second mapping data set, after this, Step S302 in Fig. 3 can be performed:Using the second query statement and second condition sentence is being limited to described Second tables of data is inquired about and obtained in the intermediate queries result by the packet of virtual group field, it is determined that and institute State corresponding second Query Result of the second tables of data.
Step S302 can be subdivided into two steps:
Step S3021:Sentence is limited using the second query statement and second condition to look into second tables of data Ask and obtain the intermediate queries result being grouped by virtual group field.
Step S3022:In intermediate queries result, it is determined that the second inquiry corresponding with second tables of data As a result.
It is determined that the second Query Result corresponding with the second tables of data, can be divided into two kinds of situations:
The first situation:In the case where the target search sentence limits sentence not comprising quantity, by institute State intermediate queries result and be defined as second Query Result.
Generally, the data bulk of intermediate queries result is larger, and some target search sentences include number Amount limits sentence, for limiting the quantity of output result.Quantity is not included in some target search sentences Sentence is limited, i.e., does not limit the quantity of output result.In this case, it is possible to directly all of centre is looked into Ask result and be defined as the second Query Result.
Second situation:In the case where the target search sentence limits sentence comprising quantity, then will be The data of the predetermined number extracted in the intermediate queries result, are defined as second Query Result.
Quantity is limited in sentence and includes the predetermined number that output result is limited, due to intermediate queries result Data bulk it is larger, so, in the intermediate queries result, put in order by up to by existing The data of the predetermined number of lower intercepting, are defined as second Query Result.
Assume the intermediate queries result for obtaining through step 701, step S702 and step S3021 for the first time Represented using intermediate queries result 1.As shown in figure 8, for the concrete implementation procedure of second situation:
Step S801:Whether the data bulk of existing intermediate queries result is judged less than predetermined number, if Not less than then into step S802;If being less than, into step S803.
Data due to needing to extract predetermined number in intermediate queries result 1, are defined as the second inquiry knot Really, it is therefore desirable to first judge whether there are enough data bulks in intermediate queries result 1.If There are enough data bulks in intermediate queries data 1, be then directly entered step S802, determine the second inquiry As a result.
Step S802:In existing intermediate queries result, by what is extracted in the intermediate queries result The data of predetermined number, are defined as second Query Result.
Step S803:The second mapping data set is redefined, again execution step S702, S702 and step Rapid S3021, it is determined that new intermediate queries result, into step S801.
If the number of predetermined number cannot be extracted without enough data bulks in intermediate queries data 1 According to.This side light intermediate queries result 1 using second mapping data set data volume it is very few, cause Sufficient amount of second Query Result cannot be extracted now.
Accordingly, it would be desirable to redefine the second mapping data set, it is assumed that what intermediate queries result 1 was used For the data of sequence number 0- sequence number 1000, then 1000 datas of reselection sequence number 1000- sequence number 2000, It is defined as the second mapping data set.
With reference to the second mapping data set, step S702 and step S3021 are repeated, determine intermediate queries As a result 2.Then into step S801.
The data bulk summation of intermediate queries result 1 and intermediate queries result 2 is judged in step S801 is It is no to show enough data bulks if not less than predetermined number less than predetermined number, can be in centre Determine the second Query Result in Query Result 1 and intermediate queries result 2.
If the data bulk summation of intermediate queries result 1 and intermediate queries result 2 is still less than predetermined number, Then explanation cannot determine the second Query Result using intermediate queries result 1 and intermediate queries result 2;Now Step S803, step S702 and step S3021 can be repeated, until all of intermediate queries result Data bulk summation be not less than predetermined number.
It is above all detailed implementations of the application.
Below by another instantiation, the detailed step of the application is illustrated:
It is assumed that:First tables of data is t1 tables:a,b,c;Second tables of data is t2 tables:c,d,e,f;T1 tables and t2 Table is not or not uniform data source, or even one is mysql data sources, and one is oracle data sources.
Target search sentence is:
select t1.a,sum(t1.b)/sum(t2.d),sum(t2.e),t1.c
From t1left join t2on t1.c=t2.c
Where t1.b=8and t2.d=9
group by t1.a
limit 20
The first step:By parsing target search sentence, the syntax tree of target search sentence is obtained;Wherein, The father node of the syntax tree is each key word in the target search sentence, each under each key word The analysis result of individual rank is the child node of the father node, and afterbody analysis result is the leaf of the father node Child node.Detailed syntax tree is as shown in Figure 9.
Regulation has key word in data base, and the corresponding node of key word is father node in target search sentence, Such as, select, from, where, group by and limit.Content between two key words is previous pass The child node of keyword.Such as, the content between select, from is select child nodes, e.g., t1.a,sum(t1.b)/sum(t2.d),sum(t2.e),t1.c。
Involved two tables of data t1 table and t2 tables are can determine by parsing target search sentence, it is crucial Field a after word group by is grouping field.The field in common of two tables of data is field c.
Second step:Inquiry mapping data set simultaneously determines mapping relations.
The first condition related to t1 tables is extracted in syntax tree and limits sentence (where t1.b=8), then In t1 tables, the mapping data set of inquiry packets field a and field in common c.Specific query statement can Think:
select a,c
from t1
Where b=8
group by a,c
order by a,c
limit 10000
Sentence is limited due to being related to the related first condition of t1 tables in query script, so, map data set Data query can be carried out equivalent to t1 tables.
Quantity in this step limits sentence and is changed to " limit 10000 " by original " limit 20 ", is Because subsequent process needs the second Query Result of the mapping data Integrated query t2 tables obtained in t1 tables.By The data set for meeting first condition restriction sentence in t1 may be very big, so by field a, c packets And after sorting, from top to bottom select the 10000 datas composition mapping number between sequence number 0- sequence number 10000 According to collection.So as to reduce the data bulk of process, to increase inquiry velocity.Wherein, 10000 is this enforcement The quantity of concrete setting in example, in actual applications can be according to practical situation depending on, here is not limited.
According to mapping data set, by the data set of field a and the one of the data set of field c in mapping data set One corresponding relation, is defined as mapping relations.
3rd step:Virtual group field is built in the second tables of data, and data query is carried out in t2 tables.
According to mapping relations, according to mapping data set dynmaic establishing virtual grouping field in t2 tables.Pair with Numerical value 1 in field c in t2 tables, if during its presence is equal with the numerical value 2 of mapping data set field c, By the numerical value 3 of corresponding grouping field a of numerical value 2 in mapping data set, it is defined as and the corresponding void of numerical value 1 Intend the value of field.In this way, virtual group field is built in the second tables of data.Then, exist The second search statement, and combined with virtual grouping field are obtained in syntax tree, in the second tables of data line number is entered It is investigated that ask, so as to obtain Query Result 1.
Detailed query statement can be:
select sum(t2.d),sum(t2.e)
case
for(Object aValue in Map.keySet())
{when t2.c in Map.get(aValue)then aValue}
as t2.a
from t2
Where t2.d=9
group by t2.a order by t2.a
limit 20
Query Result 1 can be obtained after this step is finished, due to limiting output knot in this inquiry The quantity of fruit is 20, so when the data bulk of fruit Query Result 1 is not less than 20, then in this step Just final data collection can be locked.But, if the data bulk of Query Result 1 is less than 20, it was demonstrated that still Non-locking final data collection.At this time, it may be necessary in second step, quantity limits sentence in change second step limt 10000,20000;Query Result 2 is obtained the 3rd step is repeated;Then Query Result 1 is being judged Whether 20 are less than with the data bulk summation of Query Result 2, if still less than 20, continuing to repeat Second step and the 3rd step are performed, until the data bulk summation of resulting all Query Results is not less than 20 Bar.
4th step:Inquiry is carried out to the first tables of data and obtains the first Query Result.
Due to determining that the second Query Result has been to meet the second search statement and first condition in the third step Limit the result of sentence, that is, final result set.The first query statement is determined in syntax tree, and With reference to the second Query Result, in the first tables of data corresponding field contents are inquired about.
select t1.a,sum(t1.b),t1.c
from t1
Where t1.a in (a in 3 result sets)
group by t1.a
In this step, looked into according to corresponding other needs in second Query Result of t2 again Query t1 The field of inquiry, so as to obtain the first Query Result.
5th step:Integrate the first Query Result and the second Query Result.
Determine in the key word of the select in syntax tree final Query Result for t1.a, Sum (t1.b)/sum (t2.d), sum (t2.e) and t1.c.But, the first Query Result includes t1.a, sum (t1.b) And t1.c;Second Query Result includes sum (t2.d) and sum (t2.e).Therefore, in the first Query Result Sum (t2.d) in sum (t1.b) and the second Query Result is intermediate result.
Accordingly, it would be desirable to determine sum (t1.b) and sum (t2.d) in the child node of the select father nodes of syntax tree Corresponding logical relation, then, carries out logical operationss, so as to obtain to sum (t1.b) and sum (t2.d) sum(t1.b)/sum(t2.d).Then export final inquiry data set t1.a, sum (t1.b)/sum (t2.d), Sum (t2.e) and t1.c.
It is corresponding with across the data source query method of the one kind shown in Fig. 3, this application provides one kind is across data Source inquiry unit, as shown in Figure 10, including:
Acquiring unit 101, for by parsing target search sentence, obtaining involved by the target search sentence And two tables of data field in common and the target search sentence in grouping field between mapping close System;Wherein, the tables of data comprising the grouping field is the first tables of data in described two tables of data, no Tables of data comprising the grouping field is the second tables of data, and the mapping relations are according to first condition Limit sentence and inquire about what is determined in the Query Result that first tables of data is obtained, the first condition limit Sentence processed is that condition related to first tables of data in the target search sentence limits sentence;
First processing units 102, for limiting sentence to described using the second query statement and second condition Second tables of data is inquired about and obtained in the intermediate queries result by the packet of virtual group field, it is determined that and institute State corresponding second Query Result of the second tables of data;Wherein, the virtual group field is to be reflected using described Penetrate it is that relation is created in second tables of data, equivalent to first tables of data in the packet word The virtual field of section;It is the target search that second query statement and the second condition limit sentence The query statement related to second tables of data and condition limit sentence in sentence;
Second processing unit 103, for limiting sentence to described using the first query statement and additional conditions First tables of data is inquired about and obtained in the Query Result that is grouped by the grouping field, it is determined that with described the Corresponding first Query Result of one tables of data;Wherein, the additional conditions limit sentence for the described first number Numerical value according to the grouping field in table is equal with the numerical value of virtual group field in second Query Result; First query statement includes inquiry language related to first tables of data in the target search sentence Sentence;
Integral unit 104, looks into for integrating described first according to the logical relation in the target search sentence Result and second Query Result are ask, final Query Result is obtained.
As shown in figure 11, the acquiring unit 101, including:
First query unit 111, for limiting sentence with reference to the first condition, in first tables of data Middle inquiry and the corresponding first mapping data set of the grouping field and the field in common;Wherein, institute Stating the first mapping data set includes grouped data collection corresponding with the grouping field and the field in common In corresponding first data set, and the grouped data of the packet data convergence and first data set The first data be in one-to-one relationship;Wherein, the grouped data collection includes several grouped datas, First data set includes several first data;
First determines mapping relations unit 112, in the described first mapping data set, by the packet The one-to-one relationship between the first data in grouped data and first data set in data set, The mapping relations being defined as between the grouping field and the field in common.
Wherein, described first determines mapping relations unit 112, including:
It is determined that mapping data set unit 113, for will press from top to bottom in the described first mapping data set The partial data collection that order is chosen, is defined as the second mapping data set;
Second determines mapping relations unit 114, in the described second mapping data set, by the packet The one-to-one relationship between the first data in grouped data and first data set in data set, The mapping relations being defined as between the grouping field and the field in common.
Wherein, it is described to determine mapping data set unit 113, if being additionally operable to the data of the intermediate queries result Quantity is less than the predetermined number, the partial data collection that will be reselected in the described first mapping data set, It is defined as the second mapping data set.
The data bulk of even described intermediate queries result is less than the predetermined number, then repeat following Step is till the data bulk of all intermediate queries results for obtaining is not less than the predetermined number:
The partial data collection that will be reselected in the described first mapping data set, is defined as described second and reflects Penetrate data set;Described second mapping data set in, determine the grouping field and the field in common it Between the mapping relations;Using the second query statement and second condition sentence is limited to second data The intermediate queries result by the packet of virtual group field is inquired about and obtained to table.
As shown in figure 12, the first processing units 102 include:
Second query unit 121, for limiting sentence to described the using the second query statement and second condition The intermediate queries result by the packet of virtual group field is inquired about and obtained to two tables of data;
First determining unit 122, in the intermediate queries result, it is determined that with second tables of data Corresponding second Query Result.
As shown in figure 13, second query unit 121, including:
Creating unit 131, in second tables of data, using the mapping relations dynamic creation institute State virtual group field;Wherein, the virtual group field correspondence virtual group data set;Wherein, institute Stating the determination process of each virtual group data in virtual group data set includes:In second tables of data In the second data set corresponding with the field in common, second data are determined, in second data In the case of equal with first data in the mapping relations, by the mapping relations with described The one-to-one grouped data of one data, is defined as virtual group data corresponding with second data;
Output unit 132, it is right for limiting sentence according to second query statement and the second condition Second tables of data is inquired about, and is exported by the intermediate queries knot after virtual group field packet Really.
As shown in figure 14, first determining unit 122, including:
Second determining unit 141, for limiting the situation of sentence not comprising quantity in the target search sentence Under, the intermediate queries result is defined as into second Query Result;
Judging unit 142, in the case of limiting sentence comprising quantity in the target search sentence, sentences Whether the data bulk of the intermediate queries result of breaking is less than predetermined number;Wherein, predetermined number is in institute State condition and limit what is extracted in sentence;
3rd determining unit 143, if the data bulk for the intermediate queries result is default not less than described Quantity, then by the data of the predetermined number extracted in the intermediate queries result, be defined as described second Query Result.
As shown in figure 15, the integral unit 104, including:
Screening unit 151, if for first Query Result and the Query Result of second Query Result Summation does not meet with the target query result in the target search sentence, then in first Query Result Tie in the middle of do not meet the target query result at least two with filtering out in second Query Result Really;
Computing unit 152, for according to the logical operator of at least two intermediate result, calculating described The operation result of at least two intermediate results;
Final result unit 153 is determined, for by first Query Result and second Query Result Meet other Query Results and the operation result of the target query result, be defined as described final Query Result.
Referring to Fig. 1, this application provides across the data source query system embodiment one of one kind, including:
Be stored with the processor 11 of data base, the input equipment 12 being connected with the processor 11.
Wherein, the input equipment 12, for obtaining target search sentence, and by the target search language Sentence is sent to processor 11;Processor 11 is used to carry out data query according to target search sentence.
The processor 11 specifically for:By parsing target search sentence, the target search language is obtained Between grouping field in the field in common and the target search sentence of two tables of data involved by sentence Mapping relations;Wherein, the tables of data comprising the grouping field is the first data in described two tables of data Table, the tables of data not comprising the grouping field is the second tables of data, and the mapping relations are according to the One condition limits sentence and inquires about what is determined in the Query Result that first tables of data is obtained, and described first It is that condition related to first tables of data in the target search sentence limits language that condition limits sentence Sentence;Sentence is limited using the second query statement and second condition second tables of data is inquired about and obtained In the intermediate queries result that must be grouped by virtual group field, it is determined that corresponding with second tables of data the Two Query Results;Wherein, the virtual group field is in second data using the mapping relations Virtual field create in table, equivalent to the grouping field in first tables of data;Described Two query statements and the second condition limit sentence be in the target search sentence with second data The related query statement of table and condition limit sentence;Language is being limited using the first query statement and additional conditions Sentence is inquired about first tables of data and obtained in the Query Result by grouping field packet, it is determined that The first Query Result corresponding with first tables of data;Wherein, it is institute that the additional conditions limit sentence State the numerical value of grouping field in the first tables of data and the number of virtual group field in second Query Result Value is equal;First query statement includes related to first tables of data in the target search sentence Query statement;According to the logical relation in the target search sentence integrate first Query Result and Second Query Result, obtains final Query Result.
Referring to Fig. 2, the application also provides a kind of across data source query system embodiment two, including:
Processor 21, the input equipment 22 being connected with the processor 21, and with the processor phase Memorizer 23 connect, for data storage storehouse;
The input equipment 22, for obtaining target search sentence, and the target search sentence is sent To processor;The processor 21 is used to call the data base in the memorizer 23, and according to target Search statement carries out data query.
The processor is specifically for by parsing target search sentence, obtaining the target search sentence Reflecting between the grouping field in the field in common of two involved tables of data and the target search sentence Penetrate relation;Wherein, the tables of data comprising the grouping field is the first tables of data in described two tables of data, Tables of data not comprising the grouping field is the second tables of data, and the mapping relations are according to first Part limits sentence and inquires about what is determined in the Query Result that first tables of data is obtained, the first condition It is that condition related to first tables of data in the target search sentence limits sentence to limit sentence; Sentence is limited using the second query statement and second condition to inquire about second tables of data and obtain by void In intending the intermediate queries result of grouping field packet, it is determined that the second inquiry corresponding with second tables of data As a result;Wherein, the virtual group field is to be created in second tables of data using the mapping relations Virtual field building, equivalent to the grouping field in first tables of data;Second inquiry It is related to second tables of data in the target search sentence that sentence and the second condition limit sentence Query statement and condition limit sentence;Using the first query statement and additional conditions sentence is being limited to institute State the first tables of data inquire about and obtain by the grouping field be grouped Query Result in, it is determined that with it is described Corresponding first Query Result of first tables of data;Wherein, it is described first that the additional conditions limit sentence The numerical value phase of the numerical value of the grouping field in tables of data and virtual group field in second Query Result Deng;First query statement includes related to first tables of data in the target search sentence looking into Ask sentence;First Query Result and described is integrated according to the logical relation in the target search sentence Second Query Result, obtains final Query Result.
If the function described in the present embodiment method is realized and as independent using in the form of SFU software functional unit Production marketing or when using, during a computing device read/write memory medium can be stored in.Based on so Understanding, the part or the part of the technical scheme that the embodiment of the present application contributes to prior art can To be embodied in the form of software product, the software product is stored in a storage medium, if including Dry instruction is used so that computing device (can be personal computer, server, mobile computing device Or the network equipment etc.) perform all or part of step of each embodiment methods described of the application.And it is front The storage medium stated includes:USB flash disk, portable hard drive, read only memory (ROM, Read-Only Memory), Random access memory (RAM, Random Access Memory), magnetic disc or CD etc. are various can With the medium of store program codes.
Each embodiment is described by the way of progressive in this specification, and each embodiment is stressed The difference with other embodiments, between each embodiment same or similar part mutually referring to.
The foregoing description of the disclosed embodiments, enables professional and technical personnel in the field to realize or use The application.Various modifications to these embodiments will be for those skilled in the art aobvious and easy See, generic principles defined herein can in the case of without departing from spirit herein or scope, Realize in other embodiments.Therefore, the application is not intended to be limited to the embodiments shown herein, And it is to fit to the most wide scope consistent with principles disclosed herein and features of novelty.

Claims (20)

1. across the data source query method of one kind, it is characterised in that include:
By parsing target search sentence, two tables of data involved by the acquisition target search sentence The mapping relations between grouping field in field in common and the target search sentence;Wherein, described two The tables of data comprising the grouping field is the first tables of data in individual tables of data, not comprising the grouping field Tables of data be the second tables of data, the mapping relations are to limit sentence inquiry according to first condition described Determine in the Query Result that first tables of data is obtained;
Sentence is limited using the second query statement and second condition second tables of data is inquired about and obtained In the intermediate queries result that must be grouped by virtual group field, it is determined that corresponding with second tables of data the Two Query Results;Wherein, the virtual group field is in second data using the mapping relations Virtual field create in table, equivalent to the grouping field in first tables of data;
Sentence is limited using the first query statement and additional conditions first tables of data is inquired about and obtained In must be by the Query Result of grouping field packet, it is determined that corresponding with first tables of data first looks into Ask result;Wherein, the additional conditions limit the number that sentence is the grouping field in first tables of data Value is equal with the numerical value of virtual group field in second Query Result;
First Query Result and described second are integrated according to the logical relation in the target search sentence Query Result, obtains final Query Result.
2. the method for claim 1, it is characterised in that it is institute that the first condition limits sentence State condition related to first tables of data in target search sentence and limit sentence.
3. the method for claim 1, it is characterised in that second query statement and described Two conditions limit sentence be query statement related to second tables of data in the target search sentence and Condition limits sentence.
4. the method for claim 1, it is characterised in that first query statement includes described The query statement related to first tables of data in target search sentence.
5. the method for claim 1, it is characterised in that described by parsing target search sentence, Obtain the field in common and the target search sentence of two tables of data involved by the target search sentence In grouping field between mapping relations, including:
Sentence is limited with reference to the first condition, is inquired about in first tables of data and the grouping field With the corresponding first mapping data set of the field in common;Wherein, the first mapping data set includes Grouped data collection corresponding with the grouping field and corresponding first data set of the field in common, and And the grouped data of the packet data convergence and the first data in first data set are in correspond Relation;Wherein, the grouped data collection includes several grouped datas, if first data set is included Dry the first data;
In the described first mapping data set, by the grouped data of the packet data convergence and described first The one-to-one relationship between the first data in data set, is defined as the grouping field common with described The mapping relations between field.
6. method as claimed in claim 5, it is characterised in that described to map data set described first In, by between the first data in the grouped data of the packet data convergence and first data set One-to-one relationship, the mapping relations being defined as between the grouping field and the field in common, Including:
The partial data collection that will be chosen by order from top to bottom in the described first mapping data set, it is determined that For the second mapping data set;
In the described second mapping data set, by the grouped data of the packet data convergence and described first The one-to-one relationship between the first data in data set, is defined as the grouping field common with described The mapping relations between field.
7. method as claimed in claim 6, it is characterised in that it is described using the second query statement and Second condition limits sentence and second tables of data is inquired about and is obtained by the packet of virtual group field Between in Query Result, it is determined that the second Query Result corresponding with second tables of data, including:
In second tables of data, using virtual group field described in the mapping relations dynamic creation; Wherein, the virtual group field correspondence virtual group data set;Wherein, the virtual group data set In the determination process of each virtual group data include:In second tables of data and the field in common pair Second data are determined in the second data set answered, one in second data with the mapping relations In the case that individual first data are equal, will correspondingly divide with first data in the mapping relations Group data, are defined as virtual group data corresponding with second data;
Sentence is limited according to second query statement and the second condition, second tables of data is entered Row inquiry, and export by the intermediate queries result after virtual group field packet.
8. the method as described in claim 1 or 7, it is characterised in that the determination and described second Corresponding second Query Result of tables of data, including:
In the case where the target search sentence limits sentence not comprising quantity, by intermediate queries knot Fruit is defined as second Query Result;
In the case where the target search sentence limits sentence comprising quantity, the intermediate queries knot is judged Whether the data bulk of fruit is less than predetermined number;Wherein, predetermined number is to limit in sentence in the condition Extract;
If the data bulk of the intermediate queries result is not less than the predetermined number, will be in the centre The data of the predetermined number extracted in Query Result, are defined as second Query Result.
9. method as claimed in claim 8, it is characterised in that also include:
If the data bulk of the intermediate queries result is less than the predetermined number, following step is repeated Suddenly till the data bulk of all intermediate queries results for obtaining is not less than the predetermined number:
The partial data collection that will be reselected in the described first mapping data set, is defined as described second and reflects Penetrate data set;Described second mapping data set in, determine the grouping field and the field in common it Between the mapping relations;Using the second query statement and second condition sentence is limited to second data The intermediate queries result by the packet of virtual group field is inquired about and obtained to table.
10. the method for claim 1, it is characterised in that described according to the target search language Logical relation in sentence integrates first Query Result and second Query Result, obtains final inquiry As a result, including:
If the Query Result summation of first Query Result and second Query Result is searched with the target Target query result in rope sentence does not meet, then in first Query Result and the second inquiry knot At least two intermediate results for not meeting the target query result are filtered out in fruit;
According to the logical operator of at least two intermediate result, at least two intermediate result is calculated Operation result;
By meet in first Query Result and second Query Result target query result its Its Query Result and the operation result, are defined as the final Query Result.
Across the data source query device of 11. one kind, it is characterised in that include:
Acquiring unit, for by parsing target search sentence, obtaining involved by the target search sentence Two tables of data field in common and the target search sentence in grouping field between mapping close System;Wherein, the tables of data comprising the grouping field is the first tables of data in described two tables of data, no Tables of data comprising the grouping field is the second tables of data, and the mapping relations are according to first condition Limit sentence and inquire about what is determined in the Query Result that first tables of data is obtained;
First processing units, for limiting sentence to described the using the second query statement and second condition Two tables of data inquire about and obtain by virtual group field be grouped intermediate queries result in, it is determined that with it is described Corresponding second Query Result of second tables of data;Wherein, the virtual group field is using the mapping It is that relation is created in second tables of data, equivalent to the grouping field in first tables of data Virtual field;
Second processing unit, for limiting sentence to described the using the first query statement and additional conditions One tables of data is inquired about and obtained in the Query Result that is grouped by the grouping field, it is determined that with described first Corresponding first Query Result of tables of data;Wherein, it is first data that the additional conditions limit sentence The numerical value of the grouping field in table is equal with the numerical value of virtual group field in second Query Result;
Integral unit, for integrating first inquiry according to the logical relation in the target search sentence As a result with second Query Result, final Query Result is obtained.
12. devices as claimed in claim 11, it is characterised in that the acquiring unit, including:
First query unit, for limiting sentence with reference to the first condition, in first tables of data Inquiry and the corresponding first mapping data set of the grouping field and the field in common;Wherein, it is described First mapping data set includes grouped data collection corresponding with the grouping field and the field in common pair In the first data set answered, and the grouped data of the packet data convergence and first data set First data are in one-to-one relationship;Wherein, the grouped data collection includes several grouped datas, institute The first data set is stated comprising several first data;
First determines mapping relations unit, in the described first mapping data set, by the packet count According to concentrate grouped data and first data set in the first data between one-to-one relationship, really The mapping relations being set between the grouping field and the field in common.
13. devices as claimed in claim 12, it is characterised in that described first determines mapping relations list Unit, including:
It is determined that mapping data set unit, for will be suitable by from top to bottom in the described first mapping data set The partial data collection that sequence is chosen, is defined as the second mapping data set;
Second determines mapping relations unit, in the described second mapping data set, by the packet count According to concentrate grouped data and first data set in the first data between one-to-one relationship, really The mapping relations being set between the grouping field and the field in common.
14. devices as claimed in claim 13, it is characterised in that the first processing units include:
Second query unit, for limiting sentence to described second using the second query statement and second condition The intermediate queries result by the packet of virtual group field is inquired about and obtained to tables of data;
First determining unit, in the intermediate queries result, it is determined that with second tables of data pair The second Query Result answered.
15. devices as claimed in claim 14, it is characterised in that second query unit, including:
Creating unit, in second tables of data, using described in the mapping relations dynamic creation Virtual group field;Wherein, the virtual group field correspondence virtual group data set;Wherein, it is described The determination process of each virtual group data includes in virtual group data set:Second tables of data with In corresponding second data set of the field in common, determine second data, second data with In the case that first data are equal in the mapping relations, by the mapping relations with described first The one-to-one grouped data of data, is defined as virtual group data corresponding with second data;
Output unit, for limiting sentence according to second query statement and the second condition, to institute State the second tables of data to be inquired about, and export by the intermediate queries result after virtual group field packet.
16. devices as claimed in claim 14, it is characterised in that first determining unit, including:
Second determining unit, in the case of limiting sentence not comprising quantity in the target search sentence, The intermediate queries result is defined as into second Query Result;
Judging unit, in the case of limiting sentence comprising quantity in the target search sentence, judges Whether the data bulk of the intermediate queries result is less than predetermined number;Wherein, predetermined number is described Condition limits what is extracted in sentence;
3rd determining unit, if the data bulk for the intermediate queries result is not less than the present count Amount, then by the data of the predetermined number extracted in the intermediate queries result, be defined as described second and look into Ask result.
17. devices as claimed in claim 16, it is characterised in that also include:
It is described to determine mapping data set unit, if the data bulk for being additionally operable to the intermediate queries result is less than The predetermined number, the partial data collection that will be reselected in the described first mapping data set, is defined as The second mapping data set.
18. devices as claimed in claim 11, it is characterised in that the integral unit, including:
Screening unit, if the Query Result for first Query Result and second Query Result is total And do not meet with the target query result in the target search sentence, then in first Query Result and At least two intermediate results for not meeting the target query result are filtered out in second Query Result;
Computing unit, for described according to the logical operator of at least two intermediate result, calculating extremely The operation result of few two intermediate result;
Final result unit is determined, for will accord with first Query Result and second Query Result Other Query Results and the operation result of the target query result are closed, is defined as described finally looking into Ask result.
Across the data source query system of 19. one kind, it is characterised in that include:
Be stored with the processor of data base, and the input equipment being connected with the processor;
The input equipment, for obtaining target search sentence, and by the target search sentence send to Processor;
The processor is used for, and according to target search sentence data query is carried out;It is specifically as follows:Pass through Parsing target search sentence, obtains the field in common of two tables of data involved by the target search sentence With the mapping relations between the grouping field in the target search sentence;Wherein, described two tables of data In comprising the grouping field tables of data be the first tables of data, the tables of data not comprising the grouping field For the second tables of data, the mapping relations are to limit sentence inquiry first data according to first condition Determine in the Query Result that table is obtained;Sentence pair is being limited using the second query statement and second condition Second tables of data is inquired about and obtained in the intermediate queries result by the packet of virtual group field, it is determined that The second Query Result corresponding with second tables of data;Wherein, the virtual group field is to utilize institute State it is that mapping relations are created in second tables of data, equivalent to first tables of data in described in point The virtual field of group field;Count to described first sentence is limited using the first query statement and additional conditions According to table inquire about and obtain by the grouping field be grouped Query Result in, it is determined that with first data Corresponding first Query Result of table;Wherein, it is in first tables of data that the additional conditions limit sentence Grouping field numerical value it is equal with the numerical value of virtual group field in second Query Result;According to institute The logical relation stated in target search sentence integrates first Query Result and second Query Result, Obtain final Query Result.
Across the data source query system of 20. one kind, it is characterised in that include:
Processor, the input equipment being connected with the processor, and be connected with the processor, use In the memorizer in data storage storehouse;
The input equipment, for obtaining target search sentence, and by the target search sentence send to Processor;
The processor is used to call the data base in the memorizer, and carries out according to target search sentence Data query;It is specifically as follows:For by parsing target search sentence, obtaining the target search language Between grouping field in the field in common and the target search sentence of two tables of data involved by sentence Mapping relations;Wherein, the tables of data comprising the grouping field is the first data in described two tables of data Table, the tables of data not comprising the grouping field is the second tables of data, and the mapping relations are according to the One condition limits sentence and inquires about what is determined in the Query Result that first tables of data is obtained;Utilizing Two query statements and second condition limit sentence and second tables of data are inquired about and obtained by virtual group In the intermediate queries result of field packet, it is determined that the second Query Result corresponding with second tables of data; Wherein, the virtual group field be created in second tables of data using the mapping relations, Equivalent to the virtual field of the grouping field in first tables of data;Using the first query statement Sentence is limited with additional conditions to inquire about first tables of data and obtain what is be grouped by the grouping field In Query Result, it is determined that the first Query Result corresponding with first tables of data;Wherein, it is described additional Condition is limited in numerical value that sentence is grouping field in first tables of data and second Query Result The numerical value of virtual group field is equal;Described the is integrated according to the logical relation in the target search sentence One Query Result and second Query Result, obtain final Query Result.
CN201510651622.5A 2015-10-10 2015-10-10 Cross-data-source query method, device and system Active CN106570022B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510651622.5A CN106570022B (en) 2015-10-10 2015-10-10 Cross-data-source query method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510651622.5A CN106570022B (en) 2015-10-10 2015-10-10 Cross-data-source query method, device and system

Publications (2)

Publication Number Publication Date
CN106570022A true CN106570022A (en) 2017-04-19
CN106570022B CN106570022B (en) 2020-06-23

Family

ID=58506649

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510651622.5A Active CN106570022B (en) 2015-10-10 2015-10-10 Cross-data-source query method, device and system

Country Status (1)

Country Link
CN (1) CN106570022B (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107220376A (en) * 2017-06-21 2017-09-29 北京奇艺世纪科技有限公司 A kind of data query method and apparatus
CN108038135A (en) * 2017-11-21 2018-05-15 平安科技(深圳)有限公司 Electronic device, the method for multilist correlation inquiry and storage medium
CN108984547A (en) * 2017-05-31 2018-12-11 北京京东尚科信息技术有限公司 The method and apparatus of data processing
CN110019544A (en) * 2017-09-30 2019-07-16 北京国双科技有限公司 Data query method and system
CN110110211A (en) * 2018-01-22 2019-08-09 北京京东尚科信息技术有限公司 Data query method and apparatus based on universal model
CN110968679A (en) * 2018-09-29 2020-04-07 北京国双科技有限公司 Data query method and device
CN112434060A (en) * 2020-12-09 2021-03-02 北京有竹居网络技术有限公司 Data query method and system
CN113407548A (en) * 2021-08-18 2021-09-17 南京网觉软件有限公司 Big data query method, system and medium based on ClickHouse dictionary table
WO2023246188A1 (en) * 2022-06-21 2023-12-28 华为云计算技术有限公司 Data sharing method and related system

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101216835A (en) * 2007-12-29 2008-07-09 北京大学 Data file conversion method and apparatus
CN101840430A (en) * 2010-04-28 2010-09-22 北京握奇数据系统有限公司 Intelligent card database multi-list operation method and device
US8145579B2 (en) * 2005-05-17 2012-03-27 International Business Machines Corporation System, method and program product to estimate cost of integrating and utilizing heterogeneous data sources
CN102687144A (en) * 2009-12-23 2012-09-19 起元技术有限责任公司 Managing queries
CN102902777A (en) * 2012-09-28 2013-01-30 用友软件股份有限公司 Cross data source inquiry device and cross data source inquiry method
CN104685498A (en) * 2012-08-20 2015-06-03 甲骨文国际公司 Hardware implementation of the aggregation/group by operation: hash-table method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8145579B2 (en) * 2005-05-17 2012-03-27 International Business Machines Corporation System, method and program product to estimate cost of integrating and utilizing heterogeneous data sources
CN101216835A (en) * 2007-12-29 2008-07-09 北京大学 Data file conversion method and apparatus
CN102687144A (en) * 2009-12-23 2012-09-19 起元技术有限责任公司 Managing queries
CN101840430A (en) * 2010-04-28 2010-09-22 北京握奇数据系统有限公司 Intelligent card database multi-list operation method and device
CN104685498A (en) * 2012-08-20 2015-06-03 甲骨文国际公司 Hardware implementation of the aggregation/group by operation: hash-table method
CN102902777A (en) * 2012-09-28 2013-01-30 用友软件股份有限公司 Cross data source inquiry device and cross data source inquiry method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王书海,刘明生,马银华,李金英: "基于多表连接的分组查询语句的性能分析与优化", 《计算机工程》 *

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108984547A (en) * 2017-05-31 2018-12-11 北京京东尚科信息技术有限公司 The method and apparatus of data processing
CN107220376A (en) * 2017-06-21 2017-09-29 北京奇艺世纪科技有限公司 A kind of data query method and apparatus
CN107220376B (en) * 2017-06-21 2020-10-27 北京奇艺世纪科技有限公司 Data query method and device
CN110019544A (en) * 2017-09-30 2019-07-16 北京国双科技有限公司 Data query method and system
CN108038135A (en) * 2017-11-21 2018-05-15 平安科技(深圳)有限公司 Electronic device, the method for multilist correlation inquiry and storage medium
CN110110211A (en) * 2018-01-22 2019-08-09 北京京东尚科信息技术有限公司 Data query method and apparatus based on universal model
CN110968679A (en) * 2018-09-29 2020-04-07 北京国双科技有限公司 Data query method and device
CN112434060A (en) * 2020-12-09 2021-03-02 北京有竹居网络技术有限公司 Data query method and system
CN113407548A (en) * 2021-08-18 2021-09-17 南京网觉软件有限公司 Big data query method, system and medium based on ClickHouse dictionary table
WO2023246188A1 (en) * 2022-06-21 2023-12-28 华为云计算技术有限公司 Data sharing method and related system

Also Published As

Publication number Publication date
CN106570022B (en) 2020-06-23

Similar Documents

Publication Publication Date Title
CN106570022A (en) Cross-data-source query method, apparatus and system
US8856157B2 (en) Automatic detection of columns to be obfuscated in database schemas
US9754010B2 (en) Generation of cube metadata and query statement based on an enhanced star schema
US11250250B2 (en) Pedestrian retrieval method and apparatus
US8694488B1 (en) Identifying sibling queries
CN108268586B (en) Data processing method, device, medium and computing equipment across multiple data tables
CN111782265A (en) Software resource system based on field level blood relationship and establishment method thereof
CN106484699B (en) Method and device for generating database query field
US20130297546A1 (en) Generating synthetic sentiment using multiple transactions and bias criteria
CN103324701A (en) Data searching device and method
CN110222071A (en) A kind of data query method, apparatus, server and storage medium
CN105373546A (en) Information processing method and system for knowledge services
JP6781820B2 (en) Distributed Computing Framework and Distributed Computing Method (DISTRIBUTED COMPUTING FRAMEWORK AND DISTRIBUTED COMPUTING METHOD)
US20170169102A1 (en) Method and electronic device for controlling data query
US10114951B2 (en) Virus signature matching method and apparatus
Porcu Python for data mining quick syntax reference
US20180203896A1 (en) Method and apparatus for processing query
KR101772333B1 (en) INTELLIGENT JOIN TECHNIQUE PROVIDING METHOD AND SYSTEM BETWEEN HETEROGENEOUS NoSQL DATABASES
CN109857735B (en) Data construction method and system for rule description through excel
US9275104B2 (en) Structured relevance—a mechanism to reveal how data is related
KR20090010752A (en) System and method for generating relating data class
KR20200083053A (en) Method for providing post-processing for improving the accuracy of named-entity recognition, and server using the same
CN106682107A (en) Method and device for determining database table incidence relation
KR101628097B1 (en) System and method for managing database
CN104239314A (en) Search word expanding method and system

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
TA01 Transfer of patent application right

Effective date of registration: 20180328

Address after: Four story 847 mailbox of the capital mansion of Cayman Islands, Cayman Islands, Cayman

Applicant after: CAINIAO SMART LOGISTICS HOLDING Ltd.

Address before: Cayman Islands Grand Cayman capital building a four storey No. 847 mailbox

Applicant before: ALIBABA GROUP HOLDING Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant