@Test public final void testSimplify() throws PlanningException { Target [] targets = getRawTargets(QUERIES[0]); EvalNode node = AlgebraicUtil.eliminateConstantExprs(targets[0].getEvalTree()); assertEquals(EvalType.CONST, node.getType()); assertEquals(7, node.eval(null, null).asInt4()); node = AlgebraicUtil.eliminateConstantExprs(targets[1].getEvalTree()); assertEquals(EvalType.CONST, node.getType()); assertTrue(7.0d == node.eval(null, null).asFloat8()); Expr expr = analyzer.parse(QUERIES[1]); LogicalPlan plan = planner.createPlan(expr, true); targets = plan.getRootBlock().getRawTargets(); Column col1 = new Column("people.score", TajoDataTypes.Type.INT4); Collection<EvalNode> exprs = EvalTreeUtil.getContainExpr(targets[0].getEvalTree(), col1); node = exprs.iterator().next(); }
public static Collection<EvalNode> getContainExpr(EvalNode expr, Column target) { Set<EvalNode> exprSet = Sets.newHashSet(); getContainExpr(expr, target, exprSet); return exprSet; }
EvalTreeUtil { public static Collection<EvalNode> getContainExpr(EvalNode expr, Column target) { Set<EvalNode> exprSet = Sets.newHashSet(); getContainExpr(expr, target, exprSet); return exprSet; } }
EvalTreeUtil { public static Collection<EvalNode> getContainExpr(EvalNode expr, Column target) { Set<EvalNode> exprSet = Sets.newHashSet(); getContainExpr(expr, target, exprSet); return exprSet; }  }
EvalTreeUtil { public static Collection<EvalNode> getContainExpr(EvalNode expr, Column target) { Set<EvalNode> exprSet = Sets.newHashSet(); getContainExpr(expr, target, exprSet); return exprSet; }  static void changeColumnRef(EvalNode node, String oldName, String newName); static void replace(EvalNode expr, EvalNode targetExpr, EvalNode tobeReplaced); static LinkedHashSet<Column> findUniqueColumns(EvalNode node); static List<Column> findAllColumnRefs(EvalNode node); static Schema getSchemaByTargets(Schema inputSchema, Target [] targets); static DataType getDomainByExpr(Schema inputSchema, EvalNode expr); static Collection<EvalNode> getContainExpr(EvalNode expr, Column target); static Map<EvalType, Integer> getExprCounters(EvalNode expr); static boolean containColumnRef(EvalNode expr, Column target); static boolean isJoinQual(EvalNode expr); static Set<AggregationFunctionCallEval> findDistinctAggFunction(EvalNode expr); static Collection<T> findEvalsByType(EvalNode evalNode, EvalType type); }
EvalTreeUtil { public static Collection<EvalNode> getContainExpr(EvalNode expr, Column target) { Set<EvalNode> exprSet = Sets.newHashSet(); getContainExpr(expr, target, exprSet); return exprSet; }  static void changeColumnRef(EvalNode node, String oldName, String newName); static void replace(EvalNode expr, EvalNode targetExpr, EvalNode tobeReplaced); static LinkedHashSet<Column> findUniqueColumns(EvalNode node); static List<Column> findAllColumnRefs(EvalNode node); static Schema getSchemaByTargets(Schema inputSchema, Target [] targets); static DataType getDomainByExpr(Schema inputSchema, EvalNode expr); static Collection<EvalNode> getContainExpr(EvalNode expr, Column target); static Map<EvalType, Integer> getExprCounters(EvalNode expr); static boolean containColumnRef(EvalNode expr, Column target); static boolean isJoinQual(EvalNode expr); static Set<AggregationFunctionCallEval> findDistinctAggFunction(EvalNode expr); static Collection<T> findEvalsByType(EvalNode evalNode, EvalType type);  }