private void validateAndVectorizeMapOperators(TableScanOperator tableScanOperator, boolean isTezOrSpark, VectorTaskColumnInfo vectorTaskColumnInfo) throws VectorizerCannotVectorizeException { Operator<? extends OperatorDesc> dummyVectorOperator = validateAndVectorizeOperatorTree(tableScanOperator, false, isTezOrSpark, vectorTaskColumnInfo); // Fixup parent and child relations. List<Operator<? extends OperatorDesc>> vectorChildren = dummyVectorOperator.getChildOperators(); tableScanOperator.setChildOperators(vectorChildren); final int vectorChildCount = vectorChildren.size(); for (int i = 0; i < vectorChildCount; i++) { Operator<? extends OperatorDesc> vectorChild = vectorChildren.get(i); // Replace any occurrence of dummyVectorOperator with our TableScanOperator. List<Operator<? extends OperatorDesc>> vectorChildParents = vectorChild.getParentOperators(); final int vectorChildParentCount = vectorChildParents.size(); for (int p = 0; p < vectorChildParentCount; p++) { Operator<? extends OperatorDesc> vectorChildParent = vectorChildParents.get(p); if (vectorChildParent == dummyVectorOperator) { vectorChildParents.set(p, tableScanOperator); } } } // And, finally, save the VectorizationContext. tableScanOperator.setTaskVectorizationContext( ((VectorizationOperator) dummyVectorOperator).getInputVectorizationContext()); // Modify TableScanOperator in-place so it knows to operate vectorized. vectorizeTableScanOperatorInPlace(tableScanOperator, vectorTaskColumnInfo); }
/** * 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); }
/** * 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); }
} else { rwsch = opParseCtx.get(top).getRowResolver(); top.setChildOperators(null);
top.setChildOperators(null);
tableScanOp.setChildOperators(Utilities.makeList(child)); child.replaceParent(parent, tableScanOp);
tableScanOp.setChildOperators(Utilities.makeList(child)); child.replaceParent(parent, tableScanOp);
/** * 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); }
tableScanOp.setChildOperators(Utilities.makeList(child)); child.replaceParent(parent, tableScanOp);