×

Query transformation

  • US 8,108,415 B2
  • Filed: 09/09/2008
  • Issued: 01/31/2012
  • Est. Priority Date: 05/27/2003
  • Status: Active Grant
First Claim
Patent Images

1. A method of transforming an unsupported database query into a supported database query that can be fully computed by a target database, the unsupported database query comprising a select list including a plurality of expressions, the plurality of expressions each having a control break, the plurality of expressions including an expression that cannot be directly computed by the target database, the method comprising:

  • constructing a derived table from the unsupported database query, wherein constructing the derived table comprises;

    constructing a new select list of the derived table;

    traversing the plurality of expressions of the select list of the unsupported database query and for each of the expressions;

    determining a corresponding expression to add to the new select list, wherein determining the corresponding expression to add to the new select list comprises determining an aggregate of the expression and determining a control break of the aggregate;

    adding the corresponding expression to the new select list;

    adding the control break of the expression to an ordered list of control breaks, wherein the ordered list is ordered from a shortest control break with a fewest number of columns to a longest control break with a highest number of columns; and

    when the control break of the aggregate has fewer columns than the longest control break of the order list of control breaks, and the aggregate of the expression is of the form AGG(C0);

    replacing the expression AGG(C0) OVER (PARTITION BY C1, C2, . . . , Ck) with an expression of the form AGG(AGG(C0)) OVER(PARTITION C1, C2, . . . , Ck), where each C is a column, where n is a number of columns in the longest control break, and where k is a number of columns in the other control break; and

    adding a GROUP BY expression to the derived table based on the new select list of the derived table;

    determining the unsupported database query can be transformed into a supported database query, wherein determining the unsupported database query can be transformed into the supported database query comprises determining all control breaks of the unsupported database query are compatible based on the ordered list; and

    constructing the supported database query using the unsupported database query and the derived table.

View all claims
  • 2 Assignments
Timeline View
Assignment View
    ×
    ×