/** * Returns an operator given the conf and a list of children operators. */ public static <T extends OperatorDesc> Operator<T> get(CompilationOpContext cContext, T conf) { Operator<T> ret = get(cContext, (Class<T>) conf.getClass()); ret.setConf(conf); return (ret); }
/** * Returns an operator given the conf and a list of parent operators. */ public static <T extends OperatorDesc> Operator<T> getAndMakeChild(CompilationOpContext cContext, T conf, RowSchema rwsch, List<Operator<? extends OperatorDesc>> oplist) { Operator<T> ret = getAndMakeChild(cContext, conf, oplist); ret.setSchema(rwsch); return (ret); }
public static <T extends OperatorDesc> Operator<T> getVectorOperator( CompilationOpContext cContext, T conf, VectorizationContext vContext, VectorDesc vectorDesc) throws HiveException { Class<T> descClass = (Class<T>) conf.getClass(); Class<?> opClass = vectorOpvec.get(descClass); if (opClass != null) { return getVectorOperator(vectorOpvec.get(descClass), cContext, conf, vContext, vectorDesc); } throw new HiveException("No vector operator for descriptor class " + descClass.getName()); }
/** * Returns an operator given the conf and a list of children operators. */ public static <T extends OperatorDesc> Operator<T> get(T conf, Operator<? extends OperatorDesc> oplist0, Operator<? extends OperatorDesc>... oplist) { Operator<T> ret = get(oplist0.getCompilationOpContext(), (Class<T>) conf.getClass()); ret.setConf(conf); makeChild(ret, oplist0); makeChild(ret, oplist); return (ret); }
/** * Inserts a filter below the table scan operator. Construct the filter * from the filter expression provided. * @param tableScanOp the table scan operators * @param filterExpr the filter expression */ private void insertFilterOnTop( TableScanOperator tableScanOp, ExprNodeDesc filterExpr) { // Get the top operator and it's child, all operators have a single parent Operator<? extends OperatorDesc> currChild = tableScanOp.getChildOperators().get(0); // Create the filter Operator and update the parents and children appropriately tableScanOp.setChildOperators(null); currChild.setParentOperators(null); Operator<FilterDesc> filter = OperatorFactory.getAndMakeChild( new FilterDesc(filterExpr, false), new RowSchema(tableScanOp.getSchema().getSignature()), tableScanOp); OperatorFactory.makeChild(filter, currChild); }
/** * This method drives the test. It takes the data from getBaseTable() and * feeds it through a SELECT operator with a COLLECT operator after. Each * row that is produced by the collect operator is compared to getExpectedResult() * and if every row is the expected result the method completes without asserting. * @throws HiveException */ public final void testUdf() throws HiveException { InspectableObject [] data = getBaseTable(); List<ExprNodeDesc> expressionList = getExpressionList(); SelectDesc selectCtx = new SelectDesc(expressionList, OperatorTestUtils.createOutputColumnNames(expressionList)); Operator<SelectDesc> op = OperatorFactory.get(new CompilationOpContext(), SelectDesc.class); op.setConf(selectCtx); CollectDesc cd = new CollectDesc(Integer.valueOf(10)); CollectOperator cdop = (CollectOperator) OperatorFactory.getAndMakeChild(cd, op); op.initialize(new JobConf(OperatorTestUtils.class), new ObjectInspector[] {data[0].oi}); OperatorTestUtils.assertResults(op, cdop, data, getExpectedResult()); }
@SuppressWarnings("unchecked") protected void processGroupBy(GroupByOperator mGby, ReduceSinkOperator rs, GroupByOperator rGby, int indexOfDist) throws SemanticException, CloneNotSupportedException { // remove count(distinct) in map-side gby List<Operator<? extends OperatorDesc>> parents = mGby.getParentOperators(); List<Operator<? extends OperatorDesc>> children = rGby.getChildOperators(); mGby.removeParents(); rs.removeParents(); rGby.removeParents(); GroupByOperator mGby1 = genMapGroupby1(mGby, indexOfDist); ReduceSinkOperator rs1 = genReducesink1(mGby1, rs, indexOfDist); GroupByOperator mGby2 = genMapGroupby2(rs1, mGby, indexOfDist); GroupByOperator mGby3 = genMapGroupby3(mGby2, mGby, indexOfDist); ReduceSinkOperator rs2 = genReducesink2(mGby3, rs); GroupByOperator rGby1 = genReduceGroupby(rs2, rGby, indexOfDist); for (Operator<? extends OperatorDesc> parent : parents) { OperatorFactory.makeChild(parent, mGby1); } OperatorFactory.makeChild(mGby1, rs1); OperatorFactory.makeChild(rs1, mGby2); OperatorFactory.makeChild(mGby2, mGby3); OperatorFactory.makeChild(mGby3, rs2); OperatorFactory.makeChild(rs2, rGby1); for (Operator<? extends OperatorDesc> child : children) { child.removeParents(); OperatorFactory.makeChild(rGby1, child); } }
/** * Inserts a filter below the table scan operator. Construct the filter * from the filter expression provided. * @param tableScanOp the table scan operators * @param filterExpr the filter expression */ private void insertFilterOnTop( TableScanOperator tableScanOp, ExprNodeDesc filterExpr) { // Get the top operator and it's child, all operators have a single parent Operator<? extends OperatorDesc> currChild = tableScanOp.getChildOperators().get(0); // Create the filter Operator and update the parents and children appropriately tableScanOp.setChildOperators(null); currChild.setParentOperators(null); Operator<FilterDesc> filter = OperatorFactory.getAndMakeChild( new FilterDesc(filterExpr, false), new RowSchema(tableScanOp.getSchema().getSignature()), tableScanOp); OperatorFactory.makeChild(filter, currChild); }
/** * Returns an operator given the conf and a list of children operators. */ public static <T extends OperatorDesc> Operator<T> get(T conf, Operator<? extends OperatorDesc> oplist0, Operator<? extends OperatorDesc>... oplist) { Operator<T> ret = get(oplist0.getCompilationOpContext(), (Class<T>) conf.getClass()); ret.setConf(conf); makeChild(ret, oplist0); makeChild(ret, oplist); return (ret); }
/** * Returns an operator given the conf and a list of children operators. */ public static <T extends OperatorDesc> Operator<T> get( CompilationOpContext cContext, T conf, RowSchema rwsch) { Operator<T> ret = get(cContext, conf); ret.setSchema(rwsch); return (ret); }
/** * Returns an operator given the conf and a list of parent operators. */ public static <T extends OperatorDesc> Operator<T> getAndMakeChild(T conf, RowSchema rwsch, Map<String, ExprNodeDesc> colExprMap, Operator oplist0, Operator... oplist) { Operator<T> ret = getAndMakeChild(conf, rwsch, oplist0, oplist); ret.setColumnExprMap(colExprMap); return (ret); }
SelectOperator sel = (SelectOperator) OperatorFactory.getAndMakeChild( select, new RowSchema(outputRS), op); OperatorFactory.makeChild(sel, child);
public static <T extends OperatorDesc> Operator<T> getVectorOperator( CompilationOpContext cContext, T conf, VectorizationContext vContext, Operator<? extends OperatorDesc> originalOp) throws HiveException { Class<T> descClass = (Class<T>) conf.getClass(); Class<? extends Operator<? extends OperatorDesc>> opClass = vectorOpvec.get(descClass); if (opClass != null) { return getVectorOperator(opClass, cContext, conf, vContext, originalOp); } throw new HiveException("No vector operator for descriptor class " + descClass.getName()); }
public void initializeForFetch(CompilationOpContext ctx) { if (source == null) { ListSinkDesc desc = new ListSinkDesc(serializationNullFormat); sink = (ListSinkOperator) OperatorFactory.get(ctx, desc); source = sink; } }
/** * Returns an operator given the conf and a list of parent operators. */ public static <T extends OperatorDesc> Operator<T> getAndMakeChild( T conf, RowSchema rwsch, Operator oplist0, Operator... oplist) { Operator<T> ret = getAndMakeChild(conf, oplist0, oplist); ret.setSchema(rwsch); return ret; }
SelectOperator sel = (SelectOperator) OperatorFactory.getAndMakeChild( select, new RowSchema(outputRS), curOp); OperatorFactory.makeChild(sel, child); sel.setColumnExprMap(colExprMap);
private Operator<? extends OperatorDesc> specializeArrowFileSinkOperator( Operator<? extends OperatorDesc> op, VectorizationContext vContext, FileSinkDesc desc, VectorFileSinkDesc vectorDesc) throws HiveException { Class<? extends Operator<?>> opClass = VectorFileSinkArrowOperator.class; Operator<? extends OperatorDesc> vectorOp = null; try { vectorOp = OperatorFactory.getVectorOperator( opClass, op.getCompilationOpContext(), op.getConf(), vContext, vectorDesc); } catch (Exception e) { LOG.info("Vectorizer vectorizeOperator file sink class exception " + opClass.getSimpleName() + " exception " + e); throw new HiveException(e); } return vectorOp; }
/** * Returns an operator given the conf and a list of children operators. */ public static <T extends OperatorDesc> Operator<T> get( CompilationOpContext cContext, T conf, RowSchema rwsch) { Operator<T> ret = get(cContext, conf); ret.setSchema(rwsch); return (ret); }
/** * Returns an operator given the conf and a list of parent operators. */ public static <T extends OperatorDesc> Operator<T> getAndMakeChild(CompilationOpContext cContext, T conf, RowSchema rwsch, Map<String, ExprNodeDesc> colExprMap, List<Operator<? extends OperatorDesc>> oplist) { Operator<T> ret = getAndMakeChild(cContext, conf, rwsch, oplist); ret.setColumnExprMap(colExprMap); return (ret); }
SelectOperator sel = (SelectOperator) OperatorFactory.getAndMakeChild( select, new RowSchema(outputRS), op); OperatorFactory.makeChild(sel, child);