@Override public byte[] getBytes() { return WritableUtils.toByteArray(this); }
protected Result handleUnknown(Writable value, Generator generator) { generator.writeBinary(WritableUtils.toByteArray(value)); return Result.SUCCESFUL(); } }
/** {@inheritDoc} */ @Override public JobStatus submitJob(JobID jobId, String jobSubmitDir, Credentials ts) throws IOException, InterruptedException { try { conf.setLong(HadoopCommonUtils.JOB_SUBMISSION_START_TS_PROPERTY, U.currentTimeMillis()); byte[] credentials = null; if (ts != null) credentials = WritableUtils.toByteArray(ts); HadoopJobStatus status = execute(HadoopProtocolSubmitJobTask.class, jobId.getJtIdentifier(), jobId.getId(), createJobInfo(conf, credentials)); if (status == null) throw new IOException("Failed to submit job (null status obtained): " + jobId); return processStatus(status); } catch (GridClientException | IgniteCheckedException e) { throw new IOException("Failed to submit job.", e); } }
return org.apache.hadoop.io.WritableUtils.toByteArray(writable);
public CompactRange(Namespace.ID namespaceId, Table.ID tableId, byte[] startRow, byte[] endRow, List<IteratorSetting> iterators, CompactionStrategyConfig compactionStrategy) throws AcceptableThriftTableOperationException { requireNonNull(namespaceId, "Invalid argument: null namespaceId"); requireNonNull(tableId, "Invalid argument: null tableId"); requireNonNull(iterators, "Invalid argument: null iterator list"); requireNonNull(compactionStrategy, "Invalid argument: null compactionStrategy"); this.tableId = tableId; this.namespaceId = namespaceId; this.startRow = startRow.length == 0 ? null : startRow; this.endRow = endRow.length == 0 ? null : endRow; if (iterators.size() > 0 || !compactionStrategy.equals(CompactionStrategyConfigUtil.DEFAULT_STRATEGY)) { this.config = WritableUtils.toByteArray( new UserCompactionConfig(this.startRow, this.endRow, iterators, compactionStrategy)); } else { log.info("No iterators or compaction strategy"); } if (this.startRow != null && this.endRow != null && new Text(startRow).compareTo(new Text(endRow)) >= 0) throw new AcceptableThriftTableOperationException(tableId.canonicalID(), null, TableOperation.COMPACT, TableOperationExceptionType.BAD_RANGE, "start row must be less than end row"); }
@Override public byte[] getBytes() { return WritableUtils.toByteArray(this); }
@Override public byte[] getBytes() { return WritableUtils.toByteArray(this); }
/** {@inheritDoc} */ public byte[] getBytes() { return WritableUtils.toByteArray(this); }
@Override public byte[] getBytes() { return WritableUtils.toByteArray(this); }
private static BytesWritable asBytesWritable(Writable w) { if (w instanceof BytesWritable) { return (BytesWritable) w; } else { return new BytesWritable(WritableUtils.toByteArray(w)); } }
public HFileTarget(Path path, HColumnDescriptor hcol) { super(path, HFileOutputFormatForCrunch.class, SequentialFileNamingScheme.getInstance()); Preconditions.checkNotNull(hcol); outputConf(HFileOutputFormatForCrunch.HCOLUMN_DESCRIPTOR_KEY, Hex.encodeHexString(WritableUtils.toByteArray(hcol))); }
/** * Add TimestampRange and earliest put timestamp to Metadata */ public void appendTrackedTimestampsToMetadata() throws IOException { appendFileInfo(TIMERANGE_KEY,WritableUtils.toByteArray(timeRangeTracker)); appendFileInfo(EARLIEST_PUT_TS, Bytes.toBytes(earliestPutTs)); }
/** * Add TimestampRange and earliest put timestamp to Metadata */ public void appendTrackedTimestampsToMetadata() throws IOException { appendFileInfo(TIMERANGE_KEY,WritableUtils.toByteArray(timeRangeTracker)); appendFileInfo(EARLIEST_PUT_TS, Bytes.toBytes(earliestPutTs)); }
protected Result handleUnknown(Writable value, Generator generator) { generator.writeBinary(WritableUtils.toByteArray(value)); return Result.SUCCESFUL(); } }
protected Result handleUnknown(Writable value, Generator generator) { generator.writeBinary(WritableUtils.toByteArray(value)); return Result.SUCCESFUL(); } }
@Override public Value getTopValue() { return new Value(WritableUtils.toByteArray(this.getValue())); }
protected Result handleUnknown(Writable value, Generator generator) { generator.writeBinary(WritableUtils.toByteArray(value)); return Result.SUCCESFUL(); } }
protected Result handleUnknown(Writable value, Generator generator) { generator.writeBinary(WritableUtils.toByteArray(value)); return Result.SUCCESFUL(); } }
@Override public Value getTopValue() { try { if (compressResults) { return new Value(this.getValue().toByteArray()); } else { return new Value(WritableUtils.toByteArray(this.getValue())); } } catch (IOException e) { throw new RuntimeException(e); } }
private Pair<Key,Value> makeTop(List<DiscoveredThing> things) { Writable[] returnedThings = new Writable[things.size()]; for (int i = 0; i < returnedThings.length; ++i) returnedThings[i] = things.get(i); ArrayWritable aw = new ArrayWritable(DiscoveredThing.class); aw.set(returnedThings); DiscoveredThing thing = things.get(0); // we want the key to be the last possible key for this date return new Pair<>(new Key(thing.getTerm(), thing.getField(), thing.getDate() + '\uffff'), new Value(WritableUtils.toByteArray(aw))); }