@Test public final void testGetSchemaFromTargets() throws InternalException { Target [] targets = getRawTargets(QUERIES[0]); Schema schema = EvalTreeUtil.getSchemaByTargets(null, targets); Column col1 = schema.getColumn(0); Column col2 = schema.getColumn(1); assertEquals("plus", col1.getSimpleName()); assertEquals(TajoDataTypes.Type.INT4, col1.getDataType().getType()); assertEquals("mul", col2.getSimpleName()); assertEquals(TajoDataTypes.Type.FLOAT8, col2.getDataType().getType()); }
public static Schema getSchemaByTargets(Schema inputSchema, Target [] targets) throws InternalException { Schema schema = new Schema(); for (Target target : targets) { schema.addColumn( target.hasAlias() ? target.getAlias() : target.getEvalTree().getName(), getDomainByExpr(inputSchema, target.getEvalTree())); } return schema; }
EvalTreeUtil { public static Schema getSchemaByTargets(Schema inputSchema, Target [] targets) throws InternalException { Schema schema = new Schema(); for (Target target : targets) { schema.addColumn( target.hasAlias() ? target.getAlias() : target.getEvalTree().getName(), getDomainByExpr(inputSchema, target.getEvalTree())); } return schema; } }
EvalTreeUtil { public static Schema getSchemaByTargets(Schema inputSchema, Target [] targets) throws InternalException { Schema schema = new Schema(); for (Target target : targets) { schema.addColumn( target.hasAlias() ? target.getAlias() : target.getEvalTree().getName(), getDomainByExpr(inputSchema, target.getEvalTree())); } return schema; }  }
EvalTreeUtil { public static Schema getSchemaByTargets(Schema inputSchema, Target [] targets) throws InternalException { Schema schema = new Schema(); for (Target target : targets) { schema.addColumn( target.hasAlias() ? target.getAlias() : target.getEvalTree().getName(), getDomainByExpr(inputSchema, target.getEvalTree())); } return schema; }  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 Schema getSchemaByTargets(Schema inputSchema, Target [] targets) throws InternalException { Schema schema = new Schema(); for (Target target : targets) { schema.addColumn( target.hasAlias() ? target.getAlias() : target.getEvalTree().getName(), getDomainByExpr(inputSchema, target.getEvalTree())); } return schema; }  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);  }