use of org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange in project drill by apache.
the class TestTableGenerator method generateHBaseDatasetBigIntOBDesc.
public static void generateHBaseDatasetBigIntOBDesc(Connection conn, Admin admin, TableName tableName, int numberRegions) throws Exception {
if (admin.tableExists(tableName)) {
admin.disableTable(tableName);
admin.deleteTable(tableName);
}
HTableDescriptor desc = new HTableDescriptor(tableName);
desc.addFamily(new HColumnDescriptor(FAMILY_F));
if (numberRegions > 1) {
admin.createTable(desc, Arrays.copyOfRange(SPLIT_KEYS, 0, numberRegions - 1));
} else {
admin.createTable(desc);
}
BufferedMutator table = conn.getBufferedMutator(tableName);
long startTime = (long) 1438034423 * 1000;
for (long i = startTime; i <= startTime + 100; i++) {
byte[] bytes = new byte[9];
PositionedByteRange br = new SimplePositionedMutableByteRange(bytes, 0, 9);
OrderedBytes.encodeInt64(br, i, Order.DESCENDING);
Put p = new Put(bytes);
p.addColumn(FAMILY_F, COLUMN_C, String.format("value %d", i).getBytes());
table.mutate(p);
}
table.close();
admin.flush(tableName);
}
use of org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange in project hbase by apache.
the class TestUnion2 method testSkip.
@Test
public void testSkip() {
Integer intVal = 10;
String strVal = "hello";
PositionedByteRange buff = new SimplePositionedMutableByteRange(10);
SampleUnion1 type = new SampleUnion1();
int len = type.encode(buff, intVal);
buff.setPosition(0);
assertEquals(len, type.skip(buff));
buff.setPosition(0);
len = type.encode(buff, strVal);
buff.setPosition(0);
assertEquals(len, type.skip(buff));
}
use of org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange in project hbase by apache.
the class TestOrderedBlob method testEncodedLength.
@Test
public void testEncodedLength() {
PositionedByteRange buff = new SimplePositionedMutableByteRange(20);
for (final DataType<byte[]> type : new OrderedBlob[] { new OrderedBlob(Order.ASCENDING), new OrderedBlob(Order.DESCENDING) }) {
for (final byte[] val : VALUES) {
buff.setPosition(0);
type.encode(buff, val);
assertEquals("encodedLength does not match actual, " + Bytes.toStringBinary(val), buff.getPosition(), type.encodedLength(val));
}
}
}
use of org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange in project hbase by apache.
the class TestOrderedFloat32 method testEncodedLength.
@Test
public void testEncodedLength() {
final PositionedByteRange buffer = new SimplePositionedMutableByteRange(20);
for (final DataType<Float> type : new OrderedFloat32[] { new OrderedFloat32(Order.ASCENDING), new OrderedFloat32(Order.DESCENDING) }) {
for (final Float val : VALUES) {
buffer.setPosition(0);
type.encode(buffer, val);
assertEquals("encodedLength does not match actual, " + val, buffer.getPosition(), type.encodedLength(val));
}
}
}
use of org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange in project hbase by apache.
the class TestOrderedFloat32 method testEncodeNoSupportForNull.
@Test
public void testEncodeNoSupportForNull() {
exception.expect(IllegalArgumentException.class);
final DataType<Float> type = new OrderedFloat32(Order.ASCENDING);
type.encode(new SimplePositionedMutableByteRange(20), null);
}
Aggregations