use of com.sap.hadoop.windowing.query2.definition.PartitionDef in project SQLWindowing by hbutani.
the class PTFOperator method setupKeysWrapper.
protected void setupKeysWrapper(ObjectInspector inputOI) throws HiveException {
PartitionDef pDef = RuntimeUtils.getFirstTableFunction(qDef).getWindow().getPartDef();
ArrayList<ColumnDef> cols = pDef.getColumns();
int numCols = cols.size();
ExprNodeEvaluator[] keyFields = new ExprNodeEvaluator[numCols];
ObjectInspector[] keyOIs = new ObjectInspector[numCols];
ObjectInspector[] currentKeyOIs = new ObjectInspector[numCols];
for (int i = 0; i < numCols; i++) {
ColumnDef cDef = cols.get(i);
/*
* Why cannot we just use the ExprNodeEvaluator on the column?
* - because on the reduce-side it is initialized based on the rowOI of the HiveTable
* and not the OI of the ExtractOp ( the parent of this Operator on the reduce-side)
*/
keyFields[i] = ExprNodeEvaluatorFactory.get(cDef.getExprNode());
keyOIs[i] = keyFields[i].initialize(inputOI);
currentKeyOIs[i] = ObjectInspectorUtils.getStandardObjectInspector(keyOIs[i], ObjectInspectorCopyOption.WRITABLE);
}
keyWrapperFactory = new WindowingKeyWrapperFactory(keyFields, keyOIs, currentKeyOIs);
newKeys = keyWrapperFactory.getWindowingKeyWrapper();
}
Aggregations