本文整理汇总了Java中org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange类的典型用法代码示例。如果您正苦于以下问题:Java SimplePositionedMutableByteRange类的具体用法?Java SimplePositionedMutableByteRange怎么用?Java SimplePositionedMutableByteRange使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimplePositionedMutableByteRange类属于org.apache.hadoop.hbase.util包,在下文中一共展示了SimplePositionedMutableByteRange类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testReadWriteSkippable
import org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange; //导入依赖的package包/类
@Test
public void testReadWriteSkippable() {
PositionedByteRange buff = new SimplePositionedMutableByteRange(14);
for (OrderedString t : new OrderedString[] {
OrderedString.ASCENDING, OrderedString.DESCENDING
}) {
for (byte[] term : TERMINATORS) {
for (String val : VALUES_STRINGS) {
buff.setPosition(0);
DataType<String> type = new TerminatedWrapper<String>(t, term);
assertEquals(val.length() + 2 + term.length, type.encode(buff, val));
buff.setPosition(0);
assertEquals(val, type.decode(buff));
assertEquals(val.length() + 2 + term.length, buff.getPosition());
}
}
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:TestTerminatedWrapper.java
示例2: testReadWriteNonSkippable
import org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange; //导入依赖的package包/类
@Test
public void testReadWriteNonSkippable() {
PositionedByteRange buff = new SimplePositionedMutableByteRange(12);
for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
for (byte[] term : TERMINATORS) {
for (byte[] val : VALUES_BYTES) {
buff.setPosition(0);
DataType<byte[]> type = new TerminatedWrapper<byte[]>(new RawBytes(ord), term);
assertEquals(val.length + term.length, type.encode(buff, val));
buff.setPosition(0);
assertArrayEquals(val, type.decode(buff));
assertEquals(val.length + term.length, buff.getPosition());
}
}
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:TestTerminatedWrapper.java
示例3: testSkipSkippable
import org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange; //导入依赖的package包/类
@Test
public void testSkipSkippable() {
PositionedByteRange buff = new SimplePositionedMutableByteRange(14);
for (OrderedString t : new OrderedString[] {
OrderedString.ASCENDING, OrderedString.DESCENDING
}) {
for (byte[] term : TERMINATORS) {
for (String val : VALUES_STRINGS) {
buff.setPosition(0);
DataType<String> type = new TerminatedWrapper<String>(t, term);
int expected = val.length() + 2 + term.length;
assertEquals(expected, type.encode(buff, val));
buff.setPosition(0);
assertEquals(expected, type.skip(buff));
assertEquals(expected, buff.getPosition());
}
}
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:TestTerminatedWrapper.java
示例4: testSkipNonSkippable
import org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange; //导入依赖的package包/类
@Test
public void testSkipNonSkippable() {
PositionedByteRange buff = new SimplePositionedMutableByteRange(12);
for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
for (byte[] term : TERMINATORS) {
for (byte[] val : VALUES_BYTES) {
buff.setPosition(0);
DataType<byte[]> type = new TerminatedWrapper<byte[]>(new RawBytes(ord), term);
int expected = type.encode(buff, val);
buff.setPosition(0);
assertEquals(expected, type.skip(buff));
assertEquals(expected, buff.getPosition());
}
}
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:TestTerminatedWrapper.java
示例5: testReadWrite
import org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange; //导入依赖的package包/类
@Test
public void testReadWrite() {
for (int limit : limits) {
PositionedByteRange buff = new SimplePositionedMutableByteRange(limit);
for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
for (byte[] val : VALUES) {
buff.setPosition(0);
DataType<byte[]> type = new FixedLengthWrapper<byte[]>(new RawBytes(ord), limit);
assertEquals(limit, type.encode(buff, val));
buff.setPosition(0);
byte[] actual = type.decode(buff);
assertTrue("Decoding output differs from expected",
Bytes.equals(val, 0, val.length, actual, 0, val.length));
buff.setPosition(0);
assertEquals(limit, type.skip(buff));
}
}
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:TestFixedLengthWrapper.java
示例6: testReadWrite
import org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange; //导入依赖的package包/类
@Test
public void testReadWrite() {
for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
RawString type =
Order.ASCENDING == ord ? RawString.ASCENDING : RawString.DESCENDING;
for (String val : VALUES) {
PositionedByteRange buff = new SimplePositionedMutableByteRange(Bytes.toBytes(val).length);
assertEquals(buff.getLength(), type.encode(buff, val));
byte[] expected = Bytes.toBytes(val);
ord.apply(expected);
assertArrayEquals(expected, buff.getBytes());
buff.setPosition(0);
assertEquals(val, type.decode(buff));
buff.setPosition(0);
assertEquals(buff.getLength(), type.skip(buff));
assertEquals(buff.getLength(), buff.getPosition());
}
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:TestRawString.java
示例7: getByteBuf
import org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange; //导入依赖的package包/类
@Override
protected ByteBuf getByteBuf(LogicalExpression valueArg, String encodingType) {
switch (encodingType) {
case "UTF8_OB":
case "UTF8_OBD":
if (valueArg instanceof ValueExpressions.QuotedString) {
int stringLen = ((ValueExpressions.QuotedString) valueArg).value.getBytes(Charsets.UTF_8).length;
ByteBuf bb = newByteBuf(stringLen + 2, true);
PositionedByteRange br = new SimplePositionedMutableByteRange(bb.array(), 0, stringLen + 2);
if (encodingType.endsWith("_OBD")) {
org.apache.hadoop.hbase.util.OrderedBytes.encodeString(br, ((ValueExpressions.QuotedString) valueArg).value,
Order.DESCENDING);
setSortOrderAscending(false);
} else {
org.apache.hadoop.hbase.util.OrderedBytes.encodeString(br, ((ValueExpressions.QuotedString) valueArg).value,
Order.ASCENDING);
}
return bb;
}
}
return null;
}
开发者ID:axbaretto,项目名称:drill,代码行数:23,代码来源:MaprDBCompareFunctionsProcessor.java
示例8: testReadWriteSkippable
import org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange; //导入依赖的package包/类
@Test
public void testReadWriteSkippable() {
PositionedByteRange buff = new SimplePositionedMutableByteRange(14);
for (OrderedString t : new OrderedString[] {
OrderedString.ASCENDING, OrderedString.DESCENDING
}) {
for (byte[] term : TERMINATORS) {
for (String val : VALUES_STRINGS) {
buff.setPosition(0);
DataType<String> type = new TerminatedWrapper<>(t, term);
assertEquals(val.length() + 2 + term.length, type.encode(buff, val));
buff.setPosition(0);
assertEquals(val, type.decode(buff));
assertEquals(val.length() + 2 + term.length, buff.getPosition());
}
}
}
}
开发者ID:apache,项目名称:hbase,代码行数:19,代码来源:TestTerminatedWrapper.java
示例9: testReadWriteNonSkippable
import org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange; //导入依赖的package包/类
@Test
public void testReadWriteNonSkippable() {
PositionedByteRange buff = new SimplePositionedMutableByteRange(12);
for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
for (byte[] term : TERMINATORS) {
for (byte[] val : VALUES_BYTES) {
buff.setPosition(0);
DataType<byte[]> type = new TerminatedWrapper<>(new RawBytes(ord), term);
assertEquals(val.length + term.length, type.encode(buff, val));
buff.setPosition(0);
assertArrayEquals(val, type.decode(buff));
assertEquals(val.length + term.length, buff.getPosition());
}
}
}
}
开发者ID:apache,项目名称:hbase,代码行数:17,代码来源:TestTerminatedWrapper.java
示例10: testSkipSkippable
import org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange; //导入依赖的package包/类
@Test
public void testSkipSkippable() {
PositionedByteRange buff = new SimplePositionedMutableByteRange(14);
for (OrderedString t : new OrderedString[] {
OrderedString.ASCENDING, OrderedString.DESCENDING
}) {
for (byte[] term : TERMINATORS) {
for (String val : VALUES_STRINGS) {
buff.setPosition(0);
DataType<String> type = new TerminatedWrapper<>(t, term);
int expected = val.length() + 2 + term.length;
assertEquals(expected, type.encode(buff, val));
buff.setPosition(0);
assertEquals(expected, type.skip(buff));
assertEquals(expected, buff.getPosition());
}
}
}
}
开发者ID:apache,项目名称:hbase,代码行数:20,代码来源:TestTerminatedWrapper.java
示例11: testSkipNonSkippable
import org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange; //导入依赖的package包/类
@Test
public void testSkipNonSkippable() {
PositionedByteRange buff = new SimplePositionedMutableByteRange(12);
for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
for (byte[] term : TERMINATORS) {
for (byte[] val : VALUES_BYTES) {
buff.setPosition(0);
DataType<byte[]> type = new TerminatedWrapper<>(new RawBytes(ord), term);
int expected = type.encode(buff, val);
buff.setPosition(0);
assertEquals(expected, type.skip(buff));
assertEquals(expected, buff.getPosition());
}
}
}
}
开发者ID:apache,项目名称:hbase,代码行数:17,代码来源:TestTerminatedWrapper.java
示例12: testReadWrite
import org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange; //导入依赖的package包/类
@Test
public void testReadWrite() {
for (int limit : limits) {
PositionedByteRange buff = new SimplePositionedMutableByteRange(limit);
for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
for (byte[] val : VALUES) {
buff.setPosition(0);
DataType<byte[]> type = new FixedLengthWrapper<>(new RawBytes(ord), limit);
assertEquals(limit, type.encode(buff, val));
buff.setPosition(0);
byte[] actual = type.decode(buff);
assertTrue("Decoding output differs from expected",
Bytes.equals(val, 0, val.length, actual, 0, val.length));
buff.setPosition(0);
assertEquals(limit, type.skip(buff));
}
}
}
}
开发者ID:apache,项目名称:hbase,代码行数:20,代码来源:TestFixedLengthWrapper.java
示例13: serdeKeyData
import org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange; //导入依赖的package包/类
@Test
public void serdeKeyData() throws Exception {
SQLTinyint value1 = new SQLTinyint(Byte.valueOf("1"));
SQLTinyint value2 = new SQLTinyint(Byte.valueOf("2"));
SQLTinyint value1a = new SQLTinyint();
SQLTinyint value2a = new SQLTinyint();
PositionedByteRange range1 = new SimplePositionedMutableByteRange(value1.encodedKeyLength());
PositionedByteRange range2 = new SimplePositionedMutableByteRange(value2.encodedKeyLength());
value1.encodeIntoKey(range1, Order.ASCENDING);
value2.encodeIntoKey(range2, Order.ASCENDING);
Assert.assertTrue("Positioning is Incorrect", Bytes.compareTo(range1.getBytes(), 0, 9, range2.getBytes(), 0, 9) < 0);
range1.setPosition(0);
range2.setPosition(0);
value1a.decodeFromKey(range1);
value2a.decodeFromKey(range2);
Assert.assertEquals("1 incorrect",value1.getByte(),value1a.getByte());
Assert.assertEquals("2 incorrect",value2.getByte(),value2a.getByte());
}
开发者ID:splicemachine,项目名称:spliceengine,代码行数:19,代码来源:SQLTinyIntTest.java
示例14: serdeKeyData
import org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange; //导入依赖的package包/类
@Test
public void serdeKeyData() throws Exception {
SQLDouble value1 = new SQLDouble(100.0d);
SQLDouble value2 = new SQLDouble(200.0d);
SQLDouble value1a = new SQLDouble();
SQLDouble value2a = new SQLDouble();
PositionedByteRange range1 = new SimplePositionedMutableByteRange(value1.encodedKeyLength());
PositionedByteRange range2 = new SimplePositionedMutableByteRange(value2.encodedKeyLength());
value1.encodeIntoKey(range1, Order.ASCENDING);
value2.encodeIntoKey(range2, Order.ASCENDING);
Assert.assertTrue("Positioning is Incorrect", Bytes.compareTo(range1.getBytes(), 0, 9, range2.getBytes(), 0, 9) < 0);
range1.setPosition(0);
range2.setPosition(0);
value1a.decodeFromKey(range1);
value2a.decodeFromKey(range2);
Assert.assertEquals("1 incorrect",value1.getDouble(),value1a.getDouble(),0.0d);
Assert.assertEquals("2 incorrect",value2.getDouble(),value2a.getDouble(),0.0d);
}
开发者ID:splicemachine,项目名称:spliceengine,代码行数:19,代码来源:SQLDoubleTest.java
示例15: serdeKeyData
import org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange; //导入依赖的package包/类
@Test
@Ignore
public void serdeKeyData() throws Exception {
SQLDecimal value1 = new SQLDecimal(new BigDecimal(100.0d));
SQLDecimal value2 = new SQLDecimal(new BigDecimal(200.0d));
SQLDecimal value1a = new SQLDecimal();
value1a.setPrecision(value1.getPrecision());
value1a.setScale(value1.getScale());
SQLDecimal value2a = new SQLDecimal();
value2a.setPrecision(value2.getPrecision());
value2a.setScale(value2.getScale());
PositionedByteRange range1 = new SimplePositionedMutableByteRange(value1.encodedKeyLength());
PositionedByteRange range2 = new SimplePositionedMutableByteRange(value2.encodedKeyLength());
value1.encodeIntoKey(range1, Order.ASCENDING);
value2.encodeIntoKey(range2, Order.ASCENDING);
Assert.assertTrue("Positioning is Incorrect", Bytes.compareTo(range1.getBytes(), 0, 9, range2.getBytes(), 0, 9) < 0);
range1.setPosition(0);
range2.setPosition(0);
value1a.decodeFromKey(range1);
value2a.decodeFromKey(range2);
Assert.assertEquals("1 incorrect",value1.getBigDecimal().doubleValue(),value1a.getBigDecimal().doubleValue(),0.1d);
Assert.assertEquals("2 incorrect",value2.getBigDecimal().doubleValue(),value2a.getBigDecimal().doubleValue(),0.1d);
}
开发者ID:splicemachine,项目名称:spliceengine,代码行数:24,代码来源:SQLDecimalTest.java
示例16: serdeKeyData
import org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange; //导入依赖的package包/类
@Test
public void serdeKeyData() throws Exception {
SQLLongint value1 = new SQLLongint(100l);
SQLLongint value2 = new SQLLongint(200l);
SQLLongint value1a = new SQLLongint();
SQLLongint value2a = new SQLLongint();
PositionedByteRange range1 = new SimplePositionedMutableByteRange(value1.encodedKeyLength());
PositionedByteRange range2 = new SimplePositionedMutableByteRange(value2.encodedKeyLength());
value1.encodeIntoKey(range1, Order.ASCENDING);
value2.encodeIntoKey(range2, Order.ASCENDING);
Assert.assertTrue("Positioning is Incorrect", Bytes.compareTo(range1.getBytes(), 0, 9, range2.getBytes(), 0, 9) < 0);
range1.setPosition(0);
range2.setPosition(0);
value1a.decodeFromKey(range1);
value2a.decodeFromKey(range2);
Assert.assertEquals("1 incorrect",value1.getLong(),value1a.getLong(),0l);
Assert.assertEquals("2 incorrect",value2.getLong(),value2a.getLong(),0l);
}
开发者ID:splicemachine,项目名称:spliceengine,代码行数:19,代码来源:SQLLongIntTest.java
示例17: serdeKeyData
import org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange; //导入依赖的package包/类
@Test
public void serdeKeyData() throws Exception {
SQLSmallint value1 = new SQLSmallint(100);
SQLSmallint value2 = new SQLSmallint(200);
SQLSmallint value1a = new SQLSmallint();
SQLSmallint value2a = new SQLSmallint();
PositionedByteRange range1 = new SimplePositionedMutableByteRange(value1.encodedKeyLength());
PositionedByteRange range2 = new SimplePositionedMutableByteRange(value2.encodedKeyLength());
value1.encodeIntoKey(range1, Order.ASCENDING);
value2.encodeIntoKey(range2, Order.ASCENDING);
Assert.assertTrue("Positioning is Incorrect", Bytes.compareTo(range1.getBytes(), 0, 9, range2.getBytes(), 0, 9) < 0);
range1.setPosition(0);
range2.setPosition(0);
value1a.decodeFromKey(range1);
value2a.decodeFromKey(range2);
Assert.assertEquals("1 incorrect",value1.getInt(),value1a.getInt(),0);
Assert.assertEquals("2 incorrect",value2.getInt(),value2a.getInt(),0);
}
开发者ID:splicemachine,项目名称:spliceengine,代码行数:19,代码来源:SQLSmallIntTest.java
示例18: serdeKeyData
import org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange; //导入依赖的package包/类
@Test
public void serdeKeyData() throws Exception {
SQLChar value1 = new SQLChar("Splice Machine");
SQLChar value2 = new SQLChar("Xplice Machine");
SQLChar value1a = new SQLChar();
SQLChar value2a = new SQLChar();
PositionedByteRange range1 = new SimplePositionedMutableByteRange(value1.encodedKeyLength());
PositionedByteRange range2 = new SimplePositionedMutableByteRange(value2.encodedKeyLength());
value1.encodeIntoKey(range1, Order.ASCENDING);
value2.encodeIntoKey(range2, Order.ASCENDING);
Assert.assertTrue("Positioning is Incorrect", Bytes.compareTo(range1.getBytes(), 0, 9, range2.getBytes(), 0, 9) < 0);
range1.setPosition(0);
range2.setPosition(0);
value1a.decodeFromKey(range1);
value2a.decodeFromKey(range2);
Assert.assertEquals("1 incorrect",value1.getString(),value1a.getString());
Assert.assertEquals("2 incorrect",value2.getString(),value2a.getString());
}
开发者ID:splicemachine,项目名称:spliceengine,代码行数:19,代码来源:SQLVarcharTest.java
示例19: serdeKeyData
import org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange; //导入依赖的package包/类
@Test
public void serdeKeyData() throws Exception {
GregorianCalendar gc = new GregorianCalendar();
long currentTimeMillis = System.currentTimeMillis();
SQLTimestamp value1 = new SQLTimestamp(new Timestamp(currentTimeMillis));
SQLTimestamp value2 = new SQLTimestamp(new Timestamp(currentTimeMillis+200));
SQLTimestamp value1a = new SQLTimestamp();
SQLTimestamp value2a = new SQLTimestamp();
PositionedByteRange range1 = new SimplePositionedMutableByteRange(value1.encodedKeyLength());
PositionedByteRange range2 = new SimplePositionedMutableByteRange(value2.encodedKeyLength());
value1.encodeIntoKey(range1, Order.ASCENDING);
value2.encodeIntoKey(range2, Order.ASCENDING);
range1.setPosition(0);
range2.setPosition(0);
value1a.decodeFromKey(range1);
value2a.decodeFromKey(range2);
Assert.assertEquals("1 incorrect",value1.getTimestamp(gc),value1a.getTimestamp(gc));
Assert.assertEquals("2 incorrect",value2.getTimestamp(gc),value2a.getTimestamp(gc));
}
开发者ID:splicemachine,项目名称:spliceengine,代码行数:20,代码来源:SQLTimestampTest.java
示例20: serdeKeyData
import org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange; //导入依赖的package包/类
@Test
public void serdeKeyData() throws Exception {
GregorianCalendar gc = new GregorianCalendar();
long currentTimeMillis = System.currentTimeMillis();
SQLTime value1 = new SQLTime(new Time(currentTimeMillis));
SQLTime value2 = new SQLTime(new Time(currentTimeMillis+200));
SQLTime value1a = new SQLTime();
SQLTime value2a = new SQLTime();
PositionedByteRange range1 = new SimplePositionedMutableByteRange(value1.encodedKeyLength());
PositionedByteRange range2 = new SimplePositionedMutableByteRange(value2.encodedKeyLength());
value1.encodeIntoKey(range1, Order.ASCENDING);
value2.encodeIntoKey(range2, Order.ASCENDING);
range1.setPosition(0);
range2.setPosition(0);
value1a.decodeFromKey(range1);
value2a.decodeFromKey(range2);
Assert.assertEquals("1 incorrect",value1.getTime(gc),value1a.getTime(gc));
Assert.assertEquals("2 incorrect",value2.getTime(gc),value2a.getTime(gc));
}
开发者ID:splicemachine,项目名称:spliceengine,代码行数:20,代码来源:SQLTimeTest.java
注:本文中的org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论