Search in sources :

Example 51 with SimplePositionedMutableByteRange

use of org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange in project hbase by apache.

the class TestOrderedNumeric method testEncodedBigDecimalLength.

@Test
public void testEncodedBigDecimalLength() {
    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_DECIMAL_VALUES) {
            buffer.setPosition(0);
            type.encode(buffer, val);
            assertEquals("encodedLength does not match actual, " + val, buffer.getPosition(), type.encodedLength(val));
        }
    }
}
Also used : SimplePositionedMutableByteRange(org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange) PositionedByteRange(org.apache.hadoop.hbase.util.PositionedByteRange) Test(org.junit.Test)

Example 52 with SimplePositionedMutableByteRange

use of org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange in project hbase by apache.

the class TestOrderedNumeric method testEncodedNullLength.

@Test
public void testEncodedNullLength() {
    final PositionedByteRange buffer = new SimplePositionedMutableByteRange(20);
    final DataType<Number> type = new OrderedNumeric(Order.ASCENDING);
    buffer.setPosition(0);
    type.encode(buffer, null);
    type.encode(new SimplePositionedMutableByteRange(20), null);
    assertEquals("encodedLength does not match actual, " + null, buffer.getPosition(), type.encodedLength(null));
}
Also used : SimplePositionedMutableByteRange(org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange) PositionedByteRange(org.apache.hadoop.hbase.util.PositionedByteRange) Test(org.junit.Test)

Example 53 with SimplePositionedMutableByteRange

use of org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange in project hbase by apache.

the class TestOrderedNumeric method testEncodedDoubleLength.

@Test
public void testEncodedDoubleLength() {
    final PositionedByteRange buffer = new SimplePositionedMutableByteRange(20);
    for (final OrderedNumeric type : new OrderedNumeric[] { new OrderedNumeric(Order.ASCENDING), new OrderedNumeric(Order.DESCENDING) }) {
        for (final Double val : DOUBLE_VALUES) {
            buffer.setPosition(0);
            type.encodeDouble(buffer, val);
            assertEquals("encodedLength does not match actual, " + val, buffer.getPosition(), type.encodedLength(val));
        }
    }
}
Also used : SimplePositionedMutableByteRange(org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange) PositionedByteRange(org.apache.hadoop.hbase.util.PositionedByteRange) Test(org.junit.Test)

Example 54 with SimplePositionedMutableByteRange

use of org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange in project hbase by apache.

the class TestOrderedNumeric method testEncodedLongLength.

@Test
public void testEncodedLongLength() {
    final PositionedByteRange buffer = new SimplePositionedMutableByteRange(20);
    for (final OrderedNumeric type : new OrderedNumeric[] { new OrderedNumeric(Order.ASCENDING), new OrderedNumeric(Order.DESCENDING) }) {
        for (final Long val : LONG_VALUES) {
            buffer.setPosition(0);
            type.encodeLong(buffer, val);
            assertEquals("encodedLength does not match actual, " + val, buffer.getPosition(), type.encodedLength(val));
        }
    }
}
Also used : SimplePositionedMutableByteRange(org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange) PositionedByteRange(org.apache.hadoop.hbase.util.PositionedByteRange) Test(org.junit.Test)

Example 55 with SimplePositionedMutableByteRange

use of org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange in project hbase by apache.

the class TestRawBytes method testEncodedLength.

@Test
public void testEncodedLength() {
    final PositionedByteRange buffer = new SimplePositionedMutableByteRange(20);
    for (final DataType<byte[]> type : new RawBytes[] { new RawBytes(Order.ASCENDING), new RawBytes(Order.DESCENDING) }) {
        for (final byte[] val : VALUES) {
            buffer.setPosition(0);
            type.encode(buffer, val);
            assertEquals("encodedLength does not match actual, " + Arrays.toString(val), buffer.getPosition(), type.encodedLength(val));
        }
    }
}
Also used : SimplePositionedMutableByteRange(org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange) PositionedByteRange(org.apache.hadoop.hbase.util.PositionedByteRange) Test(org.junit.Test)

Aggregations

SimplePositionedMutableByteRange (org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange)72 PositionedByteRange (org.apache.hadoop.hbase.util.PositionedByteRange)61 Test (org.junit.Test)45 HColumnDescriptor (org.apache.hadoop.hbase.HColumnDescriptor)16 HTableDescriptor (org.apache.hadoop.hbase.HTableDescriptor)16 BufferedMutator (org.apache.hadoop.hbase.client.BufferedMutator)16 Put (org.apache.hadoop.hbase.client.Put)16 ByteBuf (io.netty.buffer.ByteBuf)6 FunctionCall (org.apache.drill.common.expression.FunctionCall)4 LogicalExpression (org.apache.drill.common.expression.LogicalExpression)4 SchemaPath (org.apache.drill.common.expression.SchemaPath)4 BooleanExpression (org.apache.drill.common.expression.ValueExpressions.BooleanExpression)4 DateExpression (org.apache.drill.common.expression.ValueExpressions.DateExpression)4 DoubleExpression (org.apache.drill.common.expression.ValueExpressions.DoubleExpression)4 FloatExpression (org.apache.drill.common.expression.ValueExpressions.FloatExpression)4 IntExpression (org.apache.drill.common.expression.ValueExpressions.IntExpression)4 LongExpression (org.apache.drill.common.expression.ValueExpressions.LongExpression)4 QuotedString (org.apache.drill.common.expression.ValueExpressions.QuotedString)4 TimeExpression (org.apache.drill.common.expression.ValueExpressions.TimeExpression)4 Order (org.apache.hadoop.hbase.util.Order)4