Decorrelation of user-defined function invocations in queries
First Claim
Patent Images
1. A computer-implemented method for transforming user-defined-function invocations within a query-based environment, the method comprising:
- receiving a query with a user-defined-function (UDF) containing code written using imperative language constructs;
transforming the imperatively defined UDF into an algebraic first expression tree, wherein generating part of the algebraic first expression tree comprises;
determining a type of statement from a plurality of statements,choosing an apply-merge operator when the statement is an assignment statement,choosing a conditional-apply-merge operator when the statement is an if-then-else conditional statement,choosing a cross-apply operator when the statement is a return statement, andapplying the operator to the statement to generate part of the algebraic first expression tree;
constructing a second expression tree representation of the query absent the UDF;
generating a transformed expression representation of the query by merging the algebraic first expression tree and the second expression tree based on parameters of the algebraic first expression tree, and attributes of the second expression tree; and
simplifying the transformed expression using transformation rules, based on a determination that the transformed expression can be simplified.
2 Assignments
0 Petitions
Accused Products
Abstract
Systems, methods, and computer-readable medium, are disclosed for transforming user-defined-function invocations in a query-based environment. A user-defined-function (UDF) and a query invoking the UDF are received. The UDF is parsed into a plurality of statements. A first expression tree corresponding to the UDF and a second expression tree corresponding the query are constructed, and merged using an operator to generate a transformed expression. The transformed expression is simplified, using transformation rules, if it is determined that is can be simplified.
16 Citations
11 Claims
-
1. A computer-implemented method for transforming user-defined-function invocations within a query-based environment, the method comprising:
-
receiving a query with a user-defined-function (UDF) containing code written using imperative language constructs; transforming the imperatively defined UDF into an algebraic first expression tree, wherein generating part of the algebraic first expression tree comprises; determining a type of statement from a plurality of statements, choosing an apply-merge operator when the statement is an assignment statement, choosing a conditional-apply-merge operator when the statement is an if-then-else conditional statement, choosing a cross-apply operator when the statement is a return statement, and applying the operator to the statement to generate part of the algebraic first expression tree; constructing a second expression tree representation of the query absent the UDF; generating a transformed expression representation of the query by merging the algebraic first expression tree and the second expression tree based on parameters of the algebraic first expression tree, and attributes of the second expression tree; and simplifying the transformed expression using transformation rules, based on a determination that the transformed expression can be simplified. - View Dependent Claims (2, 3, 4)
-
-
5. A system for transforming user-defined-function invocations within a query-based environment, the system comprising:
-
a parser module configured to; receive a query with a user-defined-function (UDF) containing code written using imperative language constructs; parse the UDF and the query into a plurality of statements; a processor-implemented tree-construction module configured to; transform the imperatively defined UDF into an algebraic first expression tree wherein part of the algebraic first expression tree is generated by; determining a type of statement from the plurality of statements, choosing an apply-merge operator when the statement is an assignment statement, choosing a conditional-apply-merge operator when the statement is an if-then-else conditional statement, choosing a cross-apply operator when the statement is a return statement, and applying the operator to the statement to generate part of the algebraic first expression tree; construct a second expression tree representation of the query absent the UDF; a transformer module configured to; generate a transformed expression representation of the query by merging the algebraic first expression tree and the second expression tree based on parameters of the algebraic first expression tree, and attributes of the second expression tree; and simplify the transformed expression using transformation rules, based on a determination that the transformed expression can be simplified. - View Dependent Claims (6, 7, 8)
-
-
9. A non-transitory computer-readable storage device configured to store instructions executable by a processing device, wherein execution of the instructions in a query-based environment causes the processing device to implement a method of transforming a user-defined-function invocation within the query-based environment comprising:
-
receiving a query with a user-defined-function (UDF) containing code written using imperative language constructs; transforming the imperatively defined UDF into an algebraic first expression tree representation, wherein generating part of the algebraic first expression tree comprises; determining a type of a statement of a plurality of statements, choosing an apply-merge operator when the statement is an assignment statement, choosing a conditional-apply-merge operator when the statement is an if-then-else conditional statement, choosing a cross-apply operator when the statement is a return statement, and applying the operator to the statement to generate part of the algebraic first expression tree; constructing a second expression tree representation of the query absent the UDF; generating a transformed expression representation of the query by merging the algebraic first expression tree and the second expression tree based on parameters of the algebraic first expression tree, and attributes of the second expression tree; and simplifying the transformed expression using transformation rules, based on a determination that the transformed expression can be simplified. - View Dependent Claims (10, 11)
-
Specification