Search in sources :

Example 1 with VectorPTFEvaluatorBase

use of org.apache.hadoop.hive.ql.exec.vector.ptf.VectorPTFEvaluatorBase in project hive by apache.

the class VectorPTFDesc method getEvaluators.

public static VectorPTFEvaluatorBase[] getEvaluators(VectorPTFDesc vectorPTFDesc, VectorPTFInfo vectorPTFInfo) {
    String[] evaluatorFunctionNames = vectorPTFDesc.getEvaluatorFunctionNames();
    int evaluatorCount = evaluatorFunctionNames.length;
    WindowFrameDef[] evaluatorWindowFrameDefs = vectorPTFDesc.getEvaluatorWindowFrameDefs();
    VectorExpression[] evaluatorInputExpressions = vectorPTFInfo.getEvaluatorInputExpressions();
    Type[] evaluatorInputColumnVectorTypes = vectorPTFInfo.getEvaluatorInputColumnVectorTypes();
    int[] outputColumnMap = vectorPTFInfo.getOutputColumnMap();
    VectorPTFEvaluatorBase[] evaluators = new VectorPTFEvaluatorBase[evaluatorCount];
    for (int i = 0; i < evaluatorCount; i++) {
        String functionName = evaluatorFunctionNames[i];
        WindowFrameDef windowFrameDef = evaluatorWindowFrameDefs[i];
        SupportedFunctionType functionType = VectorPTFDesc.supportedFunctionsMap.get(functionName);
        VectorExpression inputVectorExpression = evaluatorInputExpressions[i];
        final Type columnVectorType = evaluatorInputColumnVectorTypes[i];
        // The output* arrays start at index 0 for output evaluator aggregations.
        final int outputColumnNum = outputColumnMap[i];
        VectorPTFEvaluatorBase evaluator = VectorPTFDesc.getEvaluator(functionType, windowFrameDef, columnVectorType, inputVectorExpression, outputColumnNum);
        evaluators[i] = evaluator;
    }
    return evaluators;
}
Also used : VectorPTFEvaluatorBase(org.apache.hadoop.hive.ql.exec.vector.ptf.VectorPTFEvaluatorBase) Type(org.apache.hadoop.hive.ql.exec.vector.ColumnVector.Type) WindowFrameDef(org.apache.hadoop.hive.ql.plan.ptf.WindowFrameDef) VectorExpression(org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression)

Example 2 with VectorPTFEvaluatorBase

use of org.apache.hadoop.hive.ql.exec.vector.ptf.VectorPTFEvaluatorBase in project hive by apache.

the class VectorPTFDesc method getStreamingEvaluatorNums.

public static int[] getStreamingEvaluatorNums(VectorPTFEvaluatorBase[] evaluators) {
    final int evaluatorCount = evaluators.length;
    ArrayList<Integer> streamingEvaluatorNums = new ArrayList<Integer>();
    for (int i = 0; i < evaluatorCount; i++) {
        final VectorPTFEvaluatorBase evaluator = evaluators[i];
        if (evaluator.streamsResult()) {
            streamingEvaluatorNums.add(i);
        }
    }
    return ArrayUtils.toPrimitive(streamingEvaluatorNums.toArray(new Integer[0]));
}
Also used : VectorPTFEvaluatorBase(org.apache.hadoop.hive.ql.exec.vector.ptf.VectorPTFEvaluatorBase) ArrayList(java.util.ArrayList)

Aggregations

VectorPTFEvaluatorBase (org.apache.hadoop.hive.ql.exec.vector.ptf.VectorPTFEvaluatorBase)2 ArrayList (java.util.ArrayList)1 Type (org.apache.hadoop.hive.ql.exec.vector.ColumnVector.Type)1 VectorExpression (org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression)1 WindowFrameDef (org.apache.hadoop.hive.ql.plan.ptf.WindowFrameDef)1