@Override public StaticBuffer getCurrentKey() throws IOException, InterruptedException { return StaticArrayBuffer.of(reader.getCurrentKey().copyBytes()); }
private void readPartitionFile(FileSystem fs, Configuration conf, Path path) throws IOException { @SuppressWarnings("deprecation") SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, conf); ImmutableBytesWritable key = new ImmutableBytesWritable(); partitions = new ArrayList<>(); while (reader.next(key)) { partitions.add(new ImmutableBytesWritable(key.copyBytes())); } reader.close(); if (!Ordering.natural().isOrdered(partitions)) { throw new IOException("Partitions are not ordered!"); } }
@Override public void collect(ImmutableBytesWritable arg, Result result) throws IOException { assertArrayEquals(org.apache.hbase.thirdparty.com.google.common.primitives. Bytes.concat(firstPartKeyValue, bSeparator, secondPartKeyValue), arg.copyBytes()); outputCollected.set(true); } };
Put put = new Put(rowKey.copyBytes()); for (int i = 0; i < parsed.getColumnCount(); i++) { if (i == parser.getRowKeyColumnIndex() || i == parser.getTimestampKeyColumnIndex()
private void iterate() { if (schema.next(ptr, position++, maxOffset) == null) { nextValue = null; } else { nextValue = ptr.copyBytes(); } }
/** * Returns joda's DateTimeZone instance from cache or create new instance and cache it. * * @param timezoneId Timezone Id as accepted by {@code DateTimeZone.forID()}. E.g. Europe/Isle_of_Man * @return joda's DateTimeZone instance * @throws IllegalDataException if unknown timezone id is passed */ public static DateTimeZone getInstance(ImmutableBytesWritable timezoneId) { return getInstance(ByteBuffer.wrap(timezoneId.copyBytes())); }
private void iterate() { if (schema.next(ptr, position++, maxOffset) == null) { nextValue = null; } else { nextValue = ptr.copyBytes(); } }
private ImmutableBytesWritable copy(ImmutableBytesWritable bytes) { return new ImmutableBytesWritable(bytes.copyBytes()); }
scan.setStopRow(sourceTableHash.stopRow); } else { scan.setStopRow(nextSourceKey.copyBytes());
while (rr.next(key, value)) { verifyRowFromMap(key, value); rowTracker.addRow(key.copyBytes());
Assert.fail("duplicate key in data files: " + intKey); actualHashes.put(intKey, new ImmutableBytesWritable(hash.copyBytes()));
public static List<byte[]> decodeBytes(ImmutableBytesWritable encodedBytes, int maxLength) throws IOException { ByteArrayInputStream stream = new ByteArrayInputStream(encodedBytes.get(), encodedBytes.getOffset(), encodedBytes.getLength()); DataInput input = new DataInputStream(stream); PrefixByteDecoder decoder = new PrefixByteDecoder(maxLength); List<byte[]> listOfBytes = Lists.newArrayList(); try { while (true) { ImmutableBytesWritable ptr = decoder.decode(input); // For this test, copy the bytes, but we wouldn't do this unless // necessary for non testing listOfBytes.add(ptr.copyBytes()); } } catch (EOFException e) { // Ignore as this signifies we're done } return listOfBytes; }
public Get getGet(PTable catalogTable, byte[] tenantId, String viewName) { byte[][] tenantKeyParts = new byte[5][]; tenantKeyParts[0] = tenantId; tenantKeyParts[1] = Bytes.toBytes(SCHEMA_NAME.toUpperCase()); tenantKeyParts[2] = Bytes.toBytes(viewName.toUpperCase()); tenantKeyParts[3] = Bytes.toBytes(VIEW_COLUMN_NAME); tenantKeyParts[4] = VIEW_COLUMN_FAMILY_BYTES; ImmutableBytesWritable key = new ImmutableBytesWritable(); catalogTable.newKey(key, tenantKeyParts); //the backing byte array of key might have extra space at the end. // need to just slice "the good parts" which we do by calling copyBytes return new Get(key.copyBytes()); }
/** * Given an ImmutableBytesWritable, returns the payload part of the argument as an byte array. */ public static byte[] copyKeyBytesIfNecessary(ImmutableBytesWritable ptr) { if (ptr.getOffset() == 0 && ptr.getLength() == ptr.get().length) { return ptr.get(); } return ptr.copyBytes(); }
/** * Given an ImmutableBytesWritable, returns the payload part of the argument as an byte array. */ public static byte[] copyKeyBytesIfNecessary(ImmutableBytesWritable ptr) { if (ptr.getOffset() == 0 && ptr.getLength() == ptr.get().length) { return ptr.get(); } return ptr.copyBytes(); }
public static byte[] copyBytesIfNecessary(ImmutableBytesWritable ptr) { if (ptr.getOffset() == 0 && ptr.getLength() == ptr.get().length) { return ptr.get(); } return ptr.copyBytes(); } }
public static byte[] copyBytesIfNecessary(ImmutableBytesWritable ptr) { if (ptr.getOffset() == 0 && ptr.getLength() == ptr.get().length) { return ptr.get(); } return ptr.copyBytes(); } }
private static byte[] getKeyPart(PTable t, String... keys) throws SQLException { ImmutableBytesWritable ptr = new ImmutableBytesWritable(); byte[][] keyByteArray = new byte[keys.length][]; int i = 0; for (String key : keys) { keyByteArray[i++] = key == null ? ByteUtil.EMPTY_BYTE_ARRAY : Bytes.toBytes(key); } t.newKey(ptr, keyByteArray); return ptr.copyBytes(); }