Java Code Examples for org.apache.hadoop.hbase.util.Order#ASCENDING

The following examples show how to use org.apache.hadoop.hbase.util.Order#ASCENDING . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestOrderedNumeric.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Test
public void testEncodedBigIntegerLength() {
  final PositionedByteRange buffer = new SimplePositionedMutableByteRange(20);
  for (final DataType<Number> type : new OrderedNumeric[] { new OrderedNumeric(Order.ASCENDING),
    new OrderedNumeric(Order.DESCENDING) }) {
    for (final Number val : BIG_INTEGER_VALUES) {
      buffer.setPosition(0);
      type.encode(buffer, val);
      assertEquals("encodedLength does not match actual, " + val,
          buffer.getPosition(), type.encodedLength(val));
    }
  }
}
 
Example 2
Source File: TestOrderedInt16.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Test
public void testEncodedLength() {
  final PositionedByteRange buffer = new SimplePositionedMutableByteRange(20);
  for (final DataType<Short> type : new OrderedInt16[] { new OrderedInt16(Order.ASCENDING),
    new OrderedInt16(Order.DESCENDING) }) {
    for (final Short val : VALUES) {
      buffer.setPosition(0);
      type.encode(buffer, val);
      assertEquals("encodedLength does not match actual, " + val,
          buffer.getPosition(), type.encodedLength(val));
    }
  }
}
 
Example 3
Source File: TestOrderedInt16.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Test
public void testEncodedFloatLength() {
  final PositionedByteRange buffer = new SimplePositionedMutableByteRange(20);
  for (final OrderedInt16 type : new OrderedInt16[] { new OrderedInt16(Order.ASCENDING),
    new OrderedInt16(Order.DESCENDING) }) {
    for (final Short val : VALUES) {
      buffer.setPosition(0);
      type.encodeShort(buffer, val);
      assertEquals("encodedLength does not match actual, " + val,
          buffer.getPosition(), type.encodedLength(val));
    }
  }
}
 
Example 4
Source File: TestOrderedFloat64.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Test
public void testEncodedFloatLength() {
  final PositionedByteRange buffer = new SimplePositionedMutableByteRange(20);
  for (final OrderedFloat64 type : new OrderedFloat64[] { new OrderedFloat64(Order.ASCENDING),
    new OrderedFloat64(Order.DESCENDING) }) {
    for (final Double val : VALUES) {
      buffer.setPosition(0);
      type.encodeDouble(buffer, val);
      assertEquals("encodedLength does not match actual, " + val,
          buffer.getPosition(), type.encodedLength(val));
    }
  }
}
 
Example 5
Source File: TestOrderedInt32.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Test
public void testEncodedFloatLength() {
  final PositionedByteRange buffer = new SimplePositionedMutableByteRange(20);
  for (final OrderedInt32 type : new OrderedInt32[] { new OrderedInt32(Order.ASCENDING),
    new OrderedInt32(Order.DESCENDING) }) {
    for (final Integer val : VALUES) {
      buffer.setPosition(0);
      type.encodeInt(buffer, val);
      assertEquals("encodedLength does not match actual, " + val,
          buffer.getPosition(), type.encodedLength(val));
    }
  }
}
 
Example 6
Source File: TestOrderedBlob.java    From hbase with Apache License 2.0 5 votes vote down vote up
@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));
    }
  }
}
 
Example 7
Source File: TestOrderedInt32.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Test
public void testEncodedLength() {
  final PositionedByteRange buffer = new SimplePositionedMutableByteRange(20);
  for (final DataType<Integer> type : new OrderedInt32[] { new OrderedInt32(Order.ASCENDING),
    new OrderedInt32(Order.DESCENDING) }) {
    for (final Integer val : VALUES) {
      buffer.setPosition(0);
      type.encode(buffer, val);
      assertEquals(
          "encodedLength does not match actual, " + val,
          buffer.getPosition(), type.encodedLength(val));
    }
  }
}
 
Example 8
Source File: TestOrderedNumeric.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Test
public void testEncodedLength() {
  final PositionedByteRange buffer = new SimplePositionedMutableByteRange(20);
  for (final DataType<Number> type : new OrderedNumeric[] { new OrderedNumeric(Order.ASCENDING),
    new OrderedNumeric(Order.DESCENDING) }) {
    for (final Number val : DOUBLE_VALUES) {
      buffer.setPosition(0);
      type.encode(buffer, val);
      assertEquals("encodedLength does not match actual, " + val,
          buffer.getPosition(), type.encodedLength(val));
    }
  }
}
 
Example 9
Source File: TestOrderedInt64.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Test
public void testEncodeNoSupportForNull() {
  exception.expect(IllegalArgumentException.class);

  final DataType<Long> type = new OrderedInt64(Order.ASCENDING);

  type.encode(new SimplePositionedMutableByteRange(20), null);
}
 
Example 10
Source File: TestOrderedFloat32.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Test
public void testEncodedFloatLength() {
  final PositionedByteRange buffer = new SimplePositionedMutableByteRange(20);
  for (final OrderedFloat32 type : new OrderedFloat32[] { new OrderedFloat32(Order.ASCENDING),
    new OrderedFloat32(Order.DESCENDING) }) {
    for (final Float val : VALUES) {
      buffer.setPosition(0);
      type.encodeFloat(buffer, val);
      assertEquals("encodedLength does not match actual, " + val,
          buffer.getPosition(), type.encodedLength(val));
    }
  }
}
 
Example 11
Source File: TestOrderedInt64.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Test
public void testEncodedClassIsLong() {
  final DataType<Long> type = new OrderedInt64(Order.ASCENDING);

  assertEquals(Long.class, type.encodedClass());
}
 
Example 12
Source File: RawString.java    From hbase with Apache License 2.0 4 votes vote down vote up
/**
 * @deprecated since 3.0.0 and will be removed in 4.0.0
 */
@Deprecated
public RawString() {
  this.order = Order.ASCENDING;
}
 
Example 13
Source File: TestRawBytes.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Test
public void testGetOrderCorrectOrder() {
  final DataType<byte[]> type = new RawBytes(Order.ASCENDING);

  assertEquals(Order.ASCENDING, type.getOrder());
}
 
Example 14
Source File: TestRawString.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Test
public void testIsNullableIsFalse() {
  final DataType<String> type = new RawString(Order.ASCENDING);

  assertFalse(type.isNullable());
}
 
Example 15
Source File: RawBytes.java    From hbase with Apache License 2.0 4 votes vote down vote up
/**
 * @deprecated since 3.0.0 and will be removed in 4.0.0
 */
@Deprecated
public RawBytes() {
  this.order = Order.ASCENDING;
}
 
Example 16
Source File: TestOrderedString.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Test
public void testEncodedClassIsFloat() {
  final DataType<String> type = new OrderedString(Order.ASCENDING);

  assertEquals(String.class, type.encodedClass());
}
 
Example 17
Source File: RawBytesFixedLength.java    From hbase with Apache License 2.0 4 votes vote down vote up
/**
 * Create a {@code RawBytesFixedLength} of the specified {@code length}.
 */
public RawBytesFixedLength(int length) {
  super(new RawBytes(Order.ASCENDING), length);
}
 
Example 18
Source File: TestOrderedFloat64.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Test
public void testIsNullableIsFalse() {
  final DataType<Double> type = new OrderedFloat64(Order.ASCENDING);

  assertFalse(type.isNullable());
}
 
Example 19
Source File: PUnsignedLong.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public Order getOrder() {
  return Order.ASCENDING;
}
 
Example 20
Source File: RawStringTerminated.java    From hbase with Apache License 2.0 2 votes vote down vote up
/**
 * Create a {@code RawStringTerminated} using the specified terminator.
 * @throws IllegalArgumentException if {@code term} is {@code null} or empty.
 */
public RawStringTerminated(byte[] term) {
  super(new RawString(Order.ASCENDING), term);
}