US 12,235,839 B2
Processing correlated calculated fields in correlated subqueries
Yinghua Ouyang, Xi'an (CN); and Zhen Tian, Xi'an (CN)
Assigned to SAP SE, Walldorf (DE)
Filed by SAP SE, Walldorf (DE)
Filed on Nov. 9, 2022, as Appl. No. 17/983,589.
Prior Publication US 2024/0152513 A1, May 9, 2024
Int. Cl. G06F 16/24 (2019.01); G06F 16/242 (2019.01); G06F 16/2453 (2019.01)
CPC G06F 16/24535 (2019.01) [G06F 16/244 (2019.01)] 20 Claims
OG exemplary drawing
 
1. A computer-implemented method comprising:
receiving a request to process a database query that includes at least one subquery; and
processing each subquery included in the database query, including:
determining whether the subquery includes any correlated calculated fields, wherein a correlated calculated field is a calculated field that is not included in a first datasource queried by the subquery but is included in a second datasource queried by an outer query that includes the subquery;
in response to determining that the subquery does not include any correlated calculated fields, processing the subquery without modification; and
in response to determining that the subquery includes a first correlated calculated field:
identifying the outer query of the subquery that queries the second datasource that includes the first correlated calculated field;
retrieving metadata associated with the outer query and the first correlated calculated field;
rewriting the subquery using the metadata to generate a rewritten subquery that no longer includes the first correlated calculated field; and
processing the rewritten subquery.