@Test public void testRewriteFunctionThrowsEvaluationError() { QueryMetadataInterface metadata = RealMetadataFactory.example1Cached(); Criteria origCrit = parseCriteria("5 / 0 = 5", metadata); try { QueryRewriter.rewriteCriteria(origCrit, null, metadata); fail("Expected QueryValidatorException due to divide by 0"); } catch(TeiidException e) { assertEquals("TEIID30328 Unable to evaluate (5 / 0): TEIID30384 Error while evaluating function /", e.getMessage()); } }
public static Criteria rewriteCriteria(Criteria criteria, CommandContext context, QueryMetadataInterface metadata) throws TeiidComponentException, TeiidProcessingException{ return new QueryRewriter(metadata, context).rewriteCriteria(criteria); }
QueryRewriter { public static Criteria rewriteCriteria(Criteria criteria, CommandContext context, QueryMetadataInterface metadata) throws TeiidComponentException, TeiidProcessingException{ return new QueryRewriter(metadata, context).rewriteCriteria(criteria); } }
QueryRewriter { public static Criteria rewriteCriteria(Criteria criteria, CommandContext context, QueryMetadataInterface metadata) throws TeiidComponentException, TeiidProcessingException{ return new QueryRewriter(metadata, context).rewriteCriteria(criteria); } private  QueryRewriter(QueryMetadataInterface metadata,
            CommandContext context); }
QueryRewriter { public static Criteria rewriteCriteria(Criteria criteria, CommandContext context, QueryMetadataInterface metadata) throws TeiidComponentException, TeiidProcessingException{ return new QueryRewriter(metadata, context).rewriteCriteria(criteria); } private  QueryRewriter(QueryMetadataInterface metadata,
            CommandContext context); static Command evaluateAndRewrite(Command command, Evaluator eval, CommandContext context, QueryMetadataInterface metadata); static Criteria evaluateAndRewrite(Criteria criteria, Evaluator eval, CommandContext context, QueryMetadataInterface metadata); static Command rewrite(Command command, QueryMetadataInterface metadata, CommandContext context, Map<ElementSymbol, Expression> variableValues); static Command rewrite(Command command, QueryMetadataInterface metadata, CommandContext context); static boolean isDistinctWithGroupBy(Query query); QueryCommand rewriteOrderBy(QueryCommand queryCommand); static void rewriteOrderBy(QueryCommand queryCommand,
            final OrderBy orderBy, final List projectedSymbols, CommandContext context, QueryMetadataInterface metadata); static Criteria rewriteCriteria(Criteria criteria, CommandContext context, QueryMetadataInterface metadata); static Criteria optimizeCriteria(CompoundCriteria criteria, QueryMetadataInterface metadata); static boolean isNull(Expression expr); static Expression rewriteExpression(Expression expression, CommandContext context, QueryMetadataInterface metadata); static Expression rewriteExpression(Expression expression, CommandContext context, QueryMetadataInterface metadata, boolean rewriteSubcommands); static Command rewriteAsUpsertProcedure(Insert insert, QueryMetadataInterface metadata, CommandContext context); static Query createInlineViewQuery(GroupSymbol inlineGroup,
                                               Command nested,
                                               QueryMetadataInterface metadata,
                                               List<? extends Expression> actualSymbols); static void makeSelectUnique(Select select, boolean expressionSymbolsOnly); static Command createDeleteProcedure(Delete delete, QueryMetadataInterface metadata, CommandContext context); static Command createUpdateProcedure(Update update, QueryMetadataInterface metadata, CommandContext context); }
QueryRewriter { public static Criteria rewriteCriteria(Criteria criteria, CommandContext context, QueryMetadataInterface metadata) throws TeiidComponentException, TeiidProcessingException{ return new QueryRewriter(metadata, context).rewriteCriteria(criteria); } private  QueryRewriter(QueryMetadataInterface metadata,
            CommandContext context); static Command evaluateAndRewrite(Command command, Evaluator eval, CommandContext context, QueryMetadataInterface metadata); static Criteria evaluateAndRewrite(Criteria criteria, Evaluator eval, CommandContext context, QueryMetadataInterface metadata); static Command rewrite(Command command, QueryMetadataInterface metadata, CommandContext context, Map<ElementSymbol, Expression> variableValues); static Command rewrite(Command command, QueryMetadataInterface metadata, CommandContext context); static boolean isDistinctWithGroupBy(Query query); QueryCommand rewriteOrderBy(QueryCommand queryCommand); static void rewriteOrderBy(QueryCommand queryCommand,
            final OrderBy orderBy, final List projectedSymbols, CommandContext context, QueryMetadataInterface metadata); static Criteria rewriteCriteria(Criteria criteria, CommandContext context, QueryMetadataInterface metadata); static Criteria optimizeCriteria(CompoundCriteria criteria, QueryMetadataInterface metadata); static boolean isNull(Expression expr); static Expression rewriteExpression(Expression expression, CommandContext context, QueryMetadataInterface metadata); static Expression rewriteExpression(Expression expression, CommandContext context, QueryMetadataInterface metadata, boolean rewriteSubcommands); static Command rewriteAsUpsertProcedure(Insert insert, QueryMetadataInterface metadata, CommandContext context); static Query createInlineViewQuery(GroupSymbol inlineGroup,
                                               Command nested,
                                               QueryMetadataInterface metadata,
                                               List<? extends Expression> actualSymbols); static void makeSelectUnique(Select select, boolean expressionSymbolsOnly); static Command createDeleteProcedure(Delete delete, QueryMetadataInterface metadata, CommandContext context); static Command createUpdateProcedure(Update update, QueryMetadataInterface metadata, CommandContext context); static final CompareCriteria TRUE_CRITERIA; static final CompareCriteria FALSE_CRITERIA; static final CompareCriteria UNKNOWN_CRITERIA; }