Search in sources :

Example 1 with PTFQueryInputDef

use of org.apache.hadoop.hive.ql.plan.ptf.PTFQueryInputDef 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 2 with PTFQueryInputDef

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

the class PTFTranslator method translate.

private PTFQueryInputDef translate(PTFQueryInputSpec spec, int inpNum) throws SemanticException {
    PTFQueryInputDef def = new PTFQueryInputDef();
    StructObjectInspector oi = PTFTranslator.getStandardStructOI(inputRR);
    ShapeDetails shp = setupShape(oi, null, inputRR);
    def.setOutputShape(shp);
    def.setType(spec.getType());
    def.setAlias(spec.getSource() == null ? "ptf_" + inpNum : spec.getSource());
    return def;
}
Also used : ShapeDetails(org.apache.hadoop.hive.ql.plan.ptf.ShapeDetails) PTFQueryInputDef(org.apache.hadoop.hive.ql.plan.ptf.PTFQueryInputDef) StructObjectInspector(org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector)

Aggregations

PTFQueryInputDef (org.apache.hadoop.hive.ql.plan.ptf.PTFQueryInputDef)2 ArrayDeque (java.util.ArrayDeque)1 PTFInputDef (org.apache.hadoop.hive.ql.plan.ptf.PTFInputDef)1 PartitionedTableFunctionDef (org.apache.hadoop.hive.ql.plan.ptf.PartitionedTableFunctionDef)1 ShapeDetails (org.apache.hadoop.hive.ql.plan.ptf.ShapeDetails)1 WindowTableFunctionDef (org.apache.hadoop.hive.ql.plan.ptf.WindowTableFunctionDef)1 StructObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector)1