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;
}
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);
}
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;
}
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);
}
Aggregations