private void deepCopyElements(Object[] keys, ObjectInspector[] keyObjectInspectors, Object[] result, ObjectInspectorCopyOption copyOption) { for (int i = 0; i < keys.length; i++) { result[i] = ObjectInspectorUtils.copyToStandardObject(keys[i], keyObjectInspectors[i], copyOption); } } }
@Override public void process(Object row, int tag) throws HiveException { // Store the row. See comments above for why we need a new copy of the row. result.o = ObjectInspectorUtils.copyToStandardObject(row, inputObjInspectors[0], ObjectInspectorCopyOption.WRITABLE); }
public static Object[] copyToStandardObject(Object[] o, ObjectInspector[] oi, ObjectInspectorCopyOption objectInspectorOption) { Object[] out = new Object[o.length]; for (int i = 0; i < oi.length; i++) { out[i] = ObjectInspectorUtils.copyToStandardObject(o[i], oi[i], objectInspectorOption); } return out; }
@Override public void copyKey(KeyWrapper oldWrapper) { TextKeyWrapper textWrapper = (TextKeyWrapper) oldWrapper; hashcode = textWrapper.hashcode; isCopy = true; key = ObjectInspectorUtils.copyToStandardObject(textWrapper.key, soi_new, ObjectInspectorCopyOption.WRITABLE); }
/** * Returns a deep copy of the Object o that can be scanned by a * StandardObjectInspector returned by getStandardObjectInspector(oi). */ public static Object copyToStandardObject(Object o, ObjectInspector oi) { return copyToStandardObject(o, oi, ObjectInspectorCopyOption.DEFAULT); }
public static Object copyToStandardJavaObject(Object o, ObjectInspector oi) { return copyToStandardObject(o, oi, ObjectInspectorCopyOption.JAVA); }
protected void read(ObjectInspector oi, Object obj) throws SerDeException { @SuppressWarnings("unchecked") List<Object> value = (List<Object>)ObjectInspectorUtils.copyToStandardObject( obj, oi, ObjectInspectorCopyOption.WRITABLE); if (value == null) { key = EMPTY_OBJECT_ARRAY; } else { key = value.toArray(); } }
public void readFromRow(Object[] fieldObjs, List<ObjectInspector> keyFieldsOI) throws HiveException { if (key == null || key.length != fieldObjs.length) { key = new Object[fieldObjs.length]; } for (int keyIndex = 0; keyIndex < fieldObjs.length; ++keyIndex) { key[keyIndex] = (ObjectInspectorUtils.copyToStandardObject(fieldObjs[keyIndex], keyFieldsOI.get(keyIndex), ObjectInspectorCopyOption.WRITABLE)); } }
public void append(Object o) throws HiveException { @SuppressWarnings("unchecked") List<Object> l = (List<Object>) ObjectInspectorUtils.copyToStandardObject( o, inputOI, ObjectInspectorCopyOption.WRITABLE); currWindow.add(l); numRowsReceived++; }
@Override public void merge(AggregationBuffer agg, Object partial) throws HiveException { if (partial != null) { MaxAgg myagg = (MaxAgg) agg; int r = ObjectInspectorUtils.compare(myagg.o, outputOI, partial, inputOI); if (myagg.o == null || r < 0) { myagg.o = ObjectInspectorUtils.copyToStandardObject(partial, inputOI, ObjectInspectorCopyOption.JAVA); } } }
@Override public void iterate(AggregationBuffer agg, Object[] parameters) throws HiveException { Object rowExprVal = ObjectInspectorUtils.copyToStandardObject(parameters[0], inputOI[0]); Object defaultVal = parameters.length > 2 ? ObjectInspectorUtils.copyToStandardObject( defaultValueConverter.convert(parameters[2]), inputOI[0]) : null; ((LeadLagBuffer) agg).addRow(rowExprVal, defaultVal); }
public static Object getSelectListInput(Object currRow, ObjectInspector rowOI, PTFPartitionIterator<Object> pItr, int sz) throws HiveException { ArrayList<Object> oRow = new ArrayList<Object>(); List<?> currRowAsStdObject = (List<?>) ObjectInspectorUtils .copyToStandardObject(currRow, rowOI); oRow.addAll(currRowAsStdObject); oRow.add(getPath(currRow, rowOI, pItr, sz)); return oRow; }
@Override public KeyWrapper copyKey() { return new TextKeyWrapper(hashcode, ObjectInspectorUtils.copyToStandardObject(key, soi_new, ObjectInspectorCopyOption.WRITABLE), true); }
public List<Object> processRow(Object row) throws HiveException { if (!canAcceptInputAsStream()) { throw new HiveException(String.format( "Internal error: PTF %s, doesn't support Streaming", getClass() .getName())); } rows.clear(); row = ObjectInspectorUtils.copyToStandardObject(row, inputOI, ObjectInspectorCopyOption.WRITABLE); rows.add(row); return rows; }
public List<Object> processRow(Object row) throws HiveException { if (!canAcceptInputAsStream()) { throw new HiveException(String.format( "Internal error: PTF %s, doesn't support Streaming", getClass() .getName())); } rows.clear(); row = ObjectInspectorUtils.copyToStandardObject(row, inputOI, ObjectInspectorCopyOption.WRITABLE); rows.add(row); return rows; }
@Override public void merge(AggregationBuffer agg, Object partial) throws HiveException { if (partial != null) { MinAgg myagg = (MinAgg) agg; int r = ObjectInspectorUtils.compare(myagg.o, outputOI, partial, inputOI, new FullMapEqualComparer(), NullValueOption.MAXVALUE); if (myagg.o == null || r > 0) { myagg.o = ObjectInspectorUtils.copyToStandardObject(partial, inputOI, ObjectInspectorCopyOption.JAVA); } } }
public void append(Object o) throws HiveException { if ( elems.rowCount() == Integer.MAX_VALUE ) { throw new HiveException(String.format("Cannot add more than %d elements to a PTFPartition", Integer.MAX_VALUE)); } @SuppressWarnings("unchecked") List<Object> l = (List<Object>) ObjectInspectorUtils.copyToStandardObject(o, inputOI, ObjectInspectorCopyOption.WRITABLE); elems.addRow(l); }
public Object[] computeValues(Object row) throws HiveException { Object[] objs = new Object[orderDef.getExpressions().size()]; for (int i = 0; i < objs.length; i++) { Object o = orderDef.getExpressions().get(i).getExprEvaluator().evaluate(row); objs[i] = ObjectInspectorUtils.copyToStandardObject(o, orderDef.getExpressions().get(i).getOI()); } return objs; }
public Object computeValue(Object row) throws HiveException { Object o = expressionDef.getExprEvaluator().evaluate(row); return ObjectInspectorUtils.copyToStandardObject(o, expressionDef.getOI()); }
private void extractResultObjects(VectorizedRowBatch batch, int rowIndex, VectorExtractRow resultVectorExtractRow, Object[] scrqtchRow, ObjectInspector objectInspector, Object[] resultObjects) { boolean selectedInUse = batch.selectedInUse; int[] selected = batch.selected; for (int logicalIndex = 0; logicalIndex < batch.size; logicalIndex++) { final int batchIndex = (selectedInUse ? selected[logicalIndex] : logicalIndex); resultVectorExtractRow.extractRow(batch, batchIndex, scrqtchRow); Object copyResult = ObjectInspectorUtils.copyToStandardObject( scrqtchRow[0], objectInspector, ObjectInspectorCopyOption.WRITABLE); resultObjects[rowIndex++] = copyResult; } }