CN117076487A - Service data query method, device, server, storage medium and product - Google Patents

Service data query method, device, server, storage medium and product Download PDF

Info

Publication number
CN117076487A
CN117076487A CN202210509010.2A CN202210509010A CN117076487A CN 117076487 A CN117076487 A CN 117076487A CN 202210509010 A CN202210509010 A CN 202210509010A CN 117076487 A CN117076487 A CN 117076487A
Authority
CN
China
Prior art keywords
data
query
node
nodes
service
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
CN202210509010.2A
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202210509010.2A priority Critical patent/CN117076487A/en
Publication of CN117076487A publication Critical patent/CN117076487A/en
Pending legal-status Critical Current

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/2453Query optimisation
    • G06F16/24532Query optimisation of parallel queries
    • 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/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/283Multi-dimensional databases or data warehouses, e.g. MOLAP or ROLAP

Abstract

The application provides a service data query method, a service data query device, a server, a storage medium and a service data query product, and belongs to the technical field of Internet. The method includes the steps of firstly analyzing a query request to obtain a plurality of query sentences, generating a plurality of data structures based on the plurality of query sentences, generating a plurality of query execution tasks based on the plurality of data structures, inquiring a plurality of data sources in parallel through a first node and a second node in the plurality of query execution tasks, summarizing a plurality of business sub-data obtained through the plurality of data sources to obtain business data, and returning the business data to a terminal. The method can search a plurality of data sources in parallel according to a plurality of search fields, so that the search time can be shortened, and the search efficiency is improved.

Description

Service data query method, device, server, storage medium and product
Technical Field
The present application relates to the field of internet technologies, and in particular, to a method, an apparatus, a server, a storage medium, and a product for querying service data.
Background
Because online transaction processing (OLTP, on-line transaction processing) supports real-time query of data and has the characteristics of high query speed, OLTP can be applied to advertisement delivery scenes for querying users for advertisement business data. At present, advertisement service data is generally obtained from data providers through data sources, and often comes from a plurality of data providers, so when inquiring service data, a plurality of data sources need to be inquired first, and service data is obtained from a plurality of data providers corresponding to the plurality of data sources according to the inquired plurality of data sources.
In the related art, when querying service data of an advertisement, only one query field can be input at a time, and one query field corresponds to one data source, so that when querying a plurality of data sources, the query is performed for a plurality of times, and the plurality of data sources can be queried, thereby obtaining the final service data. However, since the method needs to perform multiple queries to obtain the final service data, it takes a long time, resulting in low query efficiency.
Disclosure of Invention
The embodiment of the application provides a service data query method, a service data query device, a service data query server, a storage medium and a service data query product, which can improve service data query efficiency. The technical scheme is as follows:
in one aspect, a method for querying service data is provided, where the method includes:
receiving a query request of a terminal, wherein the query request is used for querying service data of a target content item, the query request comprises a plurality of query fields and a plurality of identifiers of data sources, the identifier of one data source corresponds to at least one query field, and the query field is used for querying corresponding service sub-data through the data source;
analyzing the query request to obtain a plurality of query sentences, wherein one query sentence corresponds to one data source, and the query sentence comprises the identification of the data source and at least one query field corresponding to the data source;
Generating a plurality of data structures based on the plurality of query sentences, wherein one query sentence corresponds to one data structure, and the data structure is used for storing query information used for acquiring the business sub-data;
generating a plurality of query execution tasks based on the plurality of data structures, wherein one query execution task comprises a first node and a second node, the first node is used for determining the type of service sub-data to be queried based on the query information, and the second node associated with the first node is used for acquiring the service sub-data through the data source based on the type of the service sub-data;
querying the plurality of data sources in parallel through a first node and a second node in the plurality of query execution tasks;
and summarizing a plurality of business sub-data obtained through the plurality of data sources to obtain business data, and returning the business data to the terminal.
In another aspect, a query device for service data is provided, where the device includes:
the receiving module is used for receiving a query request of the terminal, wherein the query request is used for querying service data of a target content item, the query request comprises a plurality of query fields and a plurality of identifiers of data sources, the identifier of one data source corresponds to at least one query field, and the query field is used for querying corresponding service sub-data through the data source;
The analysis module is used for analyzing the query request to obtain a plurality of query sentences, one query sentence corresponds to one data source, and the query sentence comprises the identification of the data source and at least one query field corresponding to the data source;
the first generation module is used for generating a plurality of data structures based on the plurality of query sentences, one query sentence corresponds to one data structure, and the data structure is used for storing query information used for acquiring the business sub-data;
the second generation module is used for generating a plurality of query execution tasks based on the plurality of data structures, one query execution task comprises a first node and a second node, the first node is used for determining the type of service sub-data to be queried based on the query information, and the second node associated with the first node is used for acquiring the service sub-data through the data source based on the type of the service sub-data;
the query module is used for querying the plurality of data sources in parallel through a first node and a second node in the plurality of query execution tasks;
and the summarizing module is used for summarizing the plurality of business sub-data obtained by the plurality of data sources to obtain business data, and returning the business data to the terminal.
In a possible implementation manner, the second generating module is configured to generate a plurality of first nodes based on a plurality of query information in the plurality of data structures; generating a plurality of second nodes based on a plurality of data sources matched with the plurality of query information; the plurality of query execution tasks are generated based on the plurality of first nodes and the plurality of second nodes.
In another possible implementation manner, the second generating module is configured to determine a first node and a second node that have an association relationship; and generating the query execution task based on the first node and the second node which have the association relation.
In another possible implementation manner, the second generating module is configured to associate the first node and the second node that have an association relationship to obtain the query execution task; or determining a plurality of second nodes with association relations; associating the plurality of second nodes and associating the first node with the second node with the association relationship to obtain the query execution task; one second node of the plurality of second nodes with the association relationship is a father node, other second nodes are child nodes, and the second node serving as the father node is used for obtaining business child data based on data obtained by other second nodes serving as child nodes.
In another possible implementation manner, the query module is configured to determine, by a plurality of first nodes in the plurality of query execution tasks, types of the plurality of service sub-data, where the first nodes are configured to send the types of the service sub-data to a second node associated with the first nodes; and based on the types of the service sub-data, the data sources are queried in parallel through a plurality of second nodes associated with the first nodes.
In another possible implementation manner, the first generating module is configured to determine configuration information of a plurality of data sources based on identifiers of the plurality of data sources in the plurality of query sentences, where an identifier of one data source corresponds to one configuration information; acquiring a plurality of pieces of structure information from configuration information of the plurality of data sources, wherein one piece of configuration information corresponds to one piece of structure information, and the structure information is used for representing a method adopted for generating the data structure; the plurality of data structures is generated from the plurality of structure information based on the plurality of query fields.
In another aspect, a server is provided, where the server includes a processor and a memory, where the memory is configured to store at least one section of computer program, where the at least one section of computer program is loaded and executed by the processor to implement a method for querying service data in an embodiment of the present application.
In another aspect, a computer readable storage medium is provided, in which at least one segment of a computer program is stored, where the at least one segment of the computer program is loaded and executed by a processor to implement a method for querying service data as in an embodiment of the present application.
In another aspect, a computer program product is provided, the computer program product comprising computer program code, the computer program code being stored in a computer readable storage medium, the computer program code being read from the computer readable storage medium by a processor of a server, the processor executing the computer program code, causing the server to perform the method of querying business data according to any of the above implementations.
The technical scheme provided by the embodiment of the application has the beneficial effects that:
the embodiment of the application provides a query method of service data, which can generate a plurality of data structures according to a plurality of query fields when querying the service data, generate a plurality of query execution tasks according to the plurality of data structures, query a plurality of data sources in parallel through a first node and a second node in the plurality of query execution tasks, finally summarize a plurality of service sub-data obtained through the plurality of data sources to obtain the service data, and return the service data to a terminal. Therefore, the method can search a plurality of data sources in parallel according to a plurality of search fields, so that the search time can be shortened, and the search efficiency can be improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of an implementation environment of a service data query method according to an embodiment of the present application;
fig. 2 is a flowchart of a service data query method provided in an embodiment of the present application;
fig. 3 is a flowchart of a service data query method provided in an embodiment of the present application;
fig. 4 is a schematic diagram of a plurality of second nodes having an association relationship according to an embodiment of the present application querying data through a plurality of data sources;
FIG. 5 is a schematic diagram of a data query framework provided by an embodiment of the present application;
fig. 6 is a schematic structural diagram of a service data query device according to an embodiment of the present application;
fig. 7 is a block diagram of a server according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail with reference to the accompanying drawings.
The terms "first," "second," "third," and "fourth" and the like in the description and in the claims and drawings are used for distinguishing between different objects and not necessarily for describing a particular sequential or chronological order. Furthermore, the terms "comprising," "including," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those listed steps or elements but may include other steps or elements not listed or inherent to such process, method, article, or apparatus.
It should be noted that, the information (including but not limited to user equipment information, user personal information, etc.), data (including but not limited to data for analysis, stored data, presented data, etc.), and signals related to the present application are all authorized by the user or are fully authorized by the parties, and the collection, use, and processing of the related data is required to comply with the relevant laws and regulations and standards of the relevant countries and regions. For example, the query field, service data, service sub-data, query information, etc. referred to in the present application are all acquired under the condition of sufficient authorization.
Hereinafter, terms related to the present application will be explained.
Data source: the device or original media providing the service data, the data source may obtain the service data from the data provider, and the data provider may be a database or may serve a third party.
Query execution tasks: and (3) specifically executing the steps of inquiring the service data.
A parser: a module for converting the query request into a query statement interpretable by the query generator.
A query task generator: based on the query statement, a module for query execution tasks is generated.
A query executor: and particularly to a module for executing the query execution task.
The following describes an implementation environment according to the present application:
referring to fig. 1, fig. 1 is a schematic diagram of an implementation environment of a service data query method according to an embodiment of the present application, where the implementation environment includes: terminal 101 and server 102, terminal 101 and server 102 may be connected via a wireless or wired network. In the embodiment of the application, the method can be applied to scenes with high requirements on real-time data, such as advertisement putting scenes, ticket booking scenes and the like.
The description will be given only by taking an example in which the method is applied to an advertisement putting scene. As business complexity of advertisement delivery systems increases, data to be loaded in a single page is increasingly complex, and business data needs to be screened, ordered, displayed, etc. from multiple different data sources and multiple different dimensions, for example, when querying business data, real-time advertisement audit progress, delivery effect, etc. data needs to be acquired, and these data often come from multiple different data providers. Since data is generally obtained from a data provider through a data source at present, when service data is obtained, a plurality of data sources need to be queried first, and data is obtained from a plurality of data providers through the queried plurality of data sources.
In an embodiment of the present application, an advertisement delivery system includes: the process of querying the service data of the advertisement by the user through the advertisement delivery system by the terminal 101 and the server 102 may be: in response to the query operation triggered by the user, the terminal 101 sends a query request to the server 102, the server 102 queries a plurality of data sources in parallel according to the query request, gathers a plurality of service sub-data obtained by the query to obtain service data, returns the service data to the terminal 101, and the terminal 101 displays the service data. When querying service data, a user can input a plurality of query fields, and the server 102 can query a plurality of data sources in parallel based on the plurality of query fields, so that the query time is shortened, and the query efficiency is improved.
The terminal 101 is at least one of a mobile phone, a tablet computer, PC (Personal Computer) equipment, intelligent voice interaction equipment, an on-board terminal and the like. Server 102 may be at least one of a server, a server cluster consisting of multiple servers, a cloud server, a cloud computing platform, and a virtualization center.
Fig. 2 is a flowchart of a service data query method provided in an embodiment of the present application, which is executed by a server, and referring to fig. 2, the method includes:
201. The server receives a query request from the terminal.
The query request is used for querying service data of the target content item, the query request comprises a plurality of query fields and a plurality of identifiers of data sources, the identifier of one data source corresponds to at least one query field, and the query field is used for querying corresponding service sub-data through the data source.
In the embodiment of the application, the user can put in the target content item through the terminal, and after the target content item is put in, the service data of the target content item can be queried through the terminal. In querying the service data, in response to the querying operation, the terminal transmits a query request to the server, and the server queries the service data based on the query request.
The target content item may be a content item such as a food advertisement, a shopping advertisement, a video advertisement, etc., which is not particularly limited in the embodiment of the present application. The business data may be data such as an audit progress and a delivery effect of the target content item, which is not particularly limited.
202. The server analyzes the query request to obtain a plurality of query sentences.
A query statement corresponds to a data source and the query statement includes an identification of the data source and at least one query field corresponding thereto. The query field may be an audit progress of the target content item, a delivery effect, etc., where the delivery effect may be reflected by a click volume or a browse volume.
203. The server generates a plurality of data structures based on the plurality of query statements.
One query statement corresponds to one data structure for storing query information used to obtain business sub-data.
204. The server generates a plurality of queries to perform tasks based on the plurality of data structures.
The query execution task comprises a first node and a second node, wherein the first node is used for determining the type of the business sub-data to be queried based on the query information, and the second node associated with the first node is used for acquiring the business sub-data through a data source based on the type of the business sub-data.
The number of the first nodes may be one or more, and the number of the second nodes may be one or more, which is not particularly limited.
205. The server queries the plurality of data sources in parallel through a first node and a second node in the plurality of query execution tasks.
Because a plurality of query execution tasks are executed simultaneously, the plurality of query execution tasks correspond to a plurality of data sources, and thus, in the query process, the plurality of data sources are queried in parallel.
In addition, a task is executed for one query, and a plurality of data sources may need to be queried, so that a hybrid query is executed for a plurality of data sources in parallel in the query process for a plurality of query execution tasks. For example, a first query execution task needs to query a plurality of first data sources, a second query execution task needs to query a plurality of second data sources, and the same data sources exist in the plurality of first data sources and the plurality of second data sources, so that the server performs hybrid queries on the data sources in parallel through a first node and a second node in the plurality of query execution tasks.
206. The server gathers a plurality of service sub-data obtained through a plurality of data sources to obtain service data, and returns the service data to the terminal.
And after the server collects the plurality of service sub-data, returning the service sub-data to the terminal, and displaying the service data returned by the server by the terminal, thereby meeting the query requirement of the user.
The embodiment of the application provides a query method of service data, which can generate a plurality of data structures according to a plurality of query fields when querying the service data, generate a plurality of query execution tasks according to the plurality of data structures, query a plurality of data sources in parallel through a first node and a second node in the plurality of query execution tasks, finally summarize a plurality of service sub-data obtained through the plurality of data sources to obtain the service data, and return the service data to a terminal. Therefore, the method can search a plurality of data sources in parallel according to a plurality of search fields, so that the search time can be shortened, and the search efficiency can be improved.
Fig. 3 is a flowchart of a service data query method provided in an embodiment of the present application, which is executed by a terminal and a server, referring to fig. 3, and the method includes:
301. And the terminal sends a query request to the server.
The query request is used for querying service data of the target content item, the query request comprises a plurality of query fields and a plurality of identifiers of data sources, the identifier of one data source corresponds to at least one query field, and the query field is used for querying corresponding service sub-data through the data source.
In the step, in response to the triggered query operation, the terminal acquires a plurality of input query fields, determines identifiers of a plurality of data sources corresponding to the plurality of query fields, and sends a query request to the server.
In this implementation, the terminal displays a query interface that includes a plurality of query input boxes for inputting a plurality of query fields. The terminal acquires a plurality of query fields, and determines the identifications of a plurality of data sources corresponding to the plurality of query fields based on the relation between the prestored query fields and the identifications of the data sources.
After determining the identifiers of the multiple data sources corresponding to the multiple query fields, the terminal may add the identifier of the data source to the front edge of the query field name in a prefix manner of the query field name, for example, the query field is a product id (product_id), and the identifier of the data source corresponding to the query field is a product service (product_service), and then the identifier of the data source is displayed in front of the query field in a prefix manner to obtain the product_service. And finally, the terminal adds the identifications of the plurality of data sources to the front edges of the plurality of query field names correspondingly, and then sends a query request to the server, wherein the identifications of the plurality of data sources in the query request are positioned on the front edges of the plurality of corresponding query field names.
In the embodiment of the present application, the target content item may be a content item such as a food advertisement, a shopping advertisement, a video advertisement, etc., which is not limited in particular. The business data may be data such as an audit progress and a delivery effect of the target content item, which is not particularly limited. In addition, the query field may be any field for querying service data, for example, the query field is a sorting field for determining a sorting corresponding to service data to be queried, or the query field is a filtering field for filtering out service data that does not meet the condition. Of course, the query field may also be other fields, which are not listed here.
In the embodiment of the application, before the identifiers of the plurality of data sources are added to the plurality of query fields, the logic complexity of subsequent server analysis can be reduced, and the analysis efficiency can be improved.
302. The server receives the query request and analyzes the query request to obtain a plurality of query sentences.
The server comprises a parser and a query task generator, wherein the parser is a module for converting a query request into a query statement which can be interpreted by the query generator, and the query task generator is a module for generating a query execution task based on the query statement.
The parser parses the query request, generates a plurality of query sentences according to the identifiers of different data sources, and then sends the query sentences to the query task generator, wherein one query sentence corresponds to one data source, and the query sentence comprises the identifiers of the data sources and at least one query field corresponding to the data sources.
303. The server generates a plurality of data structures based on the plurality of query statements.
One query statement corresponds to one data structure for storing query information used to obtain business sub-data, and one data structure stores at least one query information.
The query task generator receives a plurality of query sentences sent by the analyzer, determines configuration information of a plurality of data sources based on identifiers of the plurality of data sources in the plurality of query sentences, acquires a plurality of structure information from the configuration information of the plurality of data sources, and generates a plurality of data structures based on a plurality of query fields and through the plurality of structure information. Wherein the identification of one data source corresponds to one configuration information and one configuration information corresponds to one structure information, and the structure information is used for representing a method adopted for generating the data structure.
In this implementation manner, the configuration information of the data source includes structure information, and the query task generator may directly obtain the structure information from the configuration information of the data source corresponding to the query statement, and generate the data structure through the structure information.
The configuration information of the data source further comprises an identification of the data source, a data source access driver, a data source interface, a cache switch and the like, wherein the data source access driver is used for driving the data source to acquire data from the data provider through the data source interface, the cache switch is used for starting or closing the cache, and under the condition of starting the cache, the data acquired from the data provider can be stored in the cache, so that the server can acquire the data from the cache quickly. In addition, the data provider may be a database or may serve a third party, which is not particularly limited.
In the embodiment of the application, a plurality of data structures are generated based on the configuration information of the data sources, and then a plurality of inquiry execution tasks can be generated through the plurality of data structures, so that the plurality of data sources are inquired in parallel, the inquiry time is shortened, and the inquiry efficiency is improved.
304. The server generates a plurality of first nodes based on a plurality of query information in a plurality of data structures.
The query information is used to represent information used to obtain the service sub-data.
The first node is configured to determine a type of service sub-data to be queried based on query information, where one query information corresponds to one first node, and therefore, the server may generate, based on a number of the plurality of query information, a plurality of first nodes matching the number.
The type of the service sub-data is used to represent the purpose of the service sub-data, for example, the type of the service sub-data is the service sub-data used for sorting, or the service sub-data used for paging, or the service sub-data used for aggregation, and may also be the service sub-data of other purposes, which is not limited in particular.
305. The server generates a plurality of second nodes based on a plurality of data sources for which the plurality of query information matches.
The second node is used for acquiring the service sub-data through the data source based on the type of the service sub-data. Different query information may need to query the same data source or may need to query different data sources, so the server may determine, based on the correspondence between the pre-stored query information and the data sources, a plurality of data sources matched with the plurality of query information, and generate, according to the number of the plurality of data sources, a plurality of second nodes matched with the number.
306. The server generates a plurality of query execution tasks based on the plurality of first nodes and the plurality of second nodes.
This step can be achieved by the following steps (1) to (2), comprising:
(1) The server determines a first node and a second node which have an association relationship.
As can be seen from steps 304 and 305, the first node and the second node are both generated based on the query information, and therefore, the query task generator determines the first node and the second node generated based on the same query information as the first node and the second node having the association relationship.
(2) The server generates a query execution task based on the first node and the second node which have the association relation.
Step (2) may be implemented by any of the following implementations.
In a first implementation manner, the query task generator directly correlates the first node and the second node with the correlation relationship to obtain a query execution task.
In the implementation manner, the second node can directly acquire the service sub-data through the data source, and does not need to rely on the data acquired by other nodes.
In a second implementation manner, the query task generator determines a plurality of second nodes with association relationships, associates the plurality of second nodes with each other, and associates the first nodes with the second nodes with association relationships to obtain a query execution task.
One second node of the plurality of second nodes with the association relationship is a father node, the other second nodes are child nodes, and the second node serving as the father node is used for obtaining business child data based on data obtained by the other second nodes serving as the child nodes.
In this implementation manner, when the service sub-data that needs to be acquired by the second node depends on the data acquired by other second nodes, that is, the second node needs to acquire other data first, and can acquire the corresponding service sub-data according to other data, in this case, the query task generator takes the second node as a father node, and takes other second nodes as the child nodes of the father node.
It should be noted that, the parent node may have a primary child node or a multi-level child node, and if the child node of the parent node may directly obtain data through the data source, the parent node has a primary child node. If the child node of the parent node needs to rely on the data acquired by the child node of the next stage, the parent node has multi-stage child nodes. Whether the parent node has a primary child node or a multi-level child node, the parent node and the child nodes are nodes with association relations. Based on the above, when the first node and the second node with the association relationship are associated, the query task generator also associates the second nodes corresponding to the nodes with the association relationship, so as to obtain the query execution task.
In the embodiment of the application, one query execution task comprises a root query executor, one query execution task is a tree structure body, the root query executor is a top node of the tree structure body, and the first node and the second node are nodes in the tree structure body. Wherein a first node represents a primary key query executor and a second node represents a data query executor. The main key query executor is used for determining the type of the corresponding business sub-data based on the query information, sending the type of the business sub-data queried by the main key query executor to the data query executor, and acquiring the business sub-data through a data source corresponding to the type of the business sub-data based on the type of the business sub-data sent by the main key query executor.
In the embodiment of the application, the query task generator generates a plurality of query execution tasks through the steps (1) and (2). The server generates a plurality of inquiry executing tasks based on the incidence relation between the first node and the second node, or generates a plurality of inquiry executing tasks based on the incidence relation between the first node and the second node and the incidence relation between the second nodes, and inquires a plurality of data sources in parallel through the plurality of inquiry executing tasks, so that the inquiry time is shortened, and the inquiry efficiency is improved.
307. The server queries the plurality of data sources in parallel through a first node and a second node in the plurality of query execution tasks.
This step can be achieved by the following steps (1) to (2), comprising:
(1) The server determines the types of the plurality of business sub-data through a plurality of first nodes in the plurality of query execution tasks.
The plurality of first nodes can determine the types of the plurality of service sub-data corresponding to the plurality of query information according to the corresponding relation between the query information and the types of the service sub-data, and then send the types of the plurality of service sub-data to the plurality of second nodes associated with the plurality of first nodes.
(2) The server queries a plurality of data sources in parallel through a plurality of second nodes associated with a plurality of first nodes based on the types of the plurality of business sub-data.
If step (2) in step 306 is implemented in the first implementation manner, the server may directly determine, through a plurality of second nodes associated with a plurality of first nodes, a plurality of data sources with matched types of the plurality of service sub-data, and then query the plurality of data sources in parallel, so as to obtain a plurality of service sub-data, where one service sub-data is of a type of one data source.
In this implementation manner, there is no dependency relationship between the plurality of second nodes, in this case, the plurality of second nodes are executed in parallel when querying the data, and do not need to wait for execution results of each other, for any second node, after the second node acquires the corresponding service sub-data, the service sub-data may be stored first, and after the plurality of second nodes all acquire the corresponding service sub-data, the server executes step 308.
If step (2) in step 306 is implemented in the second implementation manner, since the multiple query execution tasks are executed simultaneously, the server may implement the query on multiple data sources in parallel through multiple second nodes associated with multiple first nodes.
Except for tasks performed on a query, serial queries may occur during the query process. The following will describe in detail.
If a plurality of second nodes with association relations exist in a query execution task, one of the second nodes with association relations is a father node, the other second nodes are child nodes, and one or more levels of child nodes exist in the father node, under the condition that the server queries a data source through the child node at the lowest level, after acquiring data, the child node at the lowest level sends the acquired data to the child node at the upper level, the child node at the upper level queries the data source according to the acquired data, and then the data is transferred to the node at the upper level until the father node acquires the data sent by the child node at the lower level, and service child data is acquired based on the data.
In this implementation, the number of levels of the multi-level child node may be one or more. The description is given here by taking the example that the number of levels of the multi-level child nodes is 2, that is, the parent node includes 2-level child nodes. For convenience of distinction, the level 2 child nodes are referred to herein as a level one child node, which is the next level child node of the parent node, and a level 2 child node, which is the child node of the level one child node, i.e., the lowest level node, respectively.
In this implementation, the number of child nodes in the same hierarchy may be one or more. If the number of the first-stage child nodes and the second-stage child nodes is one, the first-stage child nodes need to query the data source based on the data acquired by the second-stage child nodes, so that the query process is serial.
Referring to fig. 4, fig. 4 shows a plurality of second nodes having an association relationship, the second node on the uppermost layer is a parent node, five child nodes are included under the parent node, wherein the two child nodes on the left have an association relationship, and the second child node on the left needs to rely on the data acquired by the first child node on the left, so that after the first child node on the left acquires the data through the data source, the second child node on the left sends the acquired data, and after the second child node on the left acquires the data, the acquired data is returned to the parent node. It follows that the process of querying data by the two child nodes on the left is serial.
If the number of the first-stage child nodes is one and the number of the second-stage child nodes is a plurality of, in this case, the first-stage child nodes wait for the plurality of second-stage child nodes to acquire data, process the plurality of data, query the data source based on the processed data, and then send the queried data to the father node.
Although serial inquiry is carried out between one second-level sub-node and the first-level sub-node when data is inquired, the plurality of second-level sub-nodes have no association relation, so that the plurality of second-level sub-nodes can still inquire a plurality of data sources in parallel when the data is inquired. With continued reference to fig. 4, for the three child nodes on the right, there is no association relationship between the three child nodes, so that the three child nodes on the right can simultaneously query multiple data sources in parallel, and return the acquired data to the parent node. It follows that the process of querying data for the three child nodes on the right is parallel. And the father node sends the acquired data to the father node or the server according to the data acquired by the two child nodes on the left and the three child nodes on the right.
In the embodiment of the present application, no matter which implementation manner step (2) in step 306 is implemented, the server may implement parallel query on multiple data sources, so as to shorten the query time, thereby improving the query efficiency.
Referring to fig. 5, fig. 5 is a query framework for querying service data according to an embodiment of the present application, where the query framework is a Golang native framework, and includes: a parser, a query task generator, a query executor, and a plurality of data sources. And by means of a unified multi-data source query framework, an execution plan is dynamically generated according to different query scenes, unified management and maintenance are performed by means of a single query entrance, the data query parallelism degree is improved by means of parallel query capability, repeated access work is reduced, and service complexity is reduced. And a plurality of data sources are managed through unified configuration, so that maintainability of project codes is improved. In addition, from the query framework, it can be seen that: the method is that a plurality of data sources are queried in parallel through the Golang native framework, and other clients or services are not needed.
It should be noted that, in step 303, structure information is obtained from configuration information of a data source, so as to generate a data structure. When the data structure is generated, a data source object is also generated according to the structure information, and the data source object is used for acquiring data. And the configuration information of the data sources also comprises a data query method, and one data query method corresponds to one data source, so that the server can query the data sources through the data query method. Correspondingly, the server invokes a plurality of data query methods from configuration information of a plurality of data sources based on the identifiers of the plurality of data sources, and queries the plurality of data sources in parallel through a plurality of data source objects based on the plurality of data query methods, thereby acquiring data.
The data query method is predefined, and may be a Fetch method or other methods, which are not limited specifically.
In the embodiment of the application, the plurality of inquiry execution tasks comprise a plurality of top nodes, the plurality of top nodes summarize the data sent by the sub-nodes thereof to obtain a plurality of service sub-data, and the plurality of service sub-data are output to the server.
In the embodiment of the application, the server converts a plurality of input query fields into query sentences through the analyzer, then generates a plurality of query execution tasks according to the query sentences and the configuration information of the data sources through the query task generator, and performs hybrid query on the plurality of data sources in parallel by utilizing the multi-cooperative characteristic of Golang, thereby improving the parallelism degree of the back-end service, shortening the query time and improving the query efficiency. And the maintenance cost is reduced through the uniformly configured data sources.
It should be noted that, the server may obtain data from the data provider through the data source, and based on this, the process of the server querying the data source is the process of obtaining data from the data provider through the data source.
In embodiments of the present application, the advertisement delivery system may also access new data sources. For ease of distinction, the above-mentioned data sources are referred to as first data sources, and newly accessed data sources are referred to as second data sources. If a plurality of data sources corresponding to the plurality of query fields in the query request comprise a second data source, the server analyzes the plurality of query requests to obtain a plurality of query sentences, the plurality of query sentences comprise identifiers of the second data source and identifiers of a plurality of first data sources, a plurality of query execution tasks are generated based on the plurality of query sentences, the second data source and the plurality of first data sources are queried in parallel through a first node and a second node in the plurality of query execution tasks, and then a plurality of business sub-data obtained by the query are input to the server. The number of the second data sources may be one or more, which is not particularly limited.
308. The server gathers a plurality of business sub-data obtained through a plurality of data sources to obtain business data, and returns the business data to the terminal.
The server can directly summarize the plurality of business sub-data to obtain business data, and can also process the plurality of business sub-data to obtain business data and then return the business data to the terminal.
309. The terminal receives and displays the service data.
The terminal receives the service data sent by the server and displays the service data corresponding to the query fields on the query interface.
Since the service data includes a plurality of service sub-data, the terminal may display the plurality of service sub-data through a plurality of areas, and different areas display different service sub-data. Or the terminal may sort the plurality of service sub-data and then sequentially display the plurality of service sub-data from top to bottom. Of course, the terminal may display the plurality of service sub-data in other manners, which is not particularly limited.
The embodiment of the application provides a query method of service data, which can generate a plurality of data structures according to a plurality of query fields when querying the service data, generate a plurality of query execution tasks according to the plurality of data structures, query a plurality of data sources in parallel through a first node and a second node in the plurality of query execution tasks, finally summarize a plurality of service sub-data obtained through the plurality of data sources to obtain the service data, and return the service data to a terminal. Therefore, the method can search a plurality of data sources in parallel according to a plurality of search fields, so that the search time can be shortened, and the search efficiency can be improved.
Fig. 6 is a schematic structural diagram of a service data query device according to an embodiment of the present application.
Referring to fig. 6, the apparatus includes:
the receiving module 601 is configured to receive a query request of a terminal, where the query request is used to query service data of a target content item, the query request includes a plurality of query fields and identifiers of a plurality of data sources, the identifier of one data source corresponds to at least one query field, and the query field is used to query corresponding service sub-data through the data source;
the parsing module 602 is configured to parse the query request to obtain a plurality of query sentences, where one query sentence corresponds to one data source, and the query sentence includes an identifier of the data source and at least one query field corresponding to the data source;
a first generating module 603, configured to generate a plurality of data structures based on a plurality of query sentences, where one query sentence corresponds to one data structure, and the data structure is configured to store query information used for acquiring service sub-data;
a second generating module 604, configured to generate a plurality of query execution tasks based on a plurality of data structures, where one query execution task includes a first node and a second node, the first node is configured to determine a type of service sub-data to be queried based on query information, and the second node associated with the first node is configured to obtain the service sub-data through a data source based on the type of service sub-data;
A query module 605, configured to query, in parallel, a plurality of data sources through a first node and a second node in a plurality of query execution tasks;
and the summarizing module 606 is configured to summarize a plurality of service sub-data obtained by a plurality of data sources to obtain service data, and return the service data to the terminal.
In one possible implementation, the second generating module 604 is configured to generate a plurality of first nodes based on a plurality of query information in a plurality of data structures; generating a plurality of second nodes based on a plurality of data sources matched by the plurality of query information; a plurality of query execution tasks is generated based on the plurality of first nodes and the plurality of second nodes.
In another possible implementation manner, the second generating module 604 is configured to determine that the first node and the second node have an association relationship; and generating a query execution task based on the first node and the second node which have the association relation.
In another possible implementation manner, the second generating module 604 is configured to associate the first node and the second node that have an association relationship to obtain a query execution task; or determining a plurality of second nodes with association relations; associating a plurality of second nodes and associating the first node with the second node with the association relationship to obtain a query execution task; one second node of the plurality of second nodes with the association relationship is a father node, the other second nodes are child nodes, and the second node serving as the father node is used for obtaining business child data based on data obtained by the other second nodes serving as the child nodes.
In another possible implementation, the query module 605 is configured to determine a type of the plurality of service sub-data by a plurality of first nodes in the plurality of query execution tasks, where the first nodes are configured to send the type of the service sub-data to a second node associated therewith; based on the types of the plurality of business sub-data, a plurality of data sources are queried in parallel through a plurality of second nodes associated with the plurality of first nodes.
In another possible implementation manner, the first generating module 603 is configured to determine configuration information of a plurality of data sources based on identifiers of the plurality of data sources in the plurality of query sentences, where an identifier of one data source corresponds to one configuration information; acquiring a plurality of pieces of structure information from configuration information of a plurality of data sources, wherein one piece of configuration information corresponds to one piece of structure information, and the structure information is used for representing a method adopted for generating a data structure; based on the plurality of query fields, a plurality of data structures are generated from the plurality of structure information.
The embodiment of the application provides a query device for service data, which can generate a plurality of data structures according to a plurality of query fields when the device queries the service data, generate a plurality of query execution tasks according to the plurality of data structures, query a plurality of data sources in parallel through a first node and a second node in the plurality of query execution tasks, finally summarize a plurality of service sub-data obtained through the plurality of data sources to obtain the service data, and return the service data to a terminal. Therefore, the device can search a plurality of data sources in parallel according to a plurality of search fields, so that the search time can be shortened, and the search efficiency can be improved.
Fig. 7 is a schematic structural diagram of a server according to an embodiment of the present application, where the server 700 may have a relatively large difference due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 701 and one or more memories 702, where the memories 702 are used to store executable program codes, and the processors 701 are configured to execute the executable program codes to implement the service data query methods provided in the foregoing method embodiments. Of course, the server 700 may also have a wired or wireless network interface, a keyboard, an input/output interface, and other components for implementing the functions of the device, which are not described herein.
The embodiment of the application also provides a computer readable storage medium, at least one program code is stored in the computer readable storage medium, and the at least one program code is loaded and executed by a processor to realize the service data query method of any implementation mode.
The embodiment of the application also provides a computer program product, which comprises computer program code, the computer program code is stored in a computer readable storage medium, a processor of the computer device reads the computer program code from the computer readable storage medium, and the processor executes the computer program code, so that the computer device executes the query method of the service data of any implementation mode.
In some embodiments, a computer program product according to embodiments of the present application may be deployed to be executed on one computer device or on multiple computer devices at one site or on multiple computer devices distributed across multiple sites and interconnected by a communication network, where the multiple computer devices distributed across multiple sites and interconnected by a communication network may constitute a blockchain system.
The foregoing is illustrative of the present application and is not to be construed as limiting thereof, but rather as various modifications, equivalent arrangements, improvements, etc., which fall within the spirit and principles of the present application.

Claims (10)

1. A method for querying service data, the method comprising:
receiving a query request of a terminal, wherein the query request is used for querying service data of a target content item, the query request comprises a plurality of query fields and a plurality of identifiers of data sources, the identifier of one data source corresponds to at least one query field, and the query field is used for querying corresponding service sub-data through the data source;
analyzing the query request to obtain a plurality of query sentences, wherein one query sentence corresponds to one data source, and the query sentence comprises the identification of the data source and at least one query field corresponding to the data source;
Generating a plurality of data structures based on the plurality of query sentences, wherein one query sentence corresponds to one data structure, and the data structure is used for storing query information used for acquiring the business sub-data;
generating a plurality of query execution tasks based on the plurality of data structures, wherein one query execution task comprises a first node and a second node, the first node is used for determining the type of service sub-data to be queried based on the query information, and the second node associated with the first node is used for acquiring the service sub-data through the data source based on the type of the service sub-data;
querying the plurality of data sources in parallel through a first node and a second node in the plurality of query execution tasks;
and summarizing a plurality of business sub-data obtained through the plurality of data sources to obtain business data, and returning the business data to the terminal.
2. The method of claim 1, wherein generating a plurality of query execution tasks based on the plurality of data structures comprises:
generating a plurality of first nodes based on a plurality of query information in the plurality of data structures;
Generating a plurality of second nodes based on a plurality of data sources matched with the plurality of query information;
the plurality of query execution tasks are generated based on the plurality of first nodes and the plurality of second nodes.
3. The method of claim 2, wherein the generating the plurality of queries to perform tasks based on the plurality of first nodes and the plurality of second nodes comprises:
determining a first node and a second node which have an association relation;
and generating the query execution task based on the first node and the second node which have the association relation.
4. The method of claim 3, wherein generating the query execution task based on the first node and the second node having the association relationship comprises:
the first node and the second node which have the association relationship are associated to obtain the query execution task; or,
determining a plurality of second nodes with association relations; associating the plurality of second nodes and associating the first node with the second node with the association relationship to obtain the query execution task;
one second node of the plurality of second nodes with the association relationship is a father node, other second nodes are child nodes, and the second node serving as the father node is used for obtaining business child data based on data obtained by other second nodes serving as child nodes.
5. The method of claim 1, wherein the performing the query on the plurality of data sources in parallel by the first node and the second node in the plurality of query execution tasks comprises:
determining, by a plurality of first nodes in the plurality of query execution tasks, types of the plurality of service sub-data, the first nodes being configured to send the types of the service sub-data to a second node associated therewith;
and based on the types of the service sub-data, the data sources are queried in parallel through a plurality of second nodes associated with the first nodes.
6. The method of claim 1, wherein the generating a plurality of data structures based on the plurality of query statements comprises:
determining configuration information of a plurality of data sources based on the identifiers of the data sources in the plurality of query sentences, wherein the identifier of one data source corresponds to one configuration information;
acquiring a plurality of pieces of structure information from configuration information of the plurality of data sources, wherein one piece of configuration information corresponds to one piece of structure information, and the structure information is used for representing a method adopted for generating the data structure;
The plurality of data structures is generated from the plurality of structure information based on the plurality of query fields.
7. A business data query device, the device comprising:
the receiving module is used for receiving a query request of the terminal, wherein the query request is used for querying service data of a target content item, the query request comprises a plurality of query fields and a plurality of identifiers of data sources, the identifier of one data source corresponds to at least one query field, and the query field is used for querying corresponding service sub-data through the data source;
the analysis module is used for analyzing the query request to obtain a plurality of query sentences, one query sentence corresponds to one data source, and the query sentence comprises the identification of the data source and at least one query field corresponding to the data source;
the first generation module is used for generating a plurality of data structures based on the plurality of query sentences, one query sentence corresponds to one data structure, and the data structure is used for storing query information used for acquiring the business sub-data;
the second generation module is used for generating a plurality of query execution tasks based on the plurality of data structures, one query execution task comprises a first node and a second node, the first node is used for determining the type of service sub-data to be queried based on the query information, and the second node associated with the first node is used for acquiring the service sub-data through the data source based on the type of the service sub-data;
The query module is used for querying the plurality of data sources in parallel through a first node and a second node in the plurality of query execution tasks;
and the summarizing module is used for summarizing the plurality of business sub-data obtained by the plurality of data sources to obtain business data, and returning the business data to the terminal.
8. A server comprising a processor and a memory for storing at least one computer program, the at least one computer program being loaded by the processor and executing the method of querying service data according to any of claims 1 to 6.
9. A computer readable storage medium storing at least one piece of computer program for executing the method of querying service data according to any one of claims 1 to 6.
10. A computer program product, characterized in that it comprises a computer program code, which is stored in a computer readable storage medium, from which computer program code a processor of a server reads, which processor executes the computer program code, so that the server performs the method of querying service data according to any of claims 1 to 6.
CN202210509010.2A 2022-05-10 2022-05-10 Service data query method, device, server, storage medium and product Pending CN117076487A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210509010.2A CN117076487A (en) 2022-05-10 2022-05-10 Service data query method, device, server, storage medium and product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210509010.2A CN117076487A (en) 2022-05-10 2022-05-10 Service data query method, device, server, storage medium and product

Publications (1)

Publication Number Publication Date
CN117076487A true CN117076487A (en) 2023-11-17

Family

ID=88704860

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210509010.2A Pending CN117076487A (en) 2022-05-10 2022-05-10 Service data query method, device, server, storage medium and product

Country Status (1)

Country Link
CN (1) CN117076487A (en)

Similar Documents

Publication Publication Date Title
US8463739B2 (en) Systems and methods for generating multi-population statistical measures using middleware
CN109933514B (en) Data testing method and device
JP2000348041A (en) Document retrieval method, device therefor and mechanically readable recording medium
CN109388637A (en) Data warehouse information processing method, device, system, medium
CN107291471B (en) Meta-model framework system supporting customizable data acquisition
CN112269816B (en) Government affair appointment correlation retrieval method
CN112860727A (en) Data query method, device, equipment and medium based on big data query engine
CN109213826A (en) Data processing method and equipment
CN112699151A (en) Data processing method, device, equipment and medium
CN111414410A (en) Data processing method, device, equipment and storage medium
US20040049495A1 (en) System and method for automatically generating general queries
CN113268502A (en) Method and equipment for providing information
CN105786941B (en) Information mining method and device
CN114398396A (en) Data query method, storage medium, and computer program product
CN117251414A (en) Data storage and processing method based on heterogeneous technology
CN114490673B (en) Data information processing method and device, electronic equipment and storage medium
CN117076487A (en) Service data query method, device, server, storage medium and product
CN108304219B (en) Secondary development platform and method
CN115422202A (en) Service model generation method, service data query method, device and equipment
CN115114519A (en) Artificial intelligence based recommendation method and device, electronic equipment and storage medium
CN111414567B (en) Data processing method and device
CN115017185A (en) Data processing method, device and storage medium
CN113986876A (en) Method and device for developing data query management and electronic equipment
CN111695031A (en) Label-based searching method, device, server and storage medium
CN113918534A (en) Policy processing system and method

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