com.metamatrix.query.rewriter
Class QueryRewriter

java.lang.Object
  extended by com.metamatrix.query.rewriter.QueryRewriter

public class QueryRewriter
extends java.lang.Object

Rewrites commands and command fragments to a form that is better for planning and execution. There is a current limitation that command objects themselves cannot change type, since the same object is always used.


Field Summary
static CompareCriteria FALSE_CRITERIA
           
static CompareCriteria TRUE_CRITERIA
           
static CompareCriteria UNKNOWN_CRITERIA
           
 
Method Summary
static java.lang.String convertString(java.lang.String string)
           
static Query createInlineViewQuery(GroupSymbol group, QueryCommand nested, QueryMetadataInterface metadata, java.util.List actualSymbols)
           
static boolean isNull(Expression expr)
           
static void makeSelectUnique(Query query, boolean expressionSymbolsOnly)
           
static Criteria optimizeCriteria(CompoundCriteria criteria)
          Performs simple expression flattening
static Command rewrite(Command command, Command procCommand, QueryMetadataInterface metadata, CommandContext context)
           
static Criteria rewriteCriteria(Criteria criteria, Command procCommand, CommandContext context, QueryMetadataInterface metadata)
          Rewrite the criteria by evaluating some trivial cases.
static Expression rewriteExpression(Expression expression, Command procCommand, CommandContext context, QueryMetadataInterface metadata)
           
static void rewriteOrderBy(QueryCommand query, Command procCommand, QueryMetadataInterface metadata, CommandContext context)
          Rewrite the order by clause.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRUE_CRITERIA

public static final CompareCriteria TRUE_CRITERIA

FALSE_CRITERIA

public static final CompareCriteria FALSE_CRITERIA

UNKNOWN_CRITERIA

public static final CompareCriteria UNKNOWN_CRITERIA
Method Detail

rewrite

public static Command rewrite(Command command,
                              Command procCommand,
                              QueryMetadataInterface metadata,
                              CommandContext context)
                       throws QueryValidatorException
Throws:
QueryValidatorException

rewriteOrderBy

public static void rewriteOrderBy(QueryCommand query,
                                  Command procCommand,
                                  QueryMetadataInterface metadata,
                                  CommandContext context)
                           throws QueryValidatorException
Rewrite the order by clause.

Parameters:
query -
Throws:
QueryValidatorException

rewriteCriteria

public static Criteria rewriteCriteria(Criteria criteria,
                                       Command procCommand,
                                       CommandContext context,
                                       QueryMetadataInterface metadata)
                                throws QueryValidatorException
Rewrite the criteria by evaluating some trivial cases.

Parameters:
criteria - The criteria to rewrite
metadata -
userCriteria - The criteria on user's command, used in rewriting HasCriteria in the procedural language.
Returns:
The re-written criteria
Throws:
QueryValidatorException

optimizeCriteria

public static Criteria optimizeCriteria(CompoundCriteria criteria)
Performs simple expression flattening

Parameters:
criteria -
Returns:

isNull

public static boolean isNull(Expression expr)

rewriteExpression

public static Expression rewriteExpression(Expression expression,
                                           Command procCommand,
                                           CommandContext context,
                                           QueryMetadataInterface metadata)
                                    throws QueryValidatorException
Throws:
QueryValidatorException

convertString

public static java.lang.String convertString(java.lang.String string)

createInlineViewQuery

public static Query createInlineViewQuery(GroupSymbol group,
                                          QueryCommand nested,
                                          QueryMetadataInterface metadata,
                                          java.util.List actualSymbols)
                                   throws QueryMetadataException,
                                          QueryResolverException,
                                          MetaMatrixComponentException
Throws:
QueryMetadataException
QueryResolverException
MetaMatrixComponentException

makeSelectUnique

public static void makeSelectUnique(Query query,
                                    boolean expressionSymbolsOnly)


Copyright © 2009. All Rights Reserved.