当前位置: 首页>>代码示例>>Java>>正文


Java Order类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.util.Order的典型用法代码示例。如果您正苦于以下问题:Java Order类的具体用法?Java Order怎么用?Java Order使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Order类属于org.apache.hadoop.hbase.util包,在下文中一共展示了Order类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testReadWriteNonSkippable

import org.apache.hadoop.hbase.util.Order; //导入依赖的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

示例2: testSkipNonSkippable

import org.apache.hadoop.hbase.util.Order; //导入依赖的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

示例3: testReadWrite

import org.apache.hadoop.hbase.util.Order; //导入依赖的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

示例4: testReadWrite

import org.apache.hadoop.hbase.util.Order; //导入依赖的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

示例5: getByteBuf

import org.apache.hadoop.hbase.util.Order; //导入依赖的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

示例6: testReadWriteNonSkippable

import org.apache.hadoop.hbase.util.Order; //导入依赖的package包/类
@Test
public void testReadWriteNonSkippable() {
  PositionedByteRange buff = new SimplePositionedByteRange(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:tenggyut,项目名称:HIndex,代码行数:17,代码来源:TestTerminatedWrapper.java

示例7: testSkipNonSkippable

import org.apache.hadoop.hbase.util.Order; //导入依赖的package包/类
@Test
public void testSkipNonSkippable() {
  PositionedByteRange buff = new SimplePositionedByteRange(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:tenggyut,项目名称:HIndex,代码行数:17,代码来源:TestTerminatedWrapper.java

示例8: testReadWrite

import org.apache.hadoop.hbase.util.Order; //导入依赖的package包/类
@Test
public void testReadWrite() {
  for (int limit : limits) {
    PositionedByteRange buff = new SimplePositionedByteRange(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:tenggyut,项目名称:HIndex,代码行数:20,代码来源:TestFixedLengthWrapper.java

示例9: testReadWrite

import org.apache.hadoop.hbase.util.Order; //导入依赖的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 SimplePositionedByteRange(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:tenggyut,项目名称:HIndex,代码行数:20,代码来源:TestRawString.java

示例10: testReadWrite

import org.apache.hadoop.hbase.util.Order; //导入依赖的package包/类
@Test
public void testReadWrite() {
  for (int limit : limits) {
    PositionedByteRange buff = new SimplePositionedByteRange(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));
        byte[] expected = Arrays.copyOf(val, limit);
        buff.setPosition(0);
        byte[] actual = type.decode(buff);
        assertArrayEquals(expected, actual);
        buff.setPosition(0);
        assertEquals(limit, type.skip(buff));
      }
    }
  }
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:20,代码来源:TestFixedLengthWrapper.java

示例11: testReadWriteNonSkippable

import org.apache.hadoop.hbase.util.Order; //导入依赖的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

示例12: testSkipNonSkippable

import org.apache.hadoop.hbase.util.Order; //导入依赖的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

示例13: testReadWrite

import org.apache.hadoop.hbase.util.Order; //导入依赖的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

示例14: generateHBaseDatasetDoubleOB

import org.apache.hadoop.hbase.util.Order; //导入依赖的package包/类
public static void generateHBaseDatasetDoubleOB(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);

  for (double i = 0.5; i <= 100.00; i += 0.75) {
    byte[] bytes = new byte[9];
    PositionedByteRange br = new SimplePositionedMutableByteRange(bytes, 0, 9);
    OrderedBytes.encodeFloat64(br, i, Order.ASCENDING);
    Put p = new Put(bytes);
    p.addColumn(FAMILY_F, COLUMN_C, String.format("value %03f", i).getBytes());
    table.mutate(p);
  }

  table.close();

  admin.flush(tableName);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:31,代码来源:TestTableGenerator.java

示例15: generateHBaseDatasetFloatOB

import org.apache.hadoop.hbase.util.Order; //导入依赖的package包/类
public static void generateHBaseDatasetFloatOB(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);

  for (float i = (float)0.5; i <= 100.00; i += 0.75) {
    byte[] bytes = new byte[5];
    PositionedByteRange br = new SimplePositionedMutableByteRange(bytes, 0, 5);
    OrderedBytes.encodeFloat32(br, i,Order.ASCENDING);
    Put p = new Put(bytes);
    p.addColumn(FAMILY_F, COLUMN_C, String.format("value %03f", i).getBytes());
    table.mutate(p);
  }

  table.close();

  admin.flush(tableName);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:31,代码来源:TestTableGenerator.java


注:本文中的org.apache.hadoop.hbase.util.Order类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。