org.teiid.query.rewriter
Class QueryRewriter
java.lang.Object
org.teiid.query.rewriter.QueryRewriter
public class QueryRewriter
- extends 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.
Method Summary |
static Command |
createDeleteProcedure(Delete delete,
QueryMetadataInterface metadata,
CommandContext context)
|
static Query |
createInlineViewQuery(GroupSymbol inlineGroup,
Command nested,
QueryMetadataInterface metadata,
List<? extends SingleElementSymbol> actualSymbols)
|
static Command |
createUpdateProcedure(Update update,
QueryMetadataInterface metadata,
CommandContext context)
|
static Command |
evaluateAndRewrite(Command command,
Evaluator eval,
CommandContext context,
QueryMetadataInterface metadata)
|
static boolean |
isDistinctWithGroupBy(Query query)
|
static boolean |
isNull(Expression expr)
|
static void |
makeSelectUnique(Select select,
boolean expressionSymbolsOnly)
|
static Criteria |
optimizeCriteria(CompoundCriteria criteria,
QueryMetadataInterface metadata)
Performs simple expression flattening |
static Command |
rewrite(Command command,
CreateUpdateProcedureCommand procCommand,
QueryMetadataInterface metadata,
CommandContext context,
Map<ElementSymbol,Expression> variableValues,
int commandType)
|
static Command |
rewrite(Command command,
QueryMetadataInterface metadata,
CommandContext context)
|
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)
|
QueryCommand |
rewriteOrderBy(QueryCommand queryCommand)
Rewrite the order by clause. |
static void |
rewriteOrderBy(QueryCommand queryCommand,
OrderBy orderBy,
List projectedSymbols,
LinkedList<OrderByItem> unrelatedItems)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TRUE_CRITERIA
public static final CompareCriteria TRUE_CRITERIA
FALSE_CRITERIA
public static final CompareCriteria FALSE_CRITERIA
UNKNOWN_CRITERIA
public static final CompareCriteria UNKNOWN_CRITERIA
evaluateAndRewrite
public static Command evaluateAndRewrite(Command command,
Evaluator eval,
CommandContext context,
QueryMetadataInterface metadata)
throws TeiidProcessingException,
TeiidComponentException
- Throws:
TeiidProcessingException
TeiidComponentException
rewrite
public static Command rewrite(Command command,
CreateUpdateProcedureCommand procCommand,
QueryMetadataInterface metadata,
CommandContext context,
Map<ElementSymbol,Expression> variableValues,
int commandType)
throws TeiidComponentException,
TeiidProcessingException
- Throws:
TeiidComponentException
TeiidProcessingException
rewrite
public static Command rewrite(Command command,
QueryMetadataInterface metadata,
CommandContext context)
throws TeiidComponentException,
TeiidProcessingException
- Throws:
TeiidComponentException
TeiidProcessingException
isDistinctWithGroupBy
public static boolean isDistinctWithGroupBy(Query query)
rewriteOrderBy
public QueryCommand rewriteOrderBy(QueryCommand queryCommand)
throws TeiidComponentException
- Rewrite the order by clause.
Unrelated order by expressions will cause the creation of nested inline views.
- Parameters:
query
-
- Throws:
TeiidComponentException,
- MetaMatrixProcessingException
TeiidComponentException
rewriteOrderBy
public static void rewriteOrderBy(QueryCommand queryCommand,
OrderBy orderBy,
List projectedSymbols,
LinkedList<OrderByItem> unrelatedItems)
rewriteCriteria
public static Criteria rewriteCriteria(Criteria criteria,
CreateUpdateProcedureCommand procCommand,
CommandContext context,
QueryMetadataInterface metadata)
throws TeiidComponentException,
TeiidProcessingException
- Rewrite the criteria by evaluating some trivial cases.
- Parameters:
criteria
- The criteria to rewritemetadata
- userCriteria
- The criteria on user's command, used in rewriting HasCriteria
in the procedural language.
- Returns:
- The re-written criteria
- Throws:
TeiidComponentException
TeiidProcessingException
optimizeCriteria
public static Criteria optimizeCriteria(CompoundCriteria criteria,
QueryMetadataInterface metadata)
- 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 TeiidComponentException,
TeiidProcessingException
- Throws:
TeiidComponentException
TeiidProcessingException
createInlineViewQuery
public static Query createInlineViewQuery(GroupSymbol inlineGroup,
Command nested,
QueryMetadataInterface metadata,
List<? extends SingleElementSymbol> actualSymbols)
throws QueryMetadataException,
QueryResolverException,
TeiidComponentException
- Throws:
QueryMetadataException
QueryResolverException
TeiidComponentException
makeSelectUnique
public static void makeSelectUnique(Select select,
boolean expressionSymbolsOnly)
createDeleteProcedure
public static Command createDeleteProcedure(Delete delete,
QueryMetadataInterface metadata,
CommandContext context)
throws QueryResolverException,
QueryMetadataException,
TeiidComponentException,
TeiidProcessingException
- Throws:
QueryResolverException
QueryMetadataException
TeiidComponentException
TeiidProcessingException
createUpdateProcedure
public static Command createUpdateProcedure(Update update,
QueryMetadataInterface metadata,
CommandContext context)
throws QueryResolverException,
QueryMetadataException,
TeiidComponentException,
TeiidProcessingException
- Throws:
QueryResolverException
QueryMetadataException
TeiidComponentException
TeiidProcessingException
Copyright © 2012. All Rights Reserved.