IP Library › Granted Patent US 11,416,485
Granted Patent B2
US 11,416,485 · App. 16/368,448 · Granted Aug 16, 2022

Dynamic query expressions

Inventors: Zhi Qiao (Shanghai, CN); Stefan Baeuerle (Rauenberg, DE); Ki Hong Kim (Seoul, KR); Florian Scheid (Wiesloch, DE); Timm Falter (Sinsheim, DE); Andreas Balzar (Heidelberg, DE); Di Wu (Shanghai, CN)
Assignee: SAP SE
G06F16/24542G06F9/54G06F16/2228
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,416,485
App. No.
16/368,448
Granted
Aug 16, 2022
Kind
B2
Abstract

Implementations of the present disclosure include receiving a query, the query including an expression macro (EM), processing the query to provide a raw parse tree, the raw parse tree including an initial node representative of the EM, retrieving metadata corresponding to the EM, the metadata including a definition string, replacing the initial node with a node based on the definition string to provide a consumable parse tree, and executing the query within the database system using the consumable parse tree to provide a query result.

Claims (37)

1. A computer-implemented method for querying a database system, the method comprising:

receiving, by a query parser of a database system, a query, the query comprising an expression macro (EM) that provides a function to be executed on values stored in the database system, the function defining a first order of operations to aggregate values before executing one or more calculations, the first order of operations being opposite to a second order of operations that would be executed absent the EM;

processing, by the query parser, the query to provide a raw parse tree, the raw parse tree comprising an initial node representative of the EM;

retrieving, by a preprocessor, metadata corresponding to the EM, the metadata comprising a definition string;

replacing, by the preprocessor, the initial node with a node based on the definition string to provide a consumable parse tree by executing a rewriting function to rewrite using the definition string of the metadata; and

executing the query within the database system using the consumable parse tree to provide a query result by executing the first order of operations to aggregate values then execute the one or more calculations within the database system.

2. The method of claim 1 , wherein processing the query to provide a raw parse tree comprises parsing the query by the query parser, the query parser comprising an EM syntax that enables the query parser to generate the initial node as a data structure to represent the EM provided within the query.

3. The method of claim 1 , wherein the metadata is retrieved from a metadata store through an application programming interface (API) based on a request comprising a view name and a view schema name.

4. The method of claim 1 , wherein a preprocessor receives the raw parse tree from the query parser and replaces the initial node with the node to provide the consumable parse tree.

5. The method of claim 1 , wherein the metadata is generated during a data definition language (DDL) phase and is stored in a persistence layer of the database system.

6. The method of claim 1 , wherein the EM comprises at least one nested EM, the nested EM being represented by another initial node within the raw parse tree, the another initial node being replaced be another node based on a definition of the nested EM provided from metadata.

7. The method of claim 1 , wherein executing the query comprises executing a query execution plan that is provided based on the consumable parse tree.

8. A non-transitory computer-readable storage medium coupled to one or more processors and having instructions stored thereon which, when executed by the one or more processors, cause the one or more processors to perform operations for querying a database system, the operations comprising:

receiving, by a query parser of a database system, a query, the query comprising an expression macro (EM) that provides a function to be executed on values stored in the database system, the function defining a first order of operations to aggregate values before executing one or more calculations, the first order of operations being opposite to a second order of operations that would be executed absent the EM;

processing, by the query parser, the query to provide a raw parse tree, the raw parse tree comprising an initial node representative of the EM;

retrieving, by a preprocessor, metadata corresponding to the EM, the metadata comprising a definition string;

replacing, by the preprocessor, the initial node with a node based on the definition string to provide a consumable parse tree by executing a rewriting function to rewrite using the definition string of the metadata; and

executing the query within the database system using the consumable parse tree to provide a query result by executing the first order of operations to aggregate values then execute the one or more calculations within the database system.

9. The computer-readable storage medium of claim 8 , wherein processing the query to provide a raw parse tree comprises parsing the query by the query parser, the query parser comprising an EM syntax that enables the query parser to generate the initial node as a data structure to represent the EM provided within the query.

10. The computer-readable storage medium of claim 8 , wherein the metadata is retrieved from a metadata store through an application programming interface (API) based on a request comprising a view name and a view schema name.

11. The computer-readable storage medium of claim 8 , wherein a preprocessor receives the raw parse tree from the query parser and replaces the initial node with the node to provide the consumable parse tree.

12. The computer-readable storage medium of claim 8 , wherein the metadata is generated during a data definition language (DDL) phase and is stored in a persistence layer of the database system.

13. The computer-readable storage medium of claim 8 , wherein the EM comprises at least one nested EM, the nested EM being represented by another initial node within the raw parse tree, the another initial node being replaced be another node based on a definition of the nested EM provided from metadata.

14. The computer-readable storage medium of claim 8 , wherein executing the query comprises executing a query execution plan that is provided based on the consumable parse tree.

15. A system, comprising:

one or more computers; and

a computer-readable storage device coupled to the computing device and having instructions stored thereon which, when executed by the computing device, cause the computing device to perform operations for querying a database system, the operations comprising:

receiving, by a query parser of a database system, a query, the query comprising an expression macro (EM) that provides a function to be executed on values stored in the database system, the function defining a first order of operations to aggregate values before executing one or more calculations, the first order of operations being opposite to a second order of operations that would be executed absent the EM;

processing, by the query parser, the query to provide a raw parse tree, the raw parse tree comprising an initial node representative of the EM;

retrieving, by a preprocessor, metadata corresponding to the EM, the metadata comprising a definition string;

replacing, by the preprocessor, the initial node with a node based on the definition string to provide a consumable parse tree by executing a rewriting function to rewrite using the definition string of the metadata; and

executing the query within the database system using the consumable parse tree to provide a query result by executing the first order of operations to aggregate values then execute the one or more calculations within the database system.

16. The system of claim 15 , wherein processing the query to provide a raw parse tree comprises parsing the query by the query parser, the query parser comprising an EM syntax that enables the query parser to generate the initial node as a data structure to represent the EM provided within the query.

17. The system of claim 15 , wherein the metadata is retrieved from a metadata store through an application programming interface (API) based on a request comprising a view name and a view schema name.

18. The system of claim 15 , wherein a preprocessor receives the raw parse tree from the query parser and replaces the initial node with the node to provide the consumable parse tree.

19. The system of claim 15 , wherein the metadata is generated during a data definition language (DDL) phase and is stored in a persistence layer of the database system.

20. The system of claim 15 , wherein the EM comprises at least one nested EM, the nested EM being represented by another initial node within the raw parse tree, the another initial node being replaced be another node based on a definition of the nested EM provided from metadata.

Assignments (2)
CORRECTIVE ASSIGNMENT TO CORRECT THE INVENTOR'S NAME PREVIOUSLY RECORDED AT REEL: 048732 FRAME: 0268. ASSIGNOR(S) HEREBY CONFIRMS THE ASSIGNMENT. Recorded May 15, 2019
From: QIAO, ZHI; BAEUERLE, STEFAN; KIM, KI HONG; SCHEID, FLORIAN; FALTER, TIMM; BALZAR, ANDREAS; WU, DI
To: SAP SE
Reel/Frame 050174/0750 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Mar 28, 2019
From: QIAO, ZHI; BAEUERLE, STEFAN; KIM, KI HONG; SCHEID, FLORIAN; FALTER, TIMM; B ALZAR, ANDREAS; WU, DI
To: SAP SE
Reel/Frame 048732/0268 →
Continuity (1)
Related Publication 20200311078A1 · Oct 1, 2020