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
<S extends Expression,T extends S>
java.util.List<S>
deepClone(java.util.List<T> collection, java.lang.Class<S> clazz)
           
static Command evaluateAndRewrite(Command command, ProcessorDataManager dataMgr, CommandContext context)
           
static boolean isNull(Expression expr)
           
static void makeSelectUnique(Select select, boolean expressionSymbolsOnly)
           
static Criteria optimizeCriteria(CompoundCriteria criteria)
          Performs simple expression flattening
static Command rewrite(Command command, CreateUpdateProcedureCommand procCommand, QueryMetadataInterface metadata, CommandContext context)
           
static Command rewrite(Command command, CreateUpdateProcedureCommand procCommand, QueryMetadataInterface metadata, CommandContext context, java.util.Map variableValues, int commandType)
           
static Criteria rewriteCriteria(Criteria criteria, CreateUpdateProcedureCommand procCommand, CommandContext context, QueryMetadataInterface metadata)
          Rewrite the criteria by evaluating some trivial cases.
static Expression rewriteExpression(Expression expression, CreateUpdateProcedureCommand procCommand, CommandContext context, QueryMetadataInterface metadata)
           
 
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

evaluateAndRewrite

public static Command evaluateAndRewrite(Command command,
                                         ProcessorDataManager dataMgr,
                                         CommandContext context)
                                  throws MetaMatrixProcessingException,
                                         MetaMatrixComponentException
Throws:
MetaMatrixProcessingException
MetaMatrixComponentException

rewrite

public static Command rewrite(Command command,
                              CreateUpdateProcedureCommand procCommand,
                              QueryMetadataInterface metadata,
                              CommandContext context,
                              java.util.Map variableValues,
                              int commandType)
                       throws QueryValidatorException
Throws:
QueryValidatorException

rewrite

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

rewriteCriteria

public static Criteria rewriteCriteria(Criteria criteria,
                                       CreateUpdateProcedureCommand 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,
                                           CreateUpdateProcedureCommand procCommand,
                                           CommandContext context,
                                           QueryMetadataInterface metadata)
                                    throws QueryValidatorException
Throws:
QueryValidatorException

deepClone

public static <S extends Expression,T extends S> java.util.List<S> deepClone(java.util.List<T> collection,
                                                                             java.lang.Class<S> clazz)

makeSelectUnique

public static void makeSelectUnique(Select select,
                                    boolean expressionSymbolsOnly)


Copyright © 2009. All Rights Reserved.