Search in sources :

Example 6 with TableFunctionEvaluator

use of com.sap.hadoop.windowing.functions2.TableFunctionEvaluator in project SQLWindowing by hbutani.

the class QueryDefDeserializer method visit.

/*
	 * 1. Invoke setupOI on the TableFunctionEvaluator 
	 * 2. Setup serde and OI on the table function definition 
	 * 3. Add the table function definition to input map
	 *    on the query translation info 
	 * 4. Reset the inputInfo to the one associated
	 *    with this table function definition.
	 */
@Override
public void visit(TableFuncDef tblFuncDef) throws WindowingException {
    TableFunctionEvaluator tEval = tblFuncDef.getFunction();
    currentTFnResolver.setupOutputOI();
    TranslateUtils.setupSerdeAndOI(tblFuncDef, qInDef, tInfo, tEval);
    tInfo.addInput(tblFuncDef);
    inputInfo = qDef.getTranslationInfo().getInputInfo(tblFuncDef);
}
Also used : TableFunctionEvaluator(com.sap.hadoop.windowing.functions2.TableFunctionEvaluator)

Example 7 with TableFunctionEvaluator

use of com.sap.hadoop.windowing.functions2.TableFunctionEvaluator in project SQLWindowing by hbutani.

the class MRUtils method addPTFMapOperator.

/**
	 * Returns true if the query needs a map-side reshape. PTFOperator is added
	 * on the map-side before ReduceSinkOperator in this scenario.
	 * 
	 * @param qdef
	 * @return
	 * @throws WindowingException 
	 */
public static boolean addPTFMapOperator(QueryDef qdef) throws WindowingException {
    boolean hasMap = false;
    TableFuncDef tabDef = RuntimeUtils.getFirstTableFunction(qdef);
    TableFunctionEvaluator tEval = tabDef.getFunction();
    if (tEval.isTransformsRawInput()) {
        hasMap = true;
    }
    return hasMap;
}
Also used : TableFunctionEvaluator(com.sap.hadoop.windowing.functions2.TableFunctionEvaluator) TableFuncDef(com.sap.hadoop.windowing.query2.definition.TableFuncDef)

Example 8 with TableFunctionEvaluator

use of com.sap.hadoop.windowing.functions2.TableFunctionEvaluator in project SQLWindowing by hbutani.

the class RuntimeUtils method createFirstPartitionForChain.

/**
	 * Create a new partition.
	 * The input OI is used to evaluate rows appended to the partition.
	 * The serde is determined based on whether the query has a map-phase 
	 * or not. The OI on the serde is used by PTFs to evaluate output of the 
	 * partition. 
	 * @param qDef
	 * @param oi
	 * @param hiveConf
	 * @return
	 * @throws WindowingException
	 */
public static Partition createFirstPartitionForChain(QueryDef qDef, ObjectInspector oi, HiveConf hiveConf, boolean isMapSide) throws WindowingException {
    TableFuncDef tabDef = getFirstTableFunction(qDef);
    TableFunctionEvaluator tEval = tabDef.getFunction();
    String partClassName = tEval.getPartitionClass();
    int partMemSize = tEval.getPartitionMemSize();
    Partition part = null;
    SerDe serde = tabDef.getInput().getSerde();
    part = new Partition(partClassName, partMemSize, serde, (StructObjectInspector) oi);
    return part;
}
Also used : SerDe(org.apache.hadoop.hive.serde2.SerDe) TableFunctionEvaluator(com.sap.hadoop.windowing.functions2.TableFunctionEvaluator) TableFuncDef(com.sap.hadoop.windowing.query2.definition.TableFuncDef) StructObjectInspector(org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector)

Aggregations

TableFunctionEvaluator (com.sap.hadoop.windowing.functions2.TableFunctionEvaluator)8 TableFuncDef (com.sap.hadoop.windowing.query2.definition.TableFuncDef)4 InputInfo (com.sap.hadoop.windowing.query2.translate.QueryTranslationInfo.InputInfo)3 Order (com.sap.hadoop.metadata.Order)1 WindowingException (com.sap.hadoop.windowing.WindowingException)1 TableFunctionResolver (com.sap.hadoop.windowing.functions2.TableFunctionResolver)1 ArgDef (com.sap.hadoop.windowing.query2.definition.ArgDef)1 ColumnDef (com.sap.hadoop.windowing.query2.definition.ColumnDef)1 OrderColumnDef (com.sap.hadoop.windowing.query2.definition.OrderColumnDef)1 QueryInputDef (com.sap.hadoop.windowing.query2.definition.QueryInputDef)1 TableFuncSpec (com.sap.hadoop.windowing.query2.specification.TableFuncSpec)1 WindowSpec (com.sap.hadoop.windowing.query2.specification.WindowSpec)1 HashMap (java.util.HashMap)1 ColumnInfo (org.apache.hadoop.hive.ql.exec.ColumnInfo)1 ASTNode (org.apache.hadoop.hive.ql.parse.ASTNode)1 RowResolver (org.apache.hadoop.hive.ql.parse.RowResolver)1 SerDe (org.apache.hadoop.hive.serde2.SerDe)1 StructObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector)1 TypeInfo (org.apache.hadoop.hive.serde2.typeinfo.TypeInfo)1