CN110727672A - Data mapping relation query method and device, electronic equipment and readable medium - Google Patents

Data mapping relation query method and device, electronic equipment and readable medium Download PDF

Info

Publication number
CN110727672A
CN110727672A CN201810691949.9A CN201810691949A CN110727672A CN 110727672 A CN110727672 A CN 110727672A CN 201810691949 A CN201810691949 A CN 201810691949A CN 110727672 A CN110727672 A CN 110727672A
Authority
CN
China
Prior art keywords
data
query
mapping
result
queried
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201810691949.9A
Other languages
Chinese (zh)
Inventor
李晨
张宁
刘业辉
王彦明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201810691949.9A priority Critical patent/CN110727672A/en
Publication of CN110727672A publication Critical patent/CN110727672A/en
Pending legal-status Critical Current

Links

Images

Abstract

The disclosure relates to a data mapping relation query method, a data mapping relation query device, electronic equipment and a computer readable medium. The method comprises the following steps: determining tuple data according to data to be queried, wherein the tuple data comprises main data and mapping data; judging whether the main data is in a lookup table or not; judging whether the mapping data is in a query set; when the main data is in a query table and the mapping data is in a query set, determining a result set in an iterative mode; and determining a query result of the data to be queried according to the result set, wherein the result set comprises all mapping data sets corresponding to the data to be queried. The data mapping relation query method, the data mapping relation query device, the electronic equipment and the computer readable medium can acquire all hierarchical relations of the information to be queried on the basis of not making full mapping snapshots, and solve the problem encountered by SQL workers.

Description

Data mapping relation query method and device, electronic equipment and readable medium
Technical Field
The present disclosure relates to the field of computer information processing, and in particular, to a data mapping relationship query method, apparatus, electronic device, and computer readable medium.
Background
In order to record the dependency relationship between two features or attributes, a relational mapping table is generally established in a data warehouse (or database), and two fields are correspondingly constructed, and their dependency relationships are stored in a tuple manner, wherein one field can be regarded as main data, and the other field can be regarded as mapping data thereof. When the query operation is executed, the mapping data can be obtained through the main data by controlling the filtering condition, and the main data can be used for selectively appointing any one of the two characteristics by a user, and the corresponding other one is regarded as the mapping data. In a real scene, the dependency relationship among data often exceeds one layer, for example, address dependency relationships such as province, city and district belong to two layers of dependency relationships, and similarly, more levels of dependency relationships exist.
In the prior art, in order to quickly acquire certain data and all mapping data having a dependency relationship therewith as described above, for example: the query time is reduced by establishing a full mapping table, but the workload in the previous period is huge and storage redundancy is caused, and the exponential growth puts an excessive requirement on how to store the full mapping table. In the prior art, in order to quickly acquire certain data and all mapping data having a dependency relationship with the certain data as described above, for example, the following steps can be performed: when the multi-layer dependency relationship is queried, the multi-layer dependency relationship is obtained by writing multi-layer nested SQL statements. However, as the dependency hierarchy increases, more execution time is paid for reducing the storage space, and the user also needs to write more complex SQL statements.
Therefore, a new data mapping relationship query method, device, electronic device and computer readable medium are needed.
The above information disclosed in this background section is only for enhancement of understanding of the background of the disclosure and therefore it may contain information that does not constitute prior art that is already known to a person of ordinary skill in the art.
Disclosure of Invention
In view of this, the present disclosure provides a data mapping relationship query method, apparatus, electronic device and computer readable medium, which can obtain all hierarchical relationships of information to be queried without making full mapping snapshots, so as to solve the problem encountered by SQL workers.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
According to an aspect of the present disclosure, a data mapping relationship query method is provided, where the method includes: determining tuple data according to data to be queried, wherein the tuple data comprises main data and mapping data; judging whether the main data is in a lookup table or not; judging whether the mapping data is in a query set; when the main data is in a query table and the mapping data is in a query set, determining a result set in an iterative mode; and determining a query result of the data to be queried according to the result set, wherein the result set comprises all mapping data sets corresponding to the data to be queried.
In an exemplary embodiment of the present disclosure, further comprising: storing the set of mapped data into the set of queries when the primary data is in the lookup table and the mapped data is not in the set of queries; and determining the query result of the data to be queried through the mapping data set.
In an exemplary embodiment of the present disclosure, further comprising: storing the main data and the mapping data into a query set when the main data is not in the query table; and taking the null value as a query result of the data to be queried.
In an exemplary embodiment of the disclosure, determining whether the mapping data is in a query set comprises: acquiring an attribute value of the main data; and judging whether the mapping data is in a query set or not according to the attribute value.
In an exemplary embodiment of the present disclosure, storing the mapping data into the query set further comprises: and updating the attribute value of the main data.
In an exemplary embodiment of the present disclosure, determining the result set in an iterative manner includes: acquiring a first data set corresponding to the mapping data in a query set; generating a second data set by the mapping data and the first data set; and performing augmentation processing on the data in the second data set in an iterative mode to obtain the result set.
In an exemplary embodiment of the present disclosure, determining the result set in an iterative manner further comprises: and storing the data in the result set into the query set.
In an exemplary embodiment of the present disclosure, generating the second data set from the mapping data and the first data set further comprises: and eliminating repeated data in the process of generating the second data set.
In an exemplary embodiment of the disclosure, iteratively performing augmentation processing on the data in the second data set to obtain the result set includes: taking the length of the second data set and a preset threshold value as limiting conditions; and in the process of iteratively processing the second data set, determining whether to continue iterative processing in real time through the limiting condition so as to obtain the result set.
In an exemplary embodiment of the present disclosure, determining a query result of the data to be queried through the result set includes: converting the data in the result set into character strings; and taking the character string with the maximum length as the query result of the data to be queried.
According to an aspect of the present disclosure, a data mapping relationship query apparatus is provided, the apparatus including: the tuple module is used for determining tuple data according to the data to be inquired, wherein the tuple data comprises main data and mapping data; the first judgment module is used for judging whether the main data is in the query table; the second judging module is used for judging whether the mapping data is in the query set or not; the iteration module is used for determining a result set in an iteration mode when the main data are in a query table and the mapping data are in a query set; and the first result module is used for determining the query result of the data to be queried through the result set, and the result set comprises all mapping data sets corresponding to the data to be queried.
In an exemplary embodiment of the present disclosure, further comprising: a second result module, configured to store the set of mapping data into the set of queries when the main data is in the lookup table and the mapping data is not in the set of queries; determining a query result of the data to be queried through the mapping data set; and a third result module for storing the main data and the mapping data into a query set when the main data is not in the query table; and taking the null value as a query result of the data to be queried.
According to an aspect of the present disclosure, an electronic device is provided, the electronic device including: one or more processors; storage means for storing one or more programs; when executed by one or more processors, cause the one or more processors to implement a method as above.
According to an aspect of the disclosure, a computer-readable medium is proposed, on which a computer program is stored, which program, when being executed by a processor, carries out the method as above.
According to the data mapping relation query method, the data mapping relation query device, the electronic equipment and the computer readable medium, all hierarchical relations of the information to be queried can be obtained on the basis of not making full mapping snapshots, and the problem encountered by SQL workers is solved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings. The drawings described below are merely some embodiments of the present disclosure, and other drawings may be derived from those drawings by those of ordinary skill in the art without inventive effort.
Fig. 1 is a system block diagram illustrating a data mapping relationship query method and apparatus according to an exemplary embodiment.
FIG. 2 is a flow diagram illustrating a data mapping relationship query method in accordance with an exemplary embodiment.
FIG. 3 is a flowchart illustrating a data mapping relationship query method according to another example embodiment.
FIG. 4 is a flowchart illustrating a data mapping relationship query method according to another example embodiment.
Fig. 5 is a block diagram illustrating a data mapping relationship querying device according to an example embodiment.
Fig. 6 is a block diagram illustrating a data mapping relationship querying device according to another exemplary embodiment.
FIG. 7 is a block diagram illustrating an electronic device in accordance with an example embodiment.
FIG. 8 is a schematic diagram illustrating a computer-readable storage medium according to an example embodiment.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The same reference numerals denote the same or similar parts in the drawings, and thus, a repetitive description thereof will be omitted.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known methods, devices, implementations, or operations have not been shown or described in detail to avoid obscuring aspects of the disclosure.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
It will be understood that, although the terms first, second, third, etc. may be used herein to describe various components, these components should not be limited by these terms. These terms are used to distinguish one element from another. Thus, a first component discussed below may be termed a second component without departing from the teachings of the disclosed concept. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
It is to be understood by those skilled in the art that the drawings are merely schematic representations of exemplary embodiments, and that the blocks or processes shown in the drawings are not necessarily required to practice the present disclosure and are, therefore, not intended to limit the scope of the present disclosure.
The inventor of the application finds that in a real scene, the dependency relationship between data is often more than one layer. For example, administrative district address information is set as a level 1 address with a district as the lowest level information, a level 2 address in city, and a level 3 address in province. For these problems, when writing an SQL statement to solve it, an address information table is usually built in a database, and in order to reduce the storage amount, two fields (because the more levels, the storage redundancy will be inevitably caused, and the consumption of storage space is often exponentially increased) are usually constructed in the table, namely field 1 (recording low-level administrative addresses) and field 2 (recording high-level addresses). The level 1 address may be stored in field 1 and the level 2 address may be stored in field 2, and then the level 2 address may be stored in field 1 and the level 3 address may be stored in field 2 in the same manner.
In this solution, when querying a level 1 address and a high level address having a mapping relationship with the level 1 address, a double-layer nested SQL statement is often required to be written to obtain the address. As the hierarchy increases, more execution time is paid for reducing storage space, and users are required to write more complex SQL statements.
Moreover, in this solution, all the dependent mapping relationships are stored in two fields, and if the number of nested layers is larger and the mapping relationship is more complex, the complexity of the SQL code is higher, and the developer hardly knows how many layers of nested SQL are written to achieve the coverage of the full mapping relationship.
Aiming at the problems, the data mapping relation query method can solve the defects existing in the prior art and achieve the following technical effects:
1. storing each group of data with dependency relationship into two fields without making full mapping snapshot;
2. a large amount of SQL nested queries are solved, code development is reduced, and query time is shortened;
3. for the dependency relationship with unknown layer number, all hierarchical relationships can be acquired according to the information to be queried, full coverage is realized, and the problem encountered by SQL workers is solved.
The following is a detailed description of the content of the present application, and it should be noted that the embodiment of the present application is implemented based on the function of adding udf to the hive database, and a specific implementation process may be implemented in other databases, which is not limited in the present application.
The hive is a data warehouse tool based on Hadoop, can map a structured data file into a database table, provides a simple sql query function, and can convert sql statements into MapReduce tasks for operation.
Among them, the user-defined function (UDF) is a powerful function that allows a user to extend the HiveQL. Users can write their own UDF using Java, and once user-defined functions are added to a user session, they will work as built-in functions, and even provide online help.
Fig. 1 is a system block diagram illustrating a data mapping relationship query method and apparatus according to an exemplary embodiment.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have various communication client applications installed thereon, such as a web browser application, a search-type application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 105 may be a server that provides various services, such as a background management server that provides support for websites browsed by users using the terminal devices 101, 102, 103. The background management server may analyze and perform other processing on the received dependency relationship query request, and feed back a processing result (e.g., dependency relationship data) to the terminal device.
The server 105 may determine tuple data, for example, from the data to be queried, the tuple data including the primary data and the mapping data; server 105 may, for example, determine whether the primary data is in a look-up table; server 105 may, for example, determine whether the mapping data is in a query set; when the primary data is in the lookup table and the mapping data is in the query set, the server 105 determines a result set in an iterative manner; the server 105 may determine a query result of the data to be queried, for example, through the result set, where the result set includes all mapping data sets corresponding to the data to be queried.
The server 105 may be a single entity server, or may be composed of a plurality of servers, for example, it should be noted that the data mapping relationship query method provided by the embodiment of the present disclosure may be executed by the server 105, and accordingly, the data mapping relationship query apparatus may be disposed in the server 105. And the web page end provided for the user to perform data search is generally located in the terminal equipment 101, 102, 103.
FIG. 2 is a flow diagram illustrating a data mapping relationship query method in accordance with an exemplary embodiment. The data mapping relation query method 20 includes at least steps S202 to S208.
As shown in fig. 2, in S202, meta group data is determined according to data to be queried, where the meta group data includes main data and mapping data. As described above, the query data may be, for example, administrative district address information, and the query data may be, for example, "beijing".
In one embodiment, a lookup table map _ result < key, value > may be constructed, for example, where key is the data within the mapping, value is its corresponding lowest level (each key may be at multiple levels, in this embodiment taking its first arriving level), and main data is stored as a key into map _ result, corresponding to value defaults to 0. The query data may be, for example, as key data in the data structure map _ result. That is, the query data is determined whether it is in the key of map _ result. And taking the inquired key and the corresponding mapping data as metadata.
It should be noted that, during the first calculation, the value corresponding to the key is 0, and it can be considered that the key does not have mapping data corresponding to the key, and at this time, the search result is the content of the field in the table corresponding to the query data in the database. Two fields may be constructed, for example, for the table, namely field 1 "Beijing" and field 2 "Tongzhou district". The query result is "Tongzhou district".
In S204, it is determined whether the main data is in a lookup table. It is determined whether the main data is in map _ result < key, value >.
In S206, it is determined whether the mapping data is in a query set. Defining a global query set map _ knowledge < key, value > in the memory, wherein key is main data read, and value is a set formed by all mapping data. And judging whether the mapping data is in map _ knowledge < key, value >.
In one embodiment, determining whether the mapping data is in a query set comprises: acquiring an attribute value of the main data; and judging whether the mapping data is in a query set or not according to the attribute value. And obtaining the value of the main data (namely the level where the main data is located) from the map _ result and recording the value as v, and judging whether the value is in the key of the map _ knowledge of the global history set according to the mapping data of the v to the main data of the current tuple.
In one embodiment, storing the mapping data into the query set further comprises: and updating the attribute value of the main data. And after the mapping data is stored in map _ result, the corresponding value is updated to v + 1.
In S208, when the main data is in the lookup table and the mapping data is in the query set, a result set is determined in an iterative manner.
In one embodiment, iteratively determining the result set comprises: acquiring a first data set corresponding to the mapping data in a query set; generating a second data set by the mapping data and the first data set; and performing augmentation processing on the data in the second data set in an iterative mode to obtain the result set. And eliminating repeated data in the process of generating the second data set. Taking the length of the second data set and a preset threshold value as limiting conditions; and in the process of iteratively processing the second data set, determining whether to continue iterative processing in real time through the limiting condition so as to obtain the result set.
In one embodiment, iteratively determining the result set further comprises: and storing the data in the result set into the query set.
In S210, determining a query result of the data to be queried through the result set, where the result set includes all mapping data sets corresponding to the data to be queried. The method comprises the following steps: converting the data in the result set into character strings; and taking the character string with the maximum length as the query result of the data to be queried.
According to the data mapping relation query method disclosed by the invention, the result set is determined in real time in an iterative mode, all hierarchical relations of the information to be queried can be obtained on the basis of not making full mapping snapshots, and the problem encountered by SQL workers is solved.
It should be clearly understood that this disclosure describes how to make and use particular examples, but the principles of this disclosure are not limited to any details of these examples. Rather, these principles can be applied to many other embodiments based on the teachings of the present disclosure.
FIG. 3 is a flowchart illustrating a data mapping relationship query method according to another example embodiment. The flow shown in fig. 3 is a detailed description of "determining the result set in an iterative manner when the main data is in the query table and the mapping data is in the query set" in S210 in the flow shown in fig. 2.
As shown in FIG. 3, in S302, set2 is initialized, and the current mapping data is placed in set 2.
In S304, set2 aggregate data is put into map _ result, and its record is deleted in map _ knowledge.
In S306, the data already included in map _ result is filtered for the second data set, and the length of the current set is l 1.
In S308, let i be 0, it be 0, and set1 be initialized.
In S310, it is determined whether i is smaller than l 1.
In S312, whether the mapping data set [ i ] is in map _ knowledge.
In S314, its map _ knowledge-corresponding dataset is obtained and added to set1, i ═ i + 1.
In S316, the set1 is filtered for the data already included in map _ result, and it is t + 1.
In S318, set2 is reinitialized, and the second data set data is stored in set 2.
In S320, the set1 set is merged into the query set, and the current set length is taken as l 2.
In S322, it is determined whether l2 is greater than l1 and it is less than the threshold.
In S324, the result set map _ result is output.
Set2 is initialized, and the mapping data (second data set) in the current mapping data is put into set 2.
And putting set2 set data into map _ result, and automatically adding 1 to a value corresponding to the set data according to the iteration of the previous layer (the value is referenced to the initial value when the set data is put for the first time).
Removing the data in the second data set which is already stored in map _ result, recording the length of the second data set as l1, setting the iteration number it as 0, initializing a set1 set, traversing the data in the second data set, and putting all history sets which have records in map _ knowledge in the second data set into a set2 set until the traversal is finished.
The data in the set1 set that has been stored in map _ result is removed (deduplication mechanism) and the number of iterations is recorded plus 1. Initializing a set2 set, putting data in a current second data set (the set2 set is always a snapshot of the last iteration data), then merging the set1 set into the second data set, and recording the length of the second data set as l 2.
If l2> l1 and the iteration number does not exceed the set threshold (the threshold is set so that the user can selectively find out the mapping relation in the threshold level), indicating that new mapping data is added, and entering the next layer of iteration.
If l2 is l1 (no case occurs) or the number of iterations reaches a set threshold, the iteration is proved to be finished, and the last updated map _ result is only needed to be output.
According to the data mapping relation query method disclosed by the invention, the number of iterations is dynamically adjusted, so that an iterator is designed to avoid huge time or space consumption caused by severe conditions such as cross-layer repetition, dead loop, infinite increase and the like instead of only iterating and traversing all data acquired by mapping data of each layer in a history set.
In an exemplary embodiment of the present disclosure, further comprising: storing the set of mapped data into the set of queries when the primary data is in the lookup table and the mapped data is not in the set of queries; and determining the query result of the data to be queried through the mapping data set.
In an exemplary embodiment of the present disclosure, further comprising: storing the main data and the mapping data into a query set when the main data is not in the query table; and taking the null value as a query result of the data to be queried.
FIG. 4 is a flowchart illustrating a data mapping relationship query method according to another example embodiment. The flow shown in fig. 4 is a description of the whole process of the data mapping relation query method in the embodiment of the present application.
As shown in fig. 4, in S402, tuple data is read, and the tuple data includes main data and mapping data thereof. In the embodiment of the present application, map _ result < key, value > is constructed, where key is data in the mapping relationship, value is its corresponding lowest hierarchy (each key may be in multiple hierarchies, and only the hierarchy that is reached first is taken here), and query main data is stored as key into map _ result, and the corresponding value defaults to 0.
Defining a global history set map _ knowledge < key, value > in the memory, wherein key is main data read, and value is a set formed by all mapping data.
In S404, it is determined whether the main data is in map _ result. If so, the process proceeds to S408, otherwise, the process proceeds to S406. Reading in each metadata group, judging whether the main data is in the key of map _ result, if not, indicating that the main data is not in the full mapping relation at present, storing the current main data and the mapping data thereof into map _ knowledge, and returning a null value at the moment.
In S406, a null value is returned.
In S408, it is determined whether the mapping data is in map _ knowledge. If so, proceed to S410, otherwise, proceed to S414.
Obtaining the value of the main data (namely the level where the main data is located) from the map _ result and marking the value as v, judging whether the mapping data of the current tuple main data is in the key of the global history set map _ knowledge, if not, storing the mapping data into the map _ result (the corresponding value is v +1), and indicating that the mapping data does not have a history mapping relation at present, but the mapping data returns to the map _ result in the mapping relation.
In S410, the mapping data and its corresponding history set data in map _ knowledge are placed into a second data set. If the mapping data has a historical mapping relation in the knowledge set, the mapping data and the corresponding historical data set obtained from the map _ knowledge are stored in a new second data set together, and all data in the mapping relation are stored in the map _ result after entering the optimization iterator.
In S412, the iterator performs an iterative process.
In S414, the data is stored into the result set map _ result.
In S416, the maximum length result set is taken as the query result. All returned records (including null values and map _ result) are converted into character strings, and the returned maximum length character strings can be regarded as all mapping relations of the queried data.
According to the data mapping relation query method disclosed by the invention, a data table depending on more than 10 layers of relations is queried, the time consumption is only 1min based on udf functions, the task starting job number is 1, the nested query based on SQL removes the time consumption of a large amount of codes, the execution time is basically more than 10min, and the starting job number is too high.
According to the data mapping relation query method disclosed by the invention, the global map variable storage data is constructed in the memory, and only one-time data traversal is needed, so that repeated iteration (such as nested SQL) of the full data is avoided.
According to the data mapping relation query method disclosed by the invention, the covering process is divided into two directions according to whether the current mapping data is in the history record or not, if the current mapping data is in the history record, all recorded data in the mapping relation are obtained through upward iteration, and if the current mapping data is not in the history record, new mapping data are added downwards, so that the dynamic local traversal is lower in complexity in time and space compared with the global traversal.
According to the data mapping relation query method disclosed by the invention, in the upward iteration process, a user can set the maximum iteration times according to actual needs to obtain the hierarchy mapping relation in any range. And the design of the optimization iterator has good robustness, and the self dynamic optimization iteration can greatly reduce the calculation time and the consumption of the memory.
Those skilled in the art will appreciate that all or part of the steps implementing the above embodiments are implemented as computer programs executed by a CPU. When executed by the CPU, performs the functions defined by the above-described methods provided by the present disclosure. The program may be stored in a computer readable storage medium, which may be a read-only memory, a magnetic or optical disk, or the like.
Furthermore, it should be noted that the above-mentioned figures are only schematic illustrations of the processes involved in the methods according to exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
The following are embodiments of the disclosed apparatus that may be used to perform embodiments of the disclosed methods. For details not disclosed in the embodiments of the apparatus of the present disclosure, refer to the embodiments of the method of the present disclosure.
Fig. 5 is a block diagram illustrating a data mapping relationship querying device according to an example embodiment. The data mapping relation query device 50 includes: a tuple module 502, a first determination module 504, an iteration module 506, and a first result module 508.
The tuple module 502 is configured to determine tuple data according to data to be queried, where the tuple data includes main data and mapping data.
The first judging module 504 is configured to judge whether the main data is in a lookup table; and the second judging module is used for judging whether the mapping data is in the query set.
The iteration module 506 is configured to determine a result set in an iterative manner when the main data is in the lookup table and the mapping data is in the query set.
The first result module 508 is configured to determine a query result of the data to be queried according to the result set, where the result set includes all mapping data sets corresponding to the data to be queried.
Fig. 6 is a block diagram illustrating a data mapping relationship querying device according to another exemplary embodiment. The data mapping relation query apparatus 60 further includes, in addition to the data mapping relation query apparatus 50: a second results module 602, and a third results module 604.
A second result module 602, configured to store the set of mapping data into the set of queries when the main data is in the lookup table and the mapping data is not in the set of queries; determining a query result of the data to be queried through the mapping data set;
a third result module 604 for storing the primary data and the mapping data into a query set when the primary data is not in the lookup table; and taking the null value as a query result of the data to be queried.
According to the data mapping relation query device disclosed by the invention, the result set is determined in real time in an iteration mode, all hierarchical relations of the information to be queried can be obtained on the basis of not making full mapping snapshots, and the problem encountered by SQL workers is solved.
FIG. 7 is a block diagram illustrating an electronic device in accordance with an example embodiment.
An electronic device 200 according to this embodiment of the present disclosure is described below with reference to fig. 7. The electronic device 200 shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 7, the electronic device 200 is embodied in the form of a general purpose computing device. The components of the electronic device 200 may include, but are not limited to: at least one processing unit 210, at least one memory unit 220, a bus 230 connecting different system components (including the memory unit 220 and the processing unit 210), a display unit 240, and the like.
Wherein the storage unit stores program code executable by the processing unit 210 to cause the processing unit 210 to perform the steps according to various exemplary embodiments of the present disclosure described in the above-mentioned electronic prescription flow processing method section of the present specification. For example, the processing unit 210 may perform the steps as shown in fig. 2, 3, 4.
The memory unit 220 may include readable media in the form of volatile memory units, such as a random access memory unit (RAM)2201 and/or a cache memory unit 2202, and may further include a read only memory unit (ROM) 2203.
The storage unit 220 may also include a program/utility 2204 having a set (at least one) of program modules 2205, such program modules 2205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 230 may be one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 200 may also communicate with one or more external devices 300 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 200, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 200 to communicate with one or more other computing devices. Such communication may occur via an input/output (I/O) interface 250. Also, the electronic device 200 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the Internet) via the network adapter 260. The network adapter 260 may communicate with other modules of the electronic device 200 via the bus 230. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, or a network device, etc.) to execute the above method according to the embodiments of the present disclosure.
Fig. 8 schematically illustrates a computer-readable storage medium in an exemplary embodiment of the disclosure.
Referring to fig. 8, a program product 400 for implementing the above method according to an embodiment of the present disclosure is described, which may employ a portable compact disc read only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable storage medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable storage medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
The computer readable medium carries one or more programs which, when executed by a device, cause the computer readable medium to perform the functions of: determining tuple data according to data to be queried, wherein the tuple data comprises main data and mapping data; judging whether the main data is in a lookup table or not; judging whether the mapping data is in a query set; when the main data is in a query table and the mapping data is in a query set, determining a result set in an iterative mode; and determining a query result of the data to be queried according to the result set, wherein the result set comprises all mapping data sets corresponding to the data to be queried.
Those skilled in the art will appreciate that the modules described above may be distributed in the apparatus according to the description of the embodiments, or may be modified accordingly in one or more apparatuses unique from the embodiments. The modules of the above embodiments may be combined into one module, or further split into multiple sub-modules.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
Exemplary embodiments of the present disclosure are specifically illustrated and described above. It is to be understood that the present disclosure is not limited to the precise arrangements, instrumentalities, or instrumentalities described herein; on the contrary, the disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.
In addition, the structures, the proportions, the sizes, and the like shown in the drawings of the present specification are only used for matching with the contents disclosed in the specification, so as to be understood and read by those skilled in the art, and are not used for limiting the limit conditions which the present disclosure can implement, so that the present disclosure has no technical essence, and any modification of the structures, the change of the proportion relation, or the adjustment of the sizes, should still fall within the scope which the technical contents disclosed in the present disclosure can cover without affecting the technical effects which the present disclosure can produce and the purposes which can be achieved. In addition, the terms "above", "first", "second" and "a" as used in the present specification are for the sake of clarity only, and are not intended to limit the scope of the present disclosure, and changes or modifications of the relative relationship may be made without substantial changes in the technical content.

Claims (14)

1. A data mapping relation query method is characterized by comprising the following steps:
determining tuple data according to data to be queried, wherein the tuple data comprises main data and mapping data;
judging whether the main data is in a lookup table or not;
judging whether the mapping data is in a query set;
when the main data is in a query table and the mapping data is in a query set, determining a result set in an iterative mode; and
and determining a query result of the data to be queried according to the result set, wherein the result set comprises all mapping data sets corresponding to the data to be queried.
2. The method of claim 1, further comprising:
storing the set of mapped data into the set of queries when the primary data is in the lookup table and the mapped data is not in the set of queries; and
and determining the query result of the data to be queried according to the mapping data set.
3. The method of claim 1, further comprising:
storing the main data and the mapping data into a query set when the main data is not in the query table; and
and taking the null value as a query result of the data to be queried.
4. The method of claim 1, wherein determining whether the mapping data is in a query set comprises:
acquiring an attribute value of the main data; and
and judging whether the mapping data is in a query set or not according to the attribute value.
5. The method of claim 4 or 2, wherein storing the mapping data into the query set further comprises:
and updating the attribute value of the main data.
6. The method of claim 1, wherein iteratively determining the result set comprises:
acquiring a first data set corresponding to the mapping data in a query set;
generating a second data set by the mapping data and the first data set; and
and performing augmentation processing on the data in the second data set in an iterative mode to obtain the result set.
7. The method of claim 6, wherein iteratively determining the result set further comprises:
and storing the data in the result set into the query set.
8. The method of claim 6, wherein generating a second set of data from the mapping data and the first set of data further comprises:
and eliminating repeated data in the process of generating the second data set.
9. The method of claim 6, wherein iteratively augmenting the data in the second data set to obtain the result set comprises:
taking the length of the second data set and a preset threshold value as limiting conditions; and
and in the process of iteratively processing the second data set, determining whether to continue iterative processing in real time through the limiting condition so as to obtain the result set.
10. The method of claim 1, wherein determining query results for the data to be queried from the result set comprises:
converting the data in the result set into character strings; and
and taking the character string with the maximum length as the query result of the data to be queried.
11. A data mapping relationship query apparatus, comprising:
the tuple module is used for determining tuple data according to the data to be inquired, wherein the tuple data comprises main data and mapping data;
the first judgment module is used for judging whether the main data is in the query table;
the second judging module is used for judging whether the mapping data is in the query set or not;
the iteration module is used for determining a result set in an iteration mode when the main data are in a query table and the mapping data are in a query set; and
and the first result module is used for determining the query result of the data to be queried through the result set, and the result set comprises all mapping data sets corresponding to the data to be queried.
12. The apparatus of claim 11, further comprising:
a second result module, configured to store the set of mapping data into the set of queries when the main data is in the lookup table and the mapping data is not in the set of queries; determining a query result of the data to be queried through the mapping data set; and
a third result module for storing the primary data and the mapping data into a query set when the primary data is not in the lookup table; and taking the null value as a query result of the data to be queried.
13. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-10.
14. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-10.
CN201810691949.9A 2018-06-28 2018-06-28 Data mapping relation query method and device, electronic equipment and readable medium Pending CN110727672A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810691949.9A CN110727672A (en) 2018-06-28 2018-06-28 Data mapping relation query method and device, electronic equipment and readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810691949.9A CN110727672A (en) 2018-06-28 2018-06-28 Data mapping relation query method and device, electronic equipment and readable medium

Publications (1)

Publication Number Publication Date
CN110727672A true CN110727672A (en) 2020-01-24

Family

ID=69216704

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810691949.9A Pending CN110727672A (en) 2018-06-28 2018-06-28 Data mapping relation query method and device, electronic equipment and readable medium

Country Status (1)

Country Link
CN (1) CN110727672A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111597162A (en) * 2020-05-19 2020-08-28 北京明略软件系统有限公司 Information determination method and apparatus, storage medium, and electronic apparatus

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102567329A (en) * 2010-12-15 2012-07-11 金蝶软件(中国)有限公司 Data query method and data query system
CN104123288A (en) * 2013-04-24 2014-10-29 阿里巴巴集团控股有限公司 Method and device for inquiring data
CN105468634A (en) * 2014-09-05 2016-04-06 富士通株式会社 Data query apparatus and method
CN106997393A (en) * 2017-04-10 2017-08-01 深圳乐信软件技术有限公司 Data query method, device, server and storage medium
CN107038207A (en) * 2017-02-20 2017-08-11 阿里巴巴集团控股有限公司 A kind of data query method, data processing method and device
US20180165306A1 (en) * 2016-12-09 2018-06-14 International Business Machines Corporation Executing Queries Referencing Data Stored in a Unified Data Layer

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102567329A (en) * 2010-12-15 2012-07-11 金蝶软件(中国)有限公司 Data query method and data query system
CN104123288A (en) * 2013-04-24 2014-10-29 阿里巴巴集团控股有限公司 Method and device for inquiring data
CN105468634A (en) * 2014-09-05 2016-04-06 富士通株式会社 Data query apparatus and method
US20180165306A1 (en) * 2016-12-09 2018-06-14 International Business Machines Corporation Executing Queries Referencing Data Stored in a Unified Data Layer
CN107038207A (en) * 2017-02-20 2017-08-11 阿里巴巴集团控股有限公司 A kind of data query method, data processing method and device
CN106997393A (en) * 2017-04-10 2017-08-01 深圳乐信软件技术有限公司 Data query method, device, server and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111597162A (en) * 2020-05-19 2020-08-28 北京明略软件系统有限公司 Information determination method and apparatus, storage medium, and electronic apparatus

Similar Documents

Publication Publication Date Title
US11163739B2 (en) Database table format conversion based on user data access patterns in a networked computing environment
US10915532B2 (en) Supporting a join operation against multiple NoSQL databases
US11216474B2 (en) Statistical processing of natural language queries of data sets
CN107704202B (en) Method and device for quickly reading and writing data
US9659023B2 (en) Maintaining and using a cache of child-to-parent mappings in a content-addressable storage system
CN111247518A (en) Database sharding
US11200231B2 (en) Remote query optimization in multi data sources
US11074267B2 (en) Staged approach to automatic data discovery and performance
CN115335821B (en) Offloading statistics collection
US10936640B2 (en) Intelligent visualization of unstructured data in column-oriented data tables
CN110914814A (en) Cognitive file and object management for distributed storage environments
US11704345B2 (en) Inferring location attributes from data entries
CN112783887A (en) Data processing method and device based on data warehouse
CN113190517B (en) Data integration method and device, electronic equipment and computer readable medium
US20220121665A1 (en) Computerized Methods and Systems for Selecting a View of Query Results
CN115918110A (en) Spatial search using key-value store
CN110727672A (en) Data mapping relation query method and device, electronic equipment and readable medium
CN111198880A (en) Data storage method and device based on redis and electronic equipment
US20220229858A1 (en) Multi-cloud object store access
CN115543428A (en) Simulated data generation method and device based on strategy template
US11487708B1 (en) Interactive visual data preparation service
CN113448957A (en) Data query method and device
CN113515504B (en) Data management method, device, electronic equipment and storage medium
US20120124002A1 (en) Reducing storage costs associated with backing up a database
US11550760B1 (en) Time-based partitioning to avoid in-place updates for data set copies

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