Data query method and apparatus
Virtual data table technology is used to shield the underlying details of querying restricted data resources, realizing virtual integration of querying restricted data resources, solving the problem of data resource query complexity, simplifying user operations and improving query efficiency.
Patent Information
- Application Number
- PCT/CN2023/135021
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-25
- Filing Date
- 2023-11-29
- Publication Date
- 2024-10-31
AI Technical Summary
In the existing technology, the query of data resources is limited due to security and privacy protection reasons, and users need to call different data service interfaces respectively, resulting in complex query operations. Especially in inter-agency data integration scenarios, the demand for the integration of query-limited data resources increases. Simplified data queries are difficult to implement.
The underlying details of querying restricted data resources are shielded through virtual data tables to achieve virtualized integration of data resources. Users can use familiar query statements to query restricted data resources through virtual data tables, generate corresponding query requests and send them to the target data source. , receive query results and avoid directly calling each data service interface.
It simplifies user query operations, realizes unified virtualization integration of query-restricted data resources, improves data query efficiency and convenience, and reduces the complexity of queries performed by users.
Smart Images

Figure CN2023135021_31102024_PF_FP_ABST
Abstract
Description
Data query method and device
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on April 25, 2023, with application number 202310459597.5 and application name “Data Query Method and Device”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The embodiments of this specification belong to the field of computer technology, and more particularly, to a data query method and device. Background Art
[0003] Due to data security and privacy concerns, many data resources are query-restricted, typically through data service interfaces. In the current context of data as a factor of production, inter-institutional data integration applications are increasing, and the demand for integrating query-restricted data resources is also growing.
[0004] Summary of the Invention
[0005] The purpose of the present invention is to provide a data query solution that can shield the underlying details of query-restricted data resources through virtual data tables, realize a virtualized integrated method for querying restricted data resources, and enable users to query data on query-restricted data resources by querying virtual data tables using familiar query statements. This can avoid users from calling different query-restricted data resources to query data separately, thereby simplifying the query operations performed by users.
[0006] A first aspect of the present specification provides a data query method, comprising: receiving a target query statement, the target query statement being used to query a virtual data table, the virtual data table supporting a plurality of first reading methods, the plurality of first reading methods corresponding to a plurality of second reading methods respectively supported by data sources; generating a first query request corresponding to the first reading method based on the target query statement, and generating a second query request corresponding to the second reading method based on the first query request and the correspondence between the first reading method and the second reading method; sending the second query request to a target data source supporting the second reading method corresponding to the second query request; and receiving a first query result from the target data source.
[0007] The second aspect of this specification provides a data query device, including: a first receiving unit, configured to receive a target query statement, the target query statement is used to query a virtual data table, the virtual data table supports several first reading methods, and the several first reading methods correspond to second reading methods supported by several data sources respectively; a query processing unit, configured to generate a first query request corresponding to the first reading method based on the target query statement, and generate a second query request corresponding to the second reading method based on the first query request and the correspondence between the first reading method and the second reading method; a sending unit, configured to send the second query request to a target data source that supports the second reading method corresponding to the second query request; and a second receiving unit, configured to receive a first query result from the target data source.
[0008] A third aspect of this specification provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed in a computer, the computer is caused to execute the method described in any implementation manner in the first aspect.
[0009] A fourth aspect of this specification provides a computing device, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method described in any implementation manner in the first aspect is implemented.
[0010] A fifth aspect of this specification provides a computer program product, which, when executed in a computer, causes the computer to execute the method described in any implementation manner in the first aspect.
[0011] In the solution provided by the embodiments of this specification, the second reading method supported by the data source can belong to a query-restricted data resource. The second reading methods supported by several data sources can be pre-abstracted into a virtual data table. The virtual data table supports several first reading methods, and the several first reading methods correspond to the second reading methods supported by the several data sources. Based on this, in this solution, a target query statement for querying the virtual data table can be received, a first query request corresponding to the first reading method is generated based on the target query statement, and a second query request corresponding to the second reading method is generated based on the first query request and the correspondence between the first reading method and the second reading method. Then, the second query request can be sent to a target data source that supports the second reading method corresponding to the second query request, and the first query result is received from the target data source. In this way, the underlying details of the query-restricted data resource can be shielded by the virtual data table, realizing a virtualized integrated method for querying the restricted data resource. This allows users to query the data of the query-restricted data resource by querying the virtual data table with familiar query statements. This avoids users from separately calling different query-restricted data resources to query data, thereby simplifying the query operations performed by users. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0013] FIG1 is a schematic diagram of an application scenario in which the embodiments of this specification can be applied;
[0014] FIG2 is a schematic diagram of a virtual data table according to an embodiment of the present specification;
[0015] FIG3 is a flow chart of a data query method according to an embodiment of the present specification;
[0016] FIG4 is a schematic diagram of the structure of the target platform in an embodiment of this specification;
[0017] FIG5 is an interactive diagram of a data query method according to an embodiment of the present specification;
[0018] FIG6 is a flow chart of a data query method according to an embodiment of the present specification;
[0019] FIG7 is a schematic diagram of the structure of a data query device in an embodiment of this specification. DETAILED DESCRIPTION
[0020] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the embodiments described are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without making creative work should fall within the scope of protection of this specification. In addition, the words "first", "second", etc. in the embodiments of this specification are only used for information distinction and do not play any limiting role.
[0021] As mentioned above, due to data security and privacy concerns, many data resources are query-restricted, typically exposing data through data service interfaces. Data service interfaces typically have query criteria fields and result fields. These query criteria fields and result fields are data fields in the data source corresponding to the data service interface, and the query criteria fields are part of the data source's data fields. Currently, when users want to query data from a data source, they must call the data service interface. This query method restricts users to filtering queries using the specified query criteria fields and cannot simultaneously use the query criteria fields with other fields. Furthermore, when users want to query data from multiple data sources, they must call the data service interfaces for each data source separately, making the query operations more complex. In the current context of data circulation as a factor of production, inter-institutional data integration applications are increasing, and the demand for integrating query-restricted data resources is also growing.
[0022] The embodiments of this specification provide a data query solution that can shield the underlying details of query-restricted data resources through virtual data tables, realizing a virtualized integrated method for querying restricted data resources. Users can query data on query-restricted data resources by querying virtual data tables using familiar query statements. This avoids users from separately calling different query-restricted data resources to query data, thereby simplifying the query operations performed by users.
[0023] FIG1 is a schematic diagram of an application scenario in which an embodiment of this specification can be applied. In the application scenario shown in FIG1 , a target application 101 and a target platform 102 may be included. The target application 101 may be a client application or a server application, which is not specifically limited here. The target platform 102 may be a platform for providing data query services. For example, the target platform 102 may be any one of a data flow hub platform, a data development platform, a privacy collaboration application platform, and a digital matrix service platform.
[0024] The target platform 102 may include a virtual data table that supports a plurality of first read methods, each of which may correspond to a second read method supported by a plurality of data sources. The plurality of data sources may include data sources of a plurality of organizations (e.g., enterprises, etc.). As an example, the plurality of first read methods may include, for example, a read method M1_1, a read method M1_2, and a read method M1_3 as shown in FIG1 . The read method M1_1 may correspond to the read method M2_1 supported by the data source R1, the read method M1_2 may correspond to the read method M2_2 supported by the data source R2, and the read method M1_3 may correspond to the read method M2_3 supported by the data source R3.
[0025] It should be noted that a data source can support one or more second read methods. The second read method can include a data service interface. Each second read method can have a query condition field and a result field. The query condition field can be a field used for filtering queries, generally including a portion of the data fields in the data source corresponding to the second read method. The result field can be a field included in the query results. It should be understood that the query condition field and result field of the second read method are data fields of the data source corresponding to the second read method, and that the second read method queries restricted data resources. The virtual data table included in the target platform 102 can be formed by abstracting the second read methods supported by each of the aforementioned data sources. The virtual data table can be one or more virtual data tables. When the target platform 102 includes multiple virtual data tables, any of the multiple virtual data tables can support at least one first read method, and the at least one first read method corresponds to at least one second read method. There can be a one-to-one correspondence between the first read method and the second read method.
[0026] Referring to Figure 2, it is a schematic diagram of a virtual data table. As shown in Figure 2, the virtual data table can include a table name, field information of each of a plurality of data fields (such as the field information list shown in Figure 2), and method information of the first read method supported (such as the read method information list shown in Figure 2). Optionally, the virtual data table can also include other descriptive attributes. It is understandable that the virtual data table is similar to an ordinary data table, but contains supported read methods. The plurality of data fields can include a query condition field and a result field used by the first read method, and the query condition field and result field correspond to the query condition field and result field used by the second read method corresponding to the first read method. The field information can include the field name, data type, and input / output type of the corresponding data field, and the input / output type can be used to distinguish the query condition field and the result field. Optionally, the field information can also include other extended attributes of the corresponding data field. The method information can include the method name and parameter information list of the corresponding first read method. The parameter information in the parameter information list can include the field name of the query condition field used by the read method and the query operation set supported by the query condition field. The query operation set may specifically be an operator set, and any operator in the operator set may be, for example, one of greater than, less than, equal to, not equal to, greater than or equal to, and less than or equal to, etc. Optionally, the parameter information may further include information indicating whether the query condition field is mandatory.
[0027] In practice, the first reading method and the second reading method are transparent to the user, and the user can send a target query statement for querying the virtual data table to the target platform 102 through the target application 101. The target query statement may include, but is not limited to, an SQL (Structured Query Language) statement. The target platform 102 can determine the first reading method satisfied by the target query statement, and then determine the second reading method corresponding to the satisfied first reading method based on the correspondence between the first reading method and the second reading method, thereby calling the second reading method to query data. It should be understood that the first reading method supported by the virtual data table is not a reading method that can be called. The first reading method can be regarded as intermediate data for determining the second reading method satisfied by the target query statement. In one example, the first reading method can be called a virtual reading method; correspondingly, the second reading method can be called a real reading method.
[0028] By using the data query process described above, the underlying details of query-restricted data resources can be shielded through virtual data tables, realizing a virtualized integration method for querying restricted data resources. Users can query data on query-restricted data resources by querying virtual data tables using familiar query statements. This avoids users from calling different query-restricted data resources to query data separately, thereby simplifying the query operations performed by users.
[0029] The data query solution provided by the embodiments of this specification is introduced below in conjunction with specific embodiments.
[0030] 3 , which is a flow chart of a data query method according to an embodiment of the present specification, can be executed by any device, platform, or device cluster with data storage, computing, and processing capabilities, such as the target platform 102 shown in FIG1 .
[0031] As shown in FIG3 , first, in step S301 , a target query statement is received. The target query statement is used to query a virtual data table. The virtual data table supports several first reading methods, which correspond to second reading methods supported by several data sources.
[0032] Specifically, a target query statement may be received from a target application. The target query statement may specify a virtual data table to be queried, and the virtual data table to be queried may be one or more virtual data tables. When the virtual data table to be queried is multiple virtual data tables, any virtual data table in the multiple virtual data tables may, for example, support at least one first reading method, and the at least one first reading method may correspond to at least one second reading method.
[0033] The virtual data table may include a table name, field information of each of a plurality of data fields, and method information of a supported first reading method. The plurality of data fields may include a query condition field and a result field used by the first reading method, and the query condition field and the result field may correspond to the query condition field and the result field used by the second reading method corresponding to the first reading method. The field information may include the field name, data type, and input / output type of the corresponding data field, and the input / output type is used to distinguish the query condition field and the result field. The method information may include the method name and a parameter information list of the corresponding first reading method, and the parameter information in the parameter information list may include the field name of the query condition field used by the first reading method, and the query operation set supported by the query condition field. For a more detailed explanation of the virtual data table, please refer to the relevant description in the foregoing text, which will not be repeated here.
[0034] The target query statement may further include query conditions, which may include filtering conditions for the virtual data table to be queried. The filtering conditions may include data fields in the virtual data table and parameter values corresponding to the data fields. Furthermore, when the virtual data table to be queried is a plurality of virtual data tables, the query conditions may also include association conditions between the virtual data tables. In one example, the target query statement may include an SQL statement. The SQL statement may include a from clause and a where clause, wherein the from clause specifies the virtual data table to be queried, and the where clause includes the query conditions.
[0035] In step S303 , a first query request corresponding to the first reading method is generated based on the target query statement, and a second query request corresponding to the second reading method is generated based on the first query request and the correspondence between the first reading method and the second reading method.
[0036] As an example, the correspondence between the first and second read methods can indicate, for example, a correspondence between the method names of the first and second read methods, a correspondence between the query condition fields of the first and second read methods, and a correspondence between the result fields of the first and second read methods. A first read method that satisfies a target query statement, such as a first read method that satisfies a filter condition in the target query statement, can be determined, and a first query request corresponding to the first read method can be generated. The first query request can include, for example, the method name of the first read method, the field name of the query condition field used by the first read method, and a parameter value corresponding to the query condition field in the filter condition. It should be understood that the parameter value can serve as an input parameter corresponding to the query condition field for the first read method. Subsequently, based on the correspondence between the first and second read methods, the method name and the field name of the query condition field used by the second read method corresponding to the first read method corresponding to the first query request can be determined. A second query request corresponding to the second read method can then be generated based on the first query request. The second query request may include, for example, the method name of the second reading method, the field name of the query condition field used by the second reading method, and the parameter value.
[0037] As another example, the correspondence between the first reading method and the second reading method can indicate a correspondence between the method names of the first reading method and the second reading method. After generating a first query request corresponding to the first reading method, a second query request corresponding to the second reading method can be generated based on the first query request, the correspondence between the first reading method and the second reading method, and the correspondence between the data fields included in the virtual data table and the data source.
[0038] In step S305 , a second query request is sent to a target data source that supports a second reading method corresponding to the second query request.
[0039] In step S307 , a first query result is received from the target data source.
[0040] In one embodiment, after step S307, a second query result requested by the first query request may be generated based on the first query result and the correspondence between the first and second read methods. Furthermore, the correspondence may include a first correspondence between the result fields of the first and second read methods, respectively. The second query result may be generated specifically based on the first query result and the first correspondence. It should be understood that the second query result is a query result adapted for the first read method corresponding to the first query request, and the query result includes the result fields of the first read method.
[0041] In one embodiment, a target query result corresponding to the target query statement can be generated based on the target query statement and the second query result, and the target query result can be returned. For example, when the target query statement is received from a target application, the target query result can be returned to the target application. It should be noted that when the target query statement also involves other query processing operations, such as at least one of a result filtering operation, a result merging operation, a result joining operation, and an associated query operation, the other query processing operation can be performed based on the second query result to obtain the target query result corresponding to the target query statement.
[0042] Below, the data query method provided by the embodiment corresponding to FIG3 is described by way of example, taking the virtual data table table1 as the virtual data table to be queried by the target query statement, and virtual data table table1 supporting read methods M1_1, M1_2, and M1_3. Read method M1_1 corresponds to read method M2_1 supported by data source R1, read method M1_2 corresponds to read method M2_2 supported by data source R2, and read method M1_3 corresponds to read method M2_3 supported by data source R3. Read method M2_1 uses the query condition field col1_1, and uses the result fields col1_1, col1_2, and col1_3. Read method M1_1 uses the query condition field col1 corresponding to col1_1, and uses the result fields col1, col2 corresponding to col1_2, and col3 corresponding to col1_3. Read method M2_2 uses the query condition field col2_2, and the result fields used are col2_1, col2_2, and col2_3. Read method M1_2 uses the query condition field col5 corresponding to col2_2, and the result fields used are col4 corresponding to col2_1, col5, and col6 corresponding to col2_3. Read method M2_3 uses the query condition fields col3_3 and col3_4, and the result fields used are col3_1, col3_2, col3_3, and col3_4. Read method M1_3 uses the query condition fields col9 corresponding to col3_3 and col10 corresponding to col3_4, and the result fields used are col7 corresponding to col3_1, col8 corresponding to col3_2, col9, and col10. Virtual data table table1 includes 10 data fields, col1 to col10.
[0043] Assume that the target query statement is the following target SQL statement: select col1, col2, col3 from table1 where col1 = col4 and col5 = col8 and col1 = 'ee' and col9 = 123 and col10 = 'ABC'. The first read method satisfied by the target SQL statement can be determined. For example, based on the filter conditions col1 = 'ee' and col9 = 123 and col10 = 'ABC' in the target SQL statement, it can be determined that col1 = 'ee' satisfies read method M1_1, and col9 = 123 and col10 = 'ABC' satisfies read method M1_3. This allows for the generation of query requests Q1_1 corresponding to read method M1_1 and Q1_3 corresponding to read method M1_3. Query request Q1_1 may include the method name of read method M1_1, the field name of the query condition field col1, and the parameter value 'ee' corresponding to col1. Query request Q1_3 may include the method name of read method M1_3, the field names of query condition fields col9 and col10, the parameter value 123 corresponding to col9, and the parameter value 'ABC' corresponding to col10. Then, based on the correspondence between the first read method and the second read method, it can be determined that read method M1_1 corresponds to read method M2_1, and that read method M1_3 corresponds to read method M2_3. Therefore, query request Q2_1 corresponding to read method M2_1 can be generated based on query request Q1_1, and query request Q2_3 corresponding to read method M2_3 can be generated based on query request Q1_3. Query request Q2_1 may include the method name of read method M2_1, the field name of query condition field col1_1, and the parameter value 'ee' corresponding to col1_1. Query request Q2_3 may include the method name of read method M2_3, the query condition fields col3_3 and col3_4, the parameter value 123 corresponding to col3_3, and the parameter value 'ABC' corresponding to col3_4. Next, query request Q2_1 may be sent to data source R1 that supports read method M2_1, causing data source R1 to return query result Re1_1. Query request Q2_3 may also be sent to data source R3 that supports read method M2_3, causing data source R3 to return query result Re1_3.
[0044] Afterwards, based on the query result Re1_1 and the correspondence between the first and second read methods, the query result Re2_1 requested by query request Q1_1 can be generated. Furthermore, based on the query result Re1_3 and this correspondence, the query result Re2_3 requested by query request Q1_3 can be generated. Next, based on the condition col5=col8 in the target SQL statement, it can be determined that the result data of field col8 in query result Re2_3 needs to be used as the parameter value corresponding to field col5, and this condition satisfies read method M1_2. Therefore, a query request Q1_2 corresponding to read method M1_2 can be generated. Query request Q1_2 can include the method name of read method M1_2, the field name of the query condition field col5, and the parameter value corresponding to col5 (i.e., the result data of field col8). Next, based on this correspondence, it can be determined that read method M1_2 corresponds to read method M2_2. Therefore, based on query request Q1_2, a query request Q2_2 corresponding to read method M2_2 can be generated. Query request Q2_2 may include the method name of read method M2_2, the field name of query condition field col2_2, and the parameter value corresponding to col2_2 (i.e., the result data of field col8). Next, query request Q2_2 may be sent to data source R2, which supports read method M2_2, so that data source R2 returns query result Re1_2. Next, based on query result Re1_2 and the corresponding relationship, query result Re2_2 requested by query request Q1_2 may be generated.
[0045] Next, for the condition col1 = col4 in the target SQL statement, we know that col1 is included in the query result Re2_1, and col4 is included in the query result Re2_2. Based on this condition, we can intersect the query results Re2_1 and Re2_2 to obtain an intersection result. Then, from this intersection result, we can obtain the result data for each field to be queried by the select clause in the target SQL statement, thereby obtaining the target query result corresponding to the target SQL statement, which contains this result data.
[0046] In the solution provided by the embodiment corresponding to FIG3 , the second read method supported by the data source can belong to a query-restricted data resource. The second read methods supported by several data sources can be pre-abstracted into a virtual data table. The virtual data table supports several first read methods, and the several first read methods correspond to the second read methods supported by the several data sources. Based on this, in this solution, a target query statement for querying the virtual data table can be received, a first query request corresponding to the first read method is generated based on the target query statement, and a second query request corresponding to the second read method is generated based on the first query request and the correspondence between the first read method and the second read method. The second query request can then be sent to a target data source that supports the second read method corresponding to the second query request, and the first query result is received from the target data source. Thus, the underlying details of the query-restricted data resource can be shielded by the virtual data table, realizing a virtualized integrated approach to querying the restricted data resource. This allows users to query data on the query-restricted data resource by querying the virtual data table using familiar query statements. This avoids users from separately calling different query-restricted data resources to query data, thereby simplifying the query operations performed by users.
[0047] In one embodiment, the execution body of the data query method, such as the target platform, may include a driver component, a data virtualization engine, a data resource integration component, and a data resource adaptation component as shown in Figure 4. Figure 4 is a schematic diagram of the structure of the target platform. The driver component may include a JDBC (Java Database Connectivity) driver component. Data virtualization can be understood as a data integration method. The difference from ETL (data warehouse technology, the abbreviation of Extract-Transform-Load) data integration may be that data is not copied and converted, a virtual data layer is constructed, and a unified data service that supports different data applications and users is provided. It should be noted that any one of the JDBC driver component, the data virtualization engine, the data resource integration component, and the data resource adaptation component can be a software module or a component with software and hardware resources, etc., and is not specifically limited here.
[0048] The JDBC driver component can implement the JDBC standard, provide standardized application access capabilities, and facilitate application integration and docking. In the solution provided in the embodiments of this specification, the applications accessed by the JDBC driver component include the target applications described above. In practice, when accessing the target application, the JDBC driver component can receive a request from the target application to obtain a connection, such as a request to obtain the URL (Uniform Resource Locator) and / or props of the JDBC driver component. Among them, props can be a read-only value for a single instance of the component. Afterwards, the JDBC driver component can initialize the data virtualization engine in response to the request, and return a JDBC connection to the target application, so that the target application accesses the JDBC driver component based on the JDBC connection to perform data queries.
[0049] The data virtualization engine is the core processing engine for query-restricted data resource integration. It schedules the execution of target query statements. During this scheduling process, the data virtualization engine interacts with the data resource integration component, which in turn interacts with the data resource adapter component, to enable querying of query-restricted data resources.
[0050] The data resource integration component can be used to implement a virtual data table abstraction for querying restricted data resources. For example, the data resource integration component can abstract the second read method supported by each of the aforementioned data sources into a virtual data table. Furthermore, the data resource integration component can provide the data virtualization engine with metadata about the virtual data table and the execution capabilities of the first read method. Furthermore, the data resource integration component can provide the data resource adapter component with the corresponding relationship between the first read method and the second read method.
[0051] The Data Resource Adapter component can be used to adapt queries against restricted data resources, shielding interaction details and differences between data resources. For example, data resource interactions may require prior authentication, and there may be differences between the data resource format and the virtual data table format. These can be handled by the Data Resource Adapter component.
[0052] It should be noted that by making the target platform include a JDBC driver component, a data virtualization engine, a data resource integration component, and a data resource adapter component, a standard, easy-to-use development approach for query-restricted data resource integration can be provided to developers based on data virtualization technology. The data virtualization engine shields the execution details of query-restricted data resource integration. By adopting this development approach, it is possible to avoid developing specific code for each application based on a hard-coded development approach or orchestrating development based on a process orchestration approach, thereby effectively simplifying the query-restricted data resource integration development process. Developers only need to focus on data query requirements and can query virtual data tables using familiar query statements to implement data queries on query-restricted data resources.
[0053] Next, based on the data query method provided in the embodiment corresponding to FIG3 , the interaction process between the target application, JDBC driver component, data virtualization engine, data resource integration component, data resource adapter component, and data source is described in conjunction with FIG5 . FIG5 is a schematic diagram of the interaction of the data query method in the embodiment of this specification.
[0054] As shown in Figure 5, the target application can send a target query statement for querying the virtual data table to the JDBC driver component, causing the JDBC driver component to send the target query statement to the data virtualization engine. The data virtualization engine can then generate a first query request corresponding to the first read method based on the target query statement and send the first query request to the data resource integration component. The data resource integration component can then send the first query request to the data resource adapter component. Furthermore, if the data resource adapter component does not store a correspondence between the first and second read methods, the data resource integration component can also send this correspondence to the data resource adapter component. The data resource adapter component can then generate a second query request corresponding to the second read method based on the first query request and the correspondence, and send the second query request to a target data source that supports the second read method corresponding to the second query request. The target data source can then execute the second query request to obtain the first query result and return the first query result to the data resource adapter component. Next, the data resource adapter component can generate a second query result requested by the first query request based on the first query result and the corresponding relationship, and return the second query result to the data resource integration component, so that the data resource integration component returns the second query result to the data virtualization engine. In one example, the data resource integration component can convert the second query result, such as performing format conversion, and return the converted second query result to the data virtualization engine. The format of the second query result after format conversion is a format supported by the data virtualization engine. Next, the data virtualization engine can generate a target query result corresponding to the target query statement based on the target query statement and the second query result, and return the target query result to the JDBC driver component, so that the JDBC driver component returns the target query result to the target application. In one example, the JDBC driver component can convert the target query result, such as performing format conversion, and return the converted target query result to the target application. The format of the target query result after format conversion is a format supported by the target application.
[0055] 6 is a flow chart of a data query method according to an embodiment of the present specification. The method can be executed by any device, platform, or device cluster with data storage, computing, and processing capabilities, for example, the target platform 102 shown in FIG1 can be executed.
[0056] As shown in FIG6 , first, in step S601 , a target query statement is received. The target query statement is used to query a virtual data table. The virtual data table supports several first reading methods, which correspond to second reading methods supported by several data sources.
[0057] Among them, step S601 corresponds to step S301 in the previous text. Please refer to the relevant description of step S301 and will not be repeated here.
[0058] In one embodiment, after receiving the target query statement, the target query statement can be syntax-checked so that the target query statement that has passed the syntax check can be subsequently query-processed. This can avoid query processing of illegal query statements, thereby effectively saving query processing time. When the target query statement is syntax-checked, the metadata of the virtual data table to be queried by the target query statement can be obtained, and the target query statement can be syntax-checked based on the metadata. Furthermore, the target query statement can be parsed through a syntax tree to obtain a parsing result, so that the target query statement can be syntax-checked based on the metadata and the parsing result. It should be noted that syntax tree parsing methods and syntax checking methods are well-known technologies in the art, and the specific syntax tree parsing process and syntax checking process will not be elaborated here.
[0059] In step S603 , a scheduling graph corresponding to the target query statement is obtained, where the scheduling graph includes a plurality of scheduling nodes and connection edges between the nodes, and each leaf node in the plurality of scheduling nodes includes a different first reading method.
[0060] As an example, a scheduling graph corresponding to the target query statement may be obtained in response to the target query statement passing syntax verification. The scheduling graph may be, for example, a directed acyclic graph (DAG).
[0061] A scheduling graph corresponding to the target query statement can be generated based on the execution plan of the target query statement. The execution plan can be a tree-like execution plan, which can include multiple nodes and connecting edges between the nodes, each leaf node in the multiple nodes includes a different first read method, and there are multiple branch nodes in the multiple nodes, each of the multiple branch nodes has multiple child nodes, and the corresponding child nodes have dependency relationships. The multiple nodes correspond to multiple operations, and the leaf nodes in the multiple nodes correspond to query call operations for the first read method.
[0062] It should be noted that the branch nodes in the embodiments of this specification may include any of union nodes, join nodes, and associated query nodes. A union node can be used to union the result data of its child nodes, a join node can be used to join the result data of its child nodes, and an associated query node can be used to use the result data of one child node as an input parameter for another child node, thereby causing the other child node to perform a data query based on the input parameter.
[0063] In one embodiment, an execution plan for a target query statement can be obtained and partitioned into multiple subgraphs along several branch nodes. These subgraphs are then converted into multiple scheduling nodes, where each subgraph includes at least one node. Subsequently, a relationship graph between the multiple scheduling nodes can be constructed based on the dependencies between the subnodes corresponding to the several branch nodes, and this relationship graph can be used as a scheduling graph.
[0064] In one example, the execution plan for the target query statement can be a logical execution plan. A logical execution plan can be understood as an execution plan composed of logical operations, primarily describing the content to be executed to implement the data query. The logical execution plan for the target query statement can include multiple logical nodes and connecting edges between the nodes, each leaf node in the multiple logical nodes including a different first read method, and multiple logical branch nodes in the multiple logical nodes, each having multiple child nodes. It should be noted that a logical node can be understood as a logical operation.
[0065] The leaf node in the logical execution plan of the target query statement can be called a logical query call node. The logical query call node may include a first reading method and a filtering condition for the virtual data table corresponding to the first reading method, and the filtering condition satisfies the first reading method. The filtering condition may be a filtering condition included in the target query statement, or may be determined based on the association condition between the virtual data table and other virtual data tables in the target query statement. When the above-mentioned several logical branch nodes include a logical connection node, the logical connection node may include an association condition, and the association condition may be determined based on the association condition between the virtual data tables corresponding to each child node of the logical connection node.
[0066] In another example, the execution plan of the target query statement may be a physical execution plan. The physical execution plan may be understood as an execution plan composed of physical operations, which mainly describes the implementation scheme of the data query execution content. The physical execution plan of the target query statement may include multiple physical nodes and connecting edges between nodes, each leaf node in the multiple physical nodes includes a different first reading method, and there are several physical branch nodes in the multiple physical nodes, each having multiple child nodes, and the several physical branch nodes respectively correspond to the dependency relationships between the child nodes. It should be pointed out that the physical nodes may be understood as physical operations, and the leaf nodes in the physical execution plan may be called physical query call nodes. Based on this, when obtaining the execution plan of the target query statement, the logical execution plan of the target query statement may be obtained, and the logical execution plan may be converted into a physical execution plan.
[0067] When converting a logical execution plan into a physical execution plan, for example, each logical query call node in the logical execution plan can be converted into a corresponding physical query call node, and several logical branch nodes in the logical execution plan can be converted into corresponding physical branch nodes. In addition, when the logical execution plan also includes a logical projection node and several logical filtering nodes, for a logical filtering node among the several logical filtering nodes, if there is a connection edge between the logical filtering node and the logical projection node, the logical filtering node and the logical projection node can be merged, and the merged result can be converted into a corresponding physical computing node; if there is no connection edge between the logical filtering node and the logical projection node, the logical filtering node can be converted into a corresponding physical computing node. Among them, the several logical filtering nodes can be one or more logical filtering nodes, the logical filtering node can be used to filter the result data of its child nodes, and the logical projection node can be used to return the data required for the query. After completing the conversion from the logical node to the corresponding physical node, a physical execution plan can be constructed based on the relationship between the nodes obtained by the conversion.
[0068] In the process of partitioning the execution plan of a target query statement into multiple subgraphs along a plurality of branch nodes and converting the multiple subgraphs into multiple scheduling nodes, for any first branch node among the plurality of branch nodes, if the number of child nodes of each node on a first branch path of the first branch node is no greater than 1 and each node does not depend on nodes on other branch paths of the first branch node, then each node may be partitioned into the same first subgraph, and an execution statement list of each node is obtained. Based on the execution statement list, a first execution function is generated, thereby generating a first scheduling node corresponding to the first subgraph and including the first execution function. If the number of child nodes of each node is no greater than 1 and each node depends on nodes on other branch paths, then each node and the first branch node may be partitioned into the same second subgraph, and an execution statement list of each node is obtained. Based on the execution statement list, a second execution function is generated, thereby generating a sub-process node including the second execution function. Furthermore, an execution statement list of the first branch node is obtained, and based on the execution statement list, a third execution function is generated, thereby generating a main process node including the third execution function. The combination of the main process node and the sub-process node is then used as a second scheduling node corresponding to the second subgraph. The third execution function calls the second execution function. If the first branch node is connected to the root node by a connection edge and no scheduling node associated with the first branch node is generated, the first branch node and the root node can be divided into the same third subgraph, and the execution statement list of the first branch node and the root node is obtained. Based on the execution statement list, a fourth execution function is generated, and then a third scheduling node corresponding to the third subgraph and including the fourth execution function is generated.
[0069] In step S605, for a leaf node in the scheduling graph, a first query request corresponding to the first reading method included in the leaf node is generated, and based on the first query request and the correspondence between the first reading method and the second reading method, a second query request corresponding to the second reading method is generated.
[0070] Specifically, for each leaf node in the scheduling graph, a first query request corresponding to the first reading method included in the leaf node can be generated, and based on the first query request and the correspondence between the first reading method and the second reading method, a second query request corresponding to the second reading method can be generated.
[0071] In step S607 , the second query request is sent to a target data source that supports the second reading method corresponding to the second query request.
[0072] In step S609 , a first query result is received from the target data source.
[0073] In one embodiment, after step S609, a second query result requested by the first query request may be generated based on the first query result and the correspondence between the first reading method and the second reading method. Furthermore, the correspondence may include a first correspondence between the result fields of the first reading method and the second reading method, and the second query result may be generated based on the first query result and the first correspondence.
[0074] Furthermore, non-leaf nodes in the scheduling graph can be scheduled based on the second query result in a direction from the leaf node to the root node, thereby obtaining a target query result corresponding to the target query statement and returning the target query result. For example, when the target query statement is received from the target application, the target query result can be returned to the target application.
[0075] The solution provided by the embodiment corresponding to FIG6 can shield the underlying details of querying restricted data resources through virtual data tables, realizing a virtualized integrated approach to querying restricted data resources. This allows users to query data on restricted data resources by querying the virtual data tables using familiar query statements. This avoids users from separately querying different restricted data resources, thereby simplifying user query operations. Furthermore, by generating a first query request corresponding to the first read method included in each leaf node in the scheduling graph, concurrent scheduling can be achieved for each leaf node in the scheduling graph, thereby parallelizing queries on multiple data sources and improving the overall efficiency of data query execution.
[0076] Below, taking the execution subject of the data query method as the target platform, the target platform includes a JDBC driver component, a data virtualization engine, a data resource integration component and a data resource adaptation component as an example, based on the data query method provided in the embodiment corresponding to Figure 6, the interaction process between the target application, JDBC driver component, data virtualization engine, data resource integration component, data resource adaptation component and data source is introduced.
[0077] Specifically, the target application can send a target query statement for querying a virtual data table to the JDBC driver component, causing the JDBC driver component to send the target query statement to the data virtualization engine. The data virtualization engine can then perform syntax tree parsing on the target query statement to obtain a parsing result, obtain metadata of the virtual data table from the data resource integration component, and perform syntax validation on the target query statement based on the parsing result and the metadata. In response to the target query statement passing the syntax validation, the data virtualization engine can obtain a dispatch graph corresponding to the target query statement. Next, for each leaf node in the dispatch graph, the data virtualization engine can generate a first query request corresponding to the first read method included in the leaf node and send the first query request to the data resource integration component. The data resource integration component can then send the first query request to the data resource adapter component. Furthermore, if the data resource adapter component does not store a correspondence between the first and second read methods, the data resource integration component can also send the correspondence to the data resource adapter component. Next, the data resource adapter component can generate a second query request corresponding to the second read method based on the first query request and the correspondence, and send the second query request to a target data source that supports the second read method corresponding to the second query request. Next, the target data source can obtain the first query result by executing the second query request and return the first query result to the data resource adapter component. Next, the data resource adapter component can generate the second query result requested by the first query request based on the first query result and the corresponding relationship, and return the second query result to the data resource integration component, so that the data resource integration component returns the second query result to the data virtualization engine. Next, the data virtualization engine can schedule non-leaf nodes in the scheduling graph based on the second query result in a direction from leaf nodes to root nodes, thereby obtaining the target query result corresponding to the target query statement, and return the target query result to the JDBC driver component, so that the JDBC driver component returns the target query result to the target application.
[0078] When obtaining the scheduling graph corresponding to the target query statement, the data virtualization engine may, for example, obtain the logical execution plan of the target query statement, convert the logical execution plan into a physical execution plan, and then generate a scheduling graph based on the physical execution plan.
[0079] In one example, a data virtualization engine may include a parsing component, a validation component, a logical optimization component, a physical optimization component, an execution compilation component, and an execution scheduling component. The parsing component may perform syntax tree parsing on a target query statement to obtain a parsing result. The validation component may obtain metadata of a virtual data table from a data resource integration component and perform syntax verification on the target query statement based on the parsing result and the metadata. The logical optimization component may obtain a logical execution plan for the target query statement. The physical optimization component may convert the logical execution plan into a physical execution plan. The execution compilation component may generate a scheduling graph based on the physical execution plan. The execution scheduling component may concurrently schedule multiple scheduling nodes in the scheduling graph. For example, for each leaf node in the scheduling graph, the execution scheduling component may generate a first query request corresponding to a first read method included in the leaf node and send the first query request to the data resource integration component. Upon receiving a second query result returned by the data resource integration component, the execution scheduling component may schedule non-leaf nodes in the scheduling graph based on the second query result, moving from the leaf node to the root node, thereby obtaining a target query result corresponding to the target query statement.
[0080] Figure 7 is a schematic diagram of the structure of a data query device according to an embodiment of the present disclosure. The device can be applied to any device, platform or device cluster with data storage, computing and processing capabilities, for example, it can be applied to the target platform 102 shown in Figure 1 .
[0081] As shown in FIG7 , the data query apparatus 700 in the embodiment of the present specification may include: a first receiving unit 701, a query processing unit 702, a sending unit 703, and a second receiving unit 704. The first receiving unit 701 is configured to receive a target query statement, where the target query statement is used to query a virtual data table, where the virtual data table supports a plurality of first read methods, where the plurality of first read methods correspond to a plurality of second read methods supported by respective data sources; the query processing unit 702 is configured to generate a first query request corresponding to the first read method based on the target query statement, and to generate a second query request corresponding to the second read method based on the first query request and the correspondence between the first read method and the second read method; the sending unit 703 is configured to send the second query request to a target data source that supports the second read method corresponding to the second query request; and the second receiving unit 704 is configured to receive the first query result from the target data source.
[0082] In one embodiment, the virtual data table may be a plurality of virtual data tables, and any virtual data table among the plurality of virtual data tables supports at least one first reading method, and the at least one first reading method corresponds to at least one second reading method.
[0083] In one embodiment, a virtual data table may include a table name, field information for each of a plurality of data fields, and method information for a supported first read method. The plurality of data fields may include a query condition field and a result field used by the first read method, and the query condition field and result field correspond to the query condition field and result field used by a second read method corresponding to the first read method. Furthermore, the field information may include the field name, data type, and input / output type of the corresponding data field, and the input / output type may be used to distinguish the query condition field and the result field. The method information may include the method name and a parameter information list for the corresponding first read method. The parameter information in the parameter information list may include the field name of the query condition field used by the first read method and the query operation set supported by the query condition field.
[0084] In one embodiment, the apparatus may further include a result conversion unit (not shown) configured to generate a second query result requested by the first query request based on the first query result and the correspondence relationship. Furthermore, the correspondence relationship may include a first correspondence between result fields of the first read method and the second read method, and the result generation unit may be further configured to generate the second query result requested by the first query request based on the first query result and the first correspondence relationship.
[0085] In one embodiment, the above-mentioned device may also include: an acquisition unit (not shown in the figure), configured to obtain a scheduling graph corresponding to the target query statement, the scheduling graph including multiple scheduling nodes and connecting edges between the nodes, and each leaf node in the multiple scheduling nodes including a different first reading method; the query processing unit 702 can be further configured to: for a leaf node in the scheduling graph, generate a first query request corresponding to the first reading method included in the leaf node.
[0086] Furthermore, the query processing unit 702 can also be configured to: schedule the non-leaf nodes in the scheduling graph based on the second query result along the direction from the leaf node to the root node, so as to obtain the target query result corresponding to the target query statement; the sending unit 704 can also be configured to: return the target query result.
[0087] Furthermore, the first receiving unit 701 may be further configured to: receive a target query statement from a target application; and the sending unit 704 may be further configured to: return a target query result to the target application.
[0088] In one embodiment, the acquisition unit can be further configured to: obtain an execution plan for the target query statement, the execution plan including multiple nodes and connecting edges between the nodes, each leaf node in the multiple nodes including a different first reading method, and there are several branch nodes in the multiple nodes, each of the several branch nodes having multiple child nodes and corresponding dependencies between the child nodes; along the several branch nodes, the execution plan is divided into multiple subgraphs, and the multiple subgraphs are converted into multiple scheduling nodes; wherein a single subgraph includes at least one node; based on the dependency, a relationship graph between the multiple scheduling nodes is constructed, and the relationship graph is used as a scheduling graph.
[0089] Furthermore, the execution plan may be a physical execution plan, the multiple nodes may be multiple physical nodes, and the multiple branch nodes may be multiple physical branch nodes.
[0090] Furthermore, the acquisition unit can be further configured to: obtain a logical execution plan of the target query statement, the logical execution plan including multiple logical nodes and connecting edges between the nodes, each leaf node in the multiple logical nodes including a different first reading method, and there are several logical branch nodes in the multiple logical nodes, each having multiple child nodes; convert the logical execution plan into a physical execution plan.
[0091] In one embodiment, the above-mentioned device may also include: a verification unit (not shown in the figure), configured to obtain metadata of the virtual data table; perform syntax verification on the target query statement based on the metadata; the acquisition unit may be further configured to: in response to the target query statement passing the syntax verification, obtain a scheduling graph corresponding to the target query statement.
[0092] Furthermore, the above-mentioned device may also include: a parsing unit (not shown in the figure), configured to perform syntax tree parsing on the target query statement to obtain a parsing result; the verification unit may be further configured to: perform syntax verification on the target query statement based on the above-mentioned metadata and the parsing result.
[0093] In the device embodiment corresponding to FIG7 , for further explanation of each unit, reference may be made to the relevant description in the above-mentioned related method embodiment, which will not be repeated here.
[0094] An embodiment of this specification further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed in a computer, the computer is caused to execute the data query method described in the method embodiment above.
[0095] An embodiment of this specification also provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the data query method described in the method embodiment above is implemented.
[0096] The embodiments of this specification also provide a computer program product, wherein when the computer program product is executed in a computer, the computer is caused to execute the data query method described in the method embodiment above.
[0097] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures like diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.
[0098] The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to implementing the controller in a purely computer-readable program code format, the controller can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules that implement the method and structures within the hardware component.
[0099] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a server system. Of course, this application does not exclude that with the future development of computer technology, the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, an in-vehicle human-computer interaction device, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0100] Although one or more embodiments of this specification provide method operation steps as described in the embodiments or flow charts, more or fewer operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way of executing the order of many steps and does not represent the only execution order. When the device or terminal product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment). The term "comprise", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, product or equipment including a series of elements includes not only those elements, but also includes other elements that are not clearly listed, or also includes elements inherent to such process, method, product or equipment. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or equipment including the elements. For example, if the words first, second, etc. are used to represent the name, they do not represent any particular order.
[0101] For the convenience of description, the above devices are described in terms of functions divided into various modules. Of course, when implementing one or more of the present specifications, the functions of each module can be implemented in the same or multiple software and / or hardware, or the module that implements the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0102] The present invention is described with reference to the flowcharts and / or block diagrams of the methods, apparatus (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one or more processes in the flowchart and / or one or more blocks in the block diagram.
[0103] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0104] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0105] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0106] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0107] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage, graphene storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
[0108] Those skilled in the art will appreciate that one or more embodiments of this specification may be provided as a method, system, or computer program product. Thus, one or more embodiments of this specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0109] One or more embodiments of this specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. One or more embodiments of this specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0110] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between the various embodiments can be referenced across them. Each embodiment focuses on the differences from the other embodiments. In particular, since the system embodiments are generally similar to the method embodiments, their description is relatively simple. For relevant parts, reference can be made to the description of the method embodiments. Throughout this specification, reference to the terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with that embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic representations of these terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, those skilled in the art may combine and integrate the different embodiments or examples, and features of different embodiments or examples, described in this specification, without conflict.
[0111] The foregoing description is merely an example of one or more embodiments of this specification and is not intended to limit the one or more embodiments of this specification. Those skilled in the art will appreciate that various modifications and variations of one or more embodiments of this specification are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of this specification are intended to be included within the scope of the claims.
Claims
1. A data query method, comprising: Receive a target query statement, where the target query statement is used to query a virtual data table, where the virtual data table supports a plurality of first reading methods, where the plurality of first reading methods correspond to a second reading method respectively supported by a plurality of data sources; Generate a first query request corresponding to a first reading method based on the target query statement, and generate a second query request corresponding to a second reading method based on the first query request and a correspondence between the first reading method and the second reading method; Sending the second query request to a target data source that supports a second reading method corresponding to the second query request; A first query result is received from the target data source.
2. The data query method according to claim 1, wherein: The virtual data table is a plurality of virtual data tables, and any virtual data table among the plurality of virtual data tables supports at least one first reading method, and the at least one first reading method corresponds to at least one second reading method.
3. The data query method according to claim 1, wherein: The virtual data table includes a table name, field information of each of multiple data fields, and method information of a supported first reading method, wherein the multiple data fields include a query condition field and a result field used by the first reading method, and the query condition field and the result field correspond to the query condition field and the result field used by a second reading method corresponding to the first reading method.
4. The data query method according to claim 3, wherein: The field information includes the field name, data type and input / output type of the corresponding data field, and the input / output type is used to distinguish the query condition field and the result field; The method information includes a method name and a parameter information list of the corresponding first reading method. The parameter information in the parameter information list includes a field name of a query condition field used by the first reading method and a query operation set supported by the query condition field.
5. The data query method according to any one of claims 1 to 4, wherein: The corresponding relationship includes a first corresponding relationship between the result fields of the first reading method and the second reading method respectively; as well as The method further comprises: Based on the first query result and the first corresponding relationship, a second query result requested by the first query request is generated.
6. The data query method according to claim 5, further comprising: Obtaining a scheduling graph corresponding to the target query statement, the scheduling graph comprising a plurality of scheduling nodes and connection edges between the nodes, wherein each leaf node in the plurality of scheduling nodes comprises a different first reading method; The generating a first query request corresponding to the first reading method based on the target query statement includes: For a leaf node in the scheduling graph, a first query request corresponding to a first reading method included in the leaf node is generated.
7. The data query method according to claim 6, further comprising: Schedule the non-leaf nodes in the scheduling graph based on the second query result in a direction from the leaf node to the root node, so as to obtain a target query result corresponding to the target query statement; Returns the target query result.
8. The data query method according to claim 7, wherein: The receiving a target query statement includes: receiving a target query statement from a target application; The returning the target query result includes: The target query result is returned to the target application.
9. The data query method according to claim 6, wherein: The obtaining of a scheduling graph corresponding to the target query statement includes: Obtaining an execution plan of the target query statement, the execution plan comprising a plurality of nodes and connection edges between the nodes, each leaf node in the plurality of nodes comprising a different first reading method, and a plurality of branch nodes in the plurality of nodes, each of the plurality of branch nodes having a plurality of child nodes, and corresponding dependencies between the child nodes; Along the plurality of branch nodes, the execution plan is divided into a plurality of subgraphs, and the plurality of subgraphs are converted into a plurality of scheduling nodes; wherein a single subgraph includes at least one node; A relationship graph between the multiple scheduling nodes is constructed based on the dependency relationship, and the relationship graph is used as the scheduling graph.
10. The data query method according to claim 9, wherein: The execution plan is a physical execution plan, the multiple nodes are multiple physical nodes, and the multiple branch nodes are multiple physical branch nodes.
11. The data query method according to claim 10, wherein: The obtaining the execution plan of the target query statement includes: Obtaining a logic execution plan of the target query statement, the logic execution plan comprising a plurality of logic nodes and connection edges between the nodes, each leaf node in the plurality of logic nodes comprising a different first reading method, and a plurality of logic branch nodes each having a plurality of child nodes in the plurality of logic nodes; The logical execution plan is converted into the physical execution plan.
12. The data query method according to claim 6, further comprising: Obtaining metadata of the virtual data table; Performing syntax verification on the target query statement based on the metadata; The obtaining of a scheduling graph corresponding to the target query statement includes: In response to the target query statement passing the syntax check, a scheduling graph corresponding to the target query statement is obtained.
13. The data query method according to claim 12, further comprising: Performing syntax tree parsing on the target query statement to obtain a parsing result; The performing syntax checking on the target query statement based on the metadata includes: Based on the metadata and the parsing result, the target query statement is syntax-checked.
14. A data query device, comprising: A first receiving unit is configured to receive a target query statement, where the target query statement is used to query a virtual data table, where the virtual data table supports a plurality of first reading methods, where the plurality of first reading methods correspond to a second reading method respectively supported by a plurality of data sources; a query processing unit configured to generate a first query request corresponding to a first reading method based on the target query statement, and generate a second query request corresponding to a second reading method based on the first query request and a correspondence between the first reading method and the second reading method; A sending unit, configured to send the second query request to a target data source that supports a second reading method corresponding to the second query request; The second receiving unit is configured to receive a first query result from the target data source.
15. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the data query method according to any one of claims 1 to 13.
16. A computing device comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the data query method according to any one of claims 1 to 13 is implemented.
Citation Information
Patent Citations
Multi-data-source structure analysis method and system, terminal equipment and storage medium
CN112579610A
Multilayer analysis method of structured query statement, computer equipment and storage medium
CN114756569A
Data query method and device
CN116483859A
Fine-grained access control to datasets
US20200074107A1
Cited By
Scheduling instruction security verification method and system based on three-layer linkage mechanism
CN121257527A
