Method and system for generating optimal membership-check queries
AssigneeBusiness Objects Software Ltd.
InventorJoseph Wong
Life of this patent
Estimating the term…
Abstract
A method and system of transforming a query at a web server are provided. An abstract syntax tree representing the query can be traversed from the top down, for each node in the abstract syntax tree: labeling the node as being in a conjunct position when the node's parent is a WHERE node; labeling the node as being not in a conjunct position when the node's parent is an OR node; and labeling the node identically to the node's parent node when the node's parent is an AND node. Then any IN node in the abstract syntax tree can be transformed to an INNER JOIN node when the IN node is labeled as being in a conjunct position. The abstract syntax tree can be converted into a Structured Query Language (SQL) query, which can then be passed to a database for processing.
Claims20
A method of transforming a query at a web server, the method comprising:
- traversing an abstract syntax tree representing the query, for each node in the abstract syntax tree:
- labeling the node as being in a conjunct position when the node's parent is a WHERE node;
- labeling the node as being not in a conjunct position when the node's parent is an OR node;
- labeling the node identically to the node's parent node when the node's parent is an AND node;
- transforming any IN node in the abstract syntax tree to an INNER JOIN node when the IN node is labeled as being in a conjunct position;
- converting the abstract syntax tree into a Structured Query Language (SQL) query;
- and
- transmitting the SQL query to a database for processing.
The method of claim 2, further comprising:
- receiving the query from a web client;
- transforming the query into an ActiveRecord query domain specific language abstract syntax tree;
- and
- the converting including converting an ActiveRecord query domain specific language abstract syntax tree into the SQL query.
A method of transforming a query at a web server, the method comprising:
- creating an abstract syntax tree from the query;
- transforming any LEFT OUTER JOIN nodes in the abstract syntax tree that are in a conjunct position to INNER JOIN nodes, creating a modified abstract syntax tree;
- converting the modified abstract syntax tree to a SQL query;
- and
- issuing the SQL query to a relational database.
A web server comprising:
- a processor;
- memory;
- a optimization unit configured to:
- traverse an abstract syntax tree representing the query, for each node in the abstract syntax tree:
- labeling the node as being in a conjunct position when the node's parent is a WHERE node;
- labeling the node as being not in a conjunct position when the node's parent is an OR node;
- labeling the node identically to the node's parent node when the node's parent is an AND node;
- and
- transform an IN node in the abstract syntax tree to an INNER JOIN node if the IN node is labeled as being in a conjunct position;
- and
- transform an IN node in the abstract syntax tree to a LEFT OUTER JOIN node if the IN node is labeled as not being in a conjunct position;
- and
- an abstract syntax tree to SQL converter configured to convert the abstract syntax tree into a SQL query.
A system comprising:
- a relational database;
- a web client;
- and
- a web server configured to:
- receive a query from the web client;
- create an abstract syntax tree from the query;
- transform any LEFT OUTER JOIN nodes in the abstract syntax tree that are in a conjunct position to INNER JOIN nodes, creating a modified abstract syntax tree;
- convert the modified abstract syntax tree to a SQL query;
- and
- issue the SQL query to the relational database.
A non-transitory computer-readable storage medium comprising instructions that, when executed by at least one processor of a machine, cause the machine to perform operations of transforming a query at a web server, the method comprising:
- traversing an abstract syntax tree representing the query, for each node in the abstract syntax tree:
- labeling the node as being in a conjunct position when the node's parent is a WHERE node;
- labeling the node as being not in a conjunct position when the node's parent is an OR node;
- and
- labeling the node identically to the node's parent node when the node's parent is an AND node;
- transforming any IN node in the abstract syntax tree to an INNER JOIN node when the IN node is labeled as being in a conjunct position;
- converting the abstract syntax tree into a Structured Query Language (SQL) query;
- transmitting the SQL query to a database for processing.
A non-transitory computer-readable storage medium comprising instructions that, when executed by at least one processor of a machine, cause the machine to perform operations of transforming a query at a web server, the method comprising:
- creating an abstract syntax tree from the query;
- transforming any LEFT OUTER JOIN nodes in the abstract syntax tree that are in a conjunct position to INNER JOIN nodes, creating a modified abstract syntax tree;
- converting the modified abstract syntax tree to a SQL query;
- issuing the SQL query to a relational database.
Dependencies are inferred from the claim text.