Search in sources :

Example 1 with SymbolFunctionResult

use of com.sap.hadoop.windowing.functions2.table.npath.SymbolFunction.SymbolFunctionResult in project SQLWindowing by hbutani.

the class NPath method execute.

@Override
public void execute(PartitionIterator<Object> pItr, Partition outP) throws WindowingException {
    while (pItr.hasNext()) {
        Object iRow = pItr.next();
        SymbolFunctionResult syFnRes = SymbolFunction.match(syFn, iRow, pItr);
        if (syFnRes.matches) {
            int sz = syFnRes.nextRow - (pItr.getIndex() - 1);
            Object selectListInput = NPathUtils.getSelectListInput(iRow, tDef.getInput().getOI(), pItr, sz);
            ArrayList<Object> oRow = new ArrayList<Object>();
            for (ExprNodeEvaluator resExprEval : resultExprEvals) {
                try {
                    oRow.add(resExprEval.evaluate(selectListInput));
                } catch (HiveException he) {
                    throw new WindowingException(he);
                }
            }
            outP.append(oRow);
        }
    }
}
Also used : SymbolFunctionResult(com.sap.hadoop.windowing.functions2.table.npath.SymbolFunction.SymbolFunctionResult) HiveException(org.apache.hadoop.hive.ql.metadata.HiveException) ArrayList(java.util.ArrayList) ExprNodeEvaluator(org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator) WindowingException(com.sap.hadoop.windowing.WindowingException)

Aggregations

WindowingException (com.sap.hadoop.windowing.WindowingException)1 SymbolFunctionResult (com.sap.hadoop.windowing.functions2.table.npath.SymbolFunction.SymbolFunctionResult)1 ArrayList (java.util.ArrayList)1 ExprNodeEvaluator (org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator)1 HiveException (org.apache.hadoop.hive.ql.metadata.HiveException)1