System and method of query transformation
A query transformation system for transforming nested aggregates in a query is provided. The query transformation system comprises a nested aggregate analysis module for analysing a query that is not supported by a target database system, and a nested aggregate transformation module for transforming the query into a semantically equivalent query that is supported by the target database system.
1 . A query transformation system for transforming nested aggregates in a query, the query transformation system comprising:
a nested aggregate analysis module for analysing a query that is not supported by a target database system; and
a nested aggregate transformation module for transforming the query into a semantically equivalent query that is supported by the target database system.
2 . The query transformation system as claimed in claim 1 , wherein the nested aggregate analysis module includes:
a nested aggregate detection unit for traversing a query and detecting a nested aggregate in the query; and
a nested aggregate tagging unit for traversing a query and tagging the nested aggregate.
3 . The query transformation system as claimed in claim 1 , wherein the nested aggregate transformation module includes:
a derived table for storing a copy of a tagged nested aggregate; and
a query editor for inserting the tagged nested aggregate into a query that is supported by a target database system.
4 . A method of nested aggregate transformation, the method comprising the steps of:
analysing a query that is not supported by a target database system; and
transforming the query into a semantically equivalent query that is supported by the target database system.
5 . The method as claimed in claim 4 , wherein the step of analysing includes the steps of:
detecting a nested aggregate in a select list of a query; and
adding a tag to the nested aggregate.
6 . The method as claimed in claim 4 , wherein the step of analysing includes the steps of:
creating a derived table;
adding a column reference to a select list in the derived table; and
adding the tagged nested aggregate to the select list of the derived table.
7 . A method of nested aggregate transformation, the method comprising the steps of:
generating a derived table to compute aggregates;
extracting nested aggregates and moving nested aggregates into a select list of the derived table; and
determining whether the transformation is to be performed, including the steps of:
detecting nested aggregates; and
detecting framed aggregates and report aggregates;
if nested aggregates are detected, performing the transformation, including the steps of:
marking a nested aggregate for insertion into an inner select list;
marking a report aggregate for insertion into the inner select list if it does not contain a nested aggregate or there are framed aggregates present; and
detecting framed aggregates; and
adding expressions to the inner select list of the derived table.
8 . A computer data signal embodied in a carrier wave and representing sequences of instructions which, when executed by a processor, cause the processor to perform a method of nested aggregate transformation, the method comprising the steps of:
analysing a query that is not supported by a target database system; and
transforming the query into a semantically equivalent query that is supported by the target database system.
9 . A computer-readable medium having computer readable code embodied therein for use in the execution in a computer of a method of nested aggregate transformation, the method comprising the steps of:
analysing a query that is not supported by a target database system; and
transforming the query into a semantically equivalent query that is supported by the target database system.
10 . A computer program product for use in the execution in a computer of a query transformation system for transforming nested aggregates in a query, the computer program product comprising:
a nested aggregate analysis module for analysing a query that is not supported by a target database system; and
a nested aggregate transformation module for transforming the query into a semantically equivalent query that is supported by the target database system.