Refine search
@Override public Object copyObject(Object o) { return o == null ? null : new IntWritable(((IntWritable) o).get()); }
private void addSimpleEvent(int operation, long currentTransaction, long rowId, Object row) throws IOException { this.operation.set(operation); this.currentTransaction.set(currentTransaction); // If this is an insert, originalTransaction should be set to this transaction. If not, // it will be reset by the following if anyway. long originalTransaction = currentTransaction; if (operation == DELETE_OPERATION || operation == UPDATE_OPERATION) { Object rowIdValue = rowInspector.getStructFieldData(row, recIdField); originalTransaction = origTxnInspector.get( recIdInspector.getStructFieldData(rowIdValue, originalTxnField)); rowId = rowIdInspector.get(recIdInspector.getStructFieldData(rowIdValue, rowIdField)); } else if(operation == INSERT_OPERATION) { rowId += rowIdOffset; } this.rowId.set(rowId); this.originalTransaction.set(originalTransaction); item.setFieldValue(OrcRecordUpdater.OPERATION, new IntWritable(operation)); item.setFieldValue(OrcRecordUpdater.ROW, (operation == DELETE_OPERATION ? null : row)); indexBuilder.addKey(operation, originalTransaction, bucket.get(), rowId); if (writer == null) { writer = OrcFile.createWriter(path, writerOptions); } writer.addRow(item); }
LazyBinaryInteger(LazyBinaryInteger copy) { super(copy); data = new IntWritable(copy.data.get()); }
/** * The INSERT event always uses {@link #bucket} that this {@link RecordUpdater} was created with * thus even for unbucketed tables, the N in bucket_N file name matches writerId/bucketId even for * late split */ private void addSimpleEvent(int operation, long currentWriteId, long rowId, Object row) throws IOException { this.operation.set(operation); this.currentWriteId.set(currentWriteId); Integer currentBucket = null; // If this is an insert, originalWriteId should be set to this transaction. If not, // it will be reset by the following if anyway. long originalWriteId = currentWriteId; if (operation == DELETE_OPERATION || operation == UPDATE_OPERATION) { Object rowIdValue = rowInspector.getStructFieldData(row, recIdField); originalWriteId = origWriteIdInspector.get( recIdInspector.getStructFieldData(rowIdValue, originalWriteIdField)); rowId = rowIdInspector.get(recIdInspector.getStructFieldData(rowIdValue, rowIdField)); currentBucket = setBucket(bucketInspector.get( recIdInspector.getStructFieldData(rowIdValue, bucketField)), operation); } this.rowId.set(rowId); this.originalWriteId.set(originalWriteId); item.setFieldValue(OrcRecordUpdater.OPERATION, new IntWritable(operation)); item.setFieldValue(OrcRecordUpdater.ROW, (operation == DELETE_OPERATION ? null : row)); indexBuilder.addKey(operation, originalWriteId, bucket.get(), rowId); initWriter(); writer.addRow(item); restoreBucket(currentBucket, operation); }
public LazyInteger(LazyInteger copy) { super(copy); data = new IntWritable(copy.data.get()); }
return; this.operation.set(operation); this.currentWriteId.set(currentWriteId); Object rowValue = rowInspector.getStructFieldData(row, recIdField); item.setFieldValue(OrcRecordUpdater.OPERATION, new IntWritable(DELETE_OPERATION)); deleteEventIndexBuilder.addKey(DELETE_OPERATION, originalWriteId, bucket.get(), rowId); deleteEventWriter.addRow(item); restoreBucket(currentBucket, operation);
@Override public Tuple2<IntWritable, Text> map(Tuple2<IntWritable, Text> v) throws Exception { v.f0 = new IntWritable(v.f0.get() % 5); return v; } }
@Override public Tuple2<IntWritable, Text> map(Tuple2<IntWritable, Text> v) throws Exception { v.f0 = new IntWritable(v.f0.get() % 5); return v; } }
@Override public Tuple2<IntWritable, Text> map(Tuple2<IntWritable, Text> v) throws Exception { v.f0 = new IntWritable(v.f0.get() / 5); return v; } }
@Override public Tuple2<IntWritable, IntWritable> map(Tuple2<IntWritable, Text> v) throws Exception { outT.f0 = new IntWritable(v.f0.get() / 6); outT.f1 = new IntWritable(1); return outT; } }
/** {@inheritDoc} */ @Override protected void reduce(Text key, Iterable<IntWritable> values, Context ctx) throws IOException, InterruptedException { int s = 0; for (IntWritable val : values) s += val.get(); System.out.println(">>>> Reduced: " + s); ctx.write(line, new IntWritable(s)); } }