Search in sources :

Example 1 with PTFInputDef

use of org.apache.hadoop.hive.ql.plan.ptf.PTFInputDef in project hive by apache.

the class PTFDesc method getFuncDefExplain.

@Explain(displayName = "Function definitions", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public List<PTFInputDef> getFuncDefExplain() {
    if (funcDef == null) {
        return null;
    }
    List<PTFInputDef> inputs = new ArrayList<PTFInputDef>();
    for (PTFInputDef current = funcDef; current != null; current = current.getInput()) {
        inputs.add(current);
    }
    Collections.reverse(inputs);
    return inputs;
}
Also used : PTFInputDef(org.apache.hadoop.hive.ql.plan.ptf.PTFInputDef) ArrayList(java.util.ArrayList)

Example 2 with PTFInputDef

use of org.apache.hadoop.hive.ql.plan.ptf.PTFInputDef in project hive by apache.

the class PTFDeserializer method initializePTFChain.

public void initializePTFChain(PartitionedTableFunctionDef tblFnDef) throws HiveException {
    Deque<PTFInputDef> ptfChain = new ArrayDeque<PTFInputDef>();
    PTFInputDef currentDef = tblFnDef;
    while (currentDef != null) {
        ptfChain.push(currentDef);
        currentDef = currentDef.getInput();
    }
    while (!ptfChain.isEmpty()) {
        currentDef = ptfChain.pop();
        if (currentDef instanceof PTFQueryInputDef) {
            initialize((PTFQueryInputDef) currentDef, inputOI);
        } else if (currentDef instanceof WindowTableFunctionDef) {
            initializeWindowing((WindowTableFunctionDef) currentDef);
        } else {
            initialize((PartitionedTableFunctionDef) currentDef);
        }
    }
    PTFDeserializer.alterOutputOIForStreaming(ptfDesc);
}
Also used : PTFInputDef(org.apache.hadoop.hive.ql.plan.ptf.PTFInputDef) WindowTableFunctionDef(org.apache.hadoop.hive.ql.plan.ptf.WindowTableFunctionDef) PartitionedTableFunctionDef(org.apache.hadoop.hive.ql.plan.ptf.PartitionedTableFunctionDef) ArrayDeque(java.util.ArrayDeque) PTFQueryInputDef(org.apache.hadoop.hive.ql.plan.ptf.PTFQueryInputDef)

Example 3 with PTFInputDef

use of org.apache.hadoop.hive.ql.plan.ptf.PTFInputDef in project hive by apache.

the class PTFOperator method setupChain.

private PTFInvocation setupChain() {
    Stack<PartitionedTableFunctionDef> fnDefs = new Stack<PartitionedTableFunctionDef>();
    PTFInputDef iDef = conf.getFuncDef();
    while (iDef instanceof PartitionedTableFunctionDef) {
        fnDefs.push((PartitionedTableFunctionDef) iDef);
        iDef = ((PartitionedTableFunctionDef) iDef).getInput();
    }
    PTFInvocation curr = null, first = null;
    while (!fnDefs.isEmpty()) {
        PartitionedTableFunctionDef currFn = fnDefs.pop();
        curr = new PTFInvocation(curr, currFn.getTFunction());
        if (first == null) {
            first = curr;
        }
    }
    return first;
}
Also used : PTFInputDef(org.apache.hadoop.hive.ql.plan.ptf.PTFInputDef) PartitionedTableFunctionDef(org.apache.hadoop.hive.ql.plan.ptf.PartitionedTableFunctionDef) Stack(java.util.Stack)

Example 4 with PTFInputDef

use of org.apache.hadoop.hive.ql.plan.ptf.PTFInputDef in project hive by apache.

the class PTFTranslator method translatePTFChain.

private void translatePTFChain() throws SemanticException {
    Deque<PTFInputSpec> ptfChain = new ArrayDeque<PTFInvocationSpec.PTFInputSpec>();
    PTFInputSpec currentSpec = ptfInvocation.getFunction();
    while (currentSpec != null) {
        ptfChain.push(currentSpec);
        currentSpec = currentSpec.getInput();
    }
    int inputNum = 0;
    PTFInputDef currentDef = null;
    while (!ptfChain.isEmpty()) {
        currentSpec = ptfChain.pop();
        if (currentSpec instanceof PTFQueryInputSpec) {
            currentDef = translate((PTFQueryInputSpec) currentSpec, inputNum);
        } else {
            currentDef = translate((PartitionedTableFunctionSpec) currentSpec, currentDef, inputNum);
        }
        inputNum++;
    }
    ptfDesc.setFuncDef((PartitionedTableFunctionDef) currentDef);
}
Also used : PTFInputSpec(org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PTFInputSpec) PTFInputDef(org.apache.hadoop.hive.ql.plan.ptf.PTFInputDef) PTFQueryInputSpec(org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PTFQueryInputSpec) PartitionedTableFunctionSpec(org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PartitionedTableFunctionSpec) ArrayDeque(java.util.ArrayDeque)

Aggregations

PTFInputDef (org.apache.hadoop.hive.ql.plan.ptf.PTFInputDef)4 ArrayDeque (java.util.ArrayDeque)2 PartitionedTableFunctionDef (org.apache.hadoop.hive.ql.plan.ptf.PartitionedTableFunctionDef)2 ArrayList (java.util.ArrayList)1 Stack (java.util.Stack)1 PTFInputSpec (org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PTFInputSpec)1 PTFQueryInputSpec (org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PTFQueryInputSpec)1 PartitionedTableFunctionSpec (org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PartitionedTableFunctionSpec)1 PTFQueryInputDef (org.apache.hadoop.hive.ql.plan.ptf.PTFQueryInputDef)1 WindowTableFunctionDef (org.apache.hadoop.hive.ql.plan.ptf.WindowTableFunctionDef)1