Java 类org.apache.hadoop.hbase.util.OrderedBytes 实例源码

项目:hgraphdb    文件:IndexMetadataModel.java   
public IndexMetadata deserialize(Result result) {
    byte[] bytes = result.getRow();
    PositionedByteRange buffer = new SimplePositionedByteRange(bytes);
    String label = OrderedBytes.decodeString(buffer);
    String propertyKey = OrderedBytes.decodeString(buffer);
    ElementType type = OrderedBytes.decodeInt8(buffer) == 1 ? ElementType.VERTEX : ElementType.EDGE;
    Cell uniqueCell = result.getColumnLatestCell(Constants.DEFAULT_FAMILY_BYTES, Constants.UNIQUE_BYTES);
    boolean isUnique = ValueUtils.deserialize(CellUtil.cloneValue(uniqueCell));
    Cell stateCell = result.getColumnLatestCell(Constants.DEFAULT_FAMILY_BYTES, Constants.INDEX_STATE_BYTES);
    State state = State.valueOf(ValueUtils.deserialize(CellUtil.cloneValue(stateCell)));
    Cell createdAtCell = result.getColumnLatestCell(Constants.DEFAULT_FAMILY_BYTES, Constants.CREATED_AT_BYTES);
    Long createdAt = ValueUtils.deserialize(CellUtil.cloneValue(createdAtCell));
    Cell updatedAtCell = result.getColumnLatestCell(Constants.DEFAULT_FAMILY_BYTES, Constants.UPDATED_AT_BYTES);
    Long updatedAt = ValueUtils.deserialize(CellUtil.cloneValue(updatedAtCell));
    return new IndexMetadata(type, label, propertyKey, isUnique, state, createdAt, updatedAt);
}
项目:dremio-oss    文件:TestTableGenerator.java   
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);
}
项目:dremio-oss    文件:TestTableGenerator.java   
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);
}
项目:dremio-oss    文件:TestTableGenerator.java   
public static void generateHBaseDatasetBigIntOB(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.ASCENDING);
    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);
}
项目:dremio-oss    文件:TestTableGenerator.java   
public static void generateHBaseDatasetIntOB(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 (int i = -49; i <= 100; i ++) {
    byte[] bytes = new byte[5];
    PositionedByteRange br = new SimplePositionedMutableByteRange(bytes, 0, 5);
    OrderedBytes.encodeInt32(br, i, Order.ASCENDING);
    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);
}
项目:dremio-oss    文件:TestTableGenerator.java   
public static void generateHBaseDatasetDoubleOBDesc(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.DESCENDING);
    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);
}
项目:dremio-oss    文件:TestTableGenerator.java   
public static void generateHBaseDatasetFloatOBDesc(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.DESCENDING);
    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);
}
项目:dremio-oss    文件:TestTableGenerator.java   
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);
}
项目:dremio-oss    文件:TestTableGenerator.java   
public static void generateHBaseDatasetIntOBDesc(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 (int i = -49; i <= 100; i ++) {
    byte[] bytes = new byte[5];
    PositionedByteRange br = new SimplePositionedMutableByteRange(bytes, 0, 5);
    OrderedBytes.encodeInt32(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);
}
项目:ditb    文件:OrderedNumeric.java   
@Override
public Number decode(PositionedByteRange src) {
  if (OrderedBytes.isNumericInfinite(src) || OrderedBytes.isNumericNaN(src)) {
    return OrderedBytes.decodeNumericAsDouble(src);
  }
  return OrderedBytes.decodeNumericAsBigDecimal(src);
}
项目:ditb    文件:OrderedNumeric.java   
@Override
public int encode(PositionedByteRange dst, Number val) {
  if (null == val) {
    return OrderedBytes.encodeNull(dst, order);
  } else if (val instanceof BigDecimal) {
    return OrderedBytes.encodeNumeric(dst, (BigDecimal) val, order);
  } else if (val instanceof BigInteger) {
    return OrderedBytes.encodeNumeric(dst, new BigDecimal((BigInteger) val), order);
  } else if (val instanceof Double || val instanceof Float) {
    return OrderedBytes.encodeNumeric(dst, val.doubleValue(), order);
  } else {
    // TODO: other instances of Numeric to consider?
    return OrderedBytes.encodeNumeric(dst, val.longValue(), order);
  }
}
项目:hgraphdb    文件:LabelConnectionModel.java   
public byte[] serialize(String outVertexLabel, String edgeLabel, String inVertexLabel) {
    PositionedByteRange buffer = new SimplePositionedMutableByteRange(4096);
    OrderedBytes.encodeString(buffer, outVertexLabel, Order.ASCENDING);
    OrderedBytes.encodeString(buffer, edgeLabel, Order.ASCENDING);
    OrderedBytes.encodeString(buffer, inVertexLabel, Order.ASCENDING);
    buffer.setLength(buffer.getPosition());
    buffer.setPosition(0);
    byte[] bytes = new byte[buffer.getRemaining()];
    buffer.get(bytes);
    return bytes;
}
项目:hgraphdb    文件:LabelConnectionModel.java   
public LabelConnection deserialize(Result result) {
    byte[] bytes = result.getRow();
    PositionedByteRange buffer = new SimplePositionedByteRange(bytes);
    String outVertexLabel = OrderedBytes.decodeString(buffer);
    String edgeLabel = OrderedBytes.decodeString(buffer);
    String inVertexLabel = OrderedBytes.decodeString(buffer);
    Cell createdAtCell = result.getColumnLatestCell(Constants.DEFAULT_FAMILY_BYTES, Constants.CREATED_AT_BYTES);
    Long createdAt = ValueUtils.deserialize(CellUtil.cloneValue(createdAtCell));
    return new LabelConnection(outVertexLabel, edgeLabel, inVertexLabel, createdAt);
}
项目:hgraphdb    文件:IndexMetadataModel.java   
public byte[] serialize(IndexMetadata.Key index) {
    PositionedByteRange buffer = new SimplePositionedMutableByteRange(4096);
    OrderedBytes.encodeString(buffer, index.label(), Order.ASCENDING);
    OrderedBytes.encodeString(buffer, index.propertyKey(), Order.ASCENDING);
    OrderedBytes.encodeInt8(buffer, index.type() == ElementType.VERTEX ? (byte) 1 : (byte) 0, Order.ASCENDING);
    buffer.setLength(buffer.getPosition());
    buffer.setPosition(0);
    byte[] bytes = new byte[buffer.getRemaining()];
    buffer.get(bytes);
    return bytes;
}
项目:drill    文件:TestTableGenerator.java   
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);
}
项目:drill    文件:TestTableGenerator.java   
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);
}
项目:drill    文件:TestTableGenerator.java   
public static void generateHBaseDatasetBigIntOB(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.ASCENDING);
    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);
}
项目:drill    文件:TestTableGenerator.java   
public static void generateHBaseDatasetIntOB(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 (int i = -49; i <= 100; i ++) {
    byte[] bytes = new byte[5];
    PositionedByteRange br = new SimplePositionedMutableByteRange(bytes, 0, 5);
    OrderedBytes.encodeInt32(br, i, Order.ASCENDING);
    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);
}
项目:drill    文件:TestTableGenerator.java   
public static void generateHBaseDatasetDoubleOBDesc(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.DESCENDING);
    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);
}
项目:drill    文件:TestTableGenerator.java   
public static void generateHBaseDatasetFloatOBDesc(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.DESCENDING);
    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);
}
项目:drill    文件:TestTableGenerator.java   
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);
}
项目:drill    文件:TestTableGenerator.java   
public static void generateHBaseDatasetIntOBDesc(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 (int i = -49; i <= 100; i ++) {
    byte[] bytes = new byte[5];
    PositionedByteRange br = new SimplePositionedMutableByteRange(bytes, 0, 5);
    OrderedBytes.encodeInt32(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);
}
项目:pbase    文件:OrderedNumeric.java   
@Override
public Number decode(PositionedByteRange src) {
  if (OrderedBytes.isNumericInfinite(src) || OrderedBytes.isNumericNaN(src)) {
    return OrderedBytes.decodeNumericAsDouble(src);
  }
  return OrderedBytes.decodeNumericAsBigDecimal(src);
}
项目:pbase    文件:OrderedNumeric.java   
@Override
public int encode(PositionedByteRange dst, Number val) {
  if (null == val) {
    return OrderedBytes.encodeNull(dst, order);
  } else if (val instanceof BigDecimal) {
    return OrderedBytes.encodeNumeric(dst, (BigDecimal) val, order);
  } else if (val instanceof BigInteger) {
    return OrderedBytes.encodeNumeric(dst, new BigDecimal((BigInteger) val), order);
  } else if (val instanceof Double || val instanceof Float) {
    return OrderedBytes.encodeNumeric(dst, val.doubleValue(), order);
  } else {
    // TODO: other instances of Numeric to consider?
    return OrderedBytes.encodeNumeric(dst, val.longValue(), order);
  }
}
项目:HIndex    文件:OrderedNumeric.java   
@Override
public Number decode(PositionedByteRange src) {
  if (OrderedBytes.isNumericInfinite(src) || OrderedBytes.isNumericNaN(src)) {
    return OrderedBytes.decodeNumericAsDouble(src);
  }
  return OrderedBytes.decodeNumericAsBigDecimal(src);
}
项目:HIndex    文件:OrderedNumeric.java   
@Override
public int encode(PositionedByteRange dst, Number val) {
  if (null == val) {
    return OrderedBytes.encodeNull(dst, order);
  } else if (val instanceof BigDecimal) {
    return OrderedBytes.encodeNumeric(dst, (BigDecimal) val, order);
  } else if (val instanceof BigInteger) {
    return OrderedBytes.encodeNumeric(dst, new BigDecimal((BigInteger) val), order);
  } else if (val instanceof Double || val instanceof Float) {
    return OrderedBytes.encodeNumeric(dst, val.doubleValue(), order);
  } else {
    // TODO: other instances of Numeric to consider?
    return OrderedBytes.encodeNumeric(dst, val.longValue(), order);
  }
}
项目:hbase    文件:OrderedInt32.java   
@Override
public int encode(PositionedByteRange dst, Integer val) {
  if (null == val) {
    throw new IllegalArgumentException("Null values not supported.");
  }
  return OrderedBytes.encodeInt32(dst, val, order);
}
项目:hbase    文件:OrderedNumeric.java   
@Override
public Number decode(PositionedByteRange src) {
  if (OrderedBytes.isNumericInfinite(src) || OrderedBytes.isNumericNaN(src)) {
    return OrderedBytes.decodeNumericAsDouble(src);
  }
  return OrderedBytes.decodeNumericAsBigDecimal(src);
}
项目:hbase    文件:OrderedNumeric.java   
@Override
public int encode(PositionedByteRange dst, Number val) {
  if (null == val) {
    return OrderedBytes.encodeNull(dst, order);
  } else if (val instanceof BigDecimal) {
    return OrderedBytes.encodeNumeric(dst, (BigDecimal) val, order);
  } else if (val instanceof BigInteger) {
    return OrderedBytes.encodeNumeric(dst, new BigDecimal((BigInteger) val), order);
  } else if (val instanceof Double || val instanceof Float) {
    return OrderedBytes.encodeNumeric(dst, val.doubleValue(), order);
  } else {
    // TODO: other instances of Numeric to consider?
    return OrderedBytes.encodeNumeric(dst, val.longValue(), order);
  }
}
项目:hbase    文件:OrderedFloat32.java   
@Override
public int encode(PositionedByteRange dst, Float val) {
  if (null == val) {
    throw new IllegalArgumentException("Null values not supported.");
  }
  return OrderedBytes.encodeFloat32(dst, val, order);
}
项目:hbase    文件:OrderedInt64.java   
@Override
public int encode(PositionedByteRange dst, Long val) {
  if (null == val) {
    throw new IllegalArgumentException("Null values not supported.");
  }
  return OrderedBytes.encodeInt64(dst, val, order);
}
项目:hbase    文件:OrderedInt16.java   
@Override
public int encode(PositionedByteRange dst, Short val) {
  if (null == val) {
    throw new IllegalArgumentException("Null values not supported.");
  }
  return OrderedBytes.encodeInt16(dst, val, order);
}
项目:hbase    文件:OrderedFloat64.java   
@Override
public int encode(PositionedByteRange dst, Double val) {
  if (null == val) {
    throw new IllegalArgumentException("Null values not supported.");
  }
  return OrderedBytes.encodeFloat64(dst, val, order);
}
项目:hbase    文件:OrderedInt8.java   
@Override
public int encode(PositionedByteRange dst, Byte val) {
  if (null == val) {
    throw new IllegalArgumentException("Null values not supported.");
  }
  return OrderedBytes.encodeInt8(dst, val, order);
}
项目:PyroDB    文件:OrderedNumeric.java   
@Override
public Number decode(PositionedByteRange src) {
  if (OrderedBytes.isNumericInfinite(src) || OrderedBytes.isNumericNaN(src)) {
    return OrderedBytes.decodeNumericAsDouble(src);
  }
  return OrderedBytes.decodeNumericAsBigDecimal(src);
}
项目:PyroDB    文件:OrderedNumeric.java   
@Override
public int encode(PositionedByteRange dst, Number val) {
  if (null == val) {
    return OrderedBytes.encodeNull(dst, order);
  } else if (val instanceof BigDecimal) {
    return OrderedBytes.encodeNumeric(dst, (BigDecimal) val, order);
  } else if (val instanceof BigInteger) {
    return OrderedBytes.encodeNumeric(dst, new BigDecimal((BigInteger) val), order);
  } else if (val instanceof Double || val instanceof Float) {
    return OrderedBytes.encodeNumeric(dst, val.doubleValue(), order);
  } else {
    // TODO: other instances of Numeric to consider?
    return OrderedBytes.encodeNumeric(dst, val.longValue(), order);
  }
}
项目:c5    文件:OrderedNumeric.java   
@Override
public Number decode(PositionedByteRange src) {
  if (OrderedBytes.isNumericInfinite(src) || OrderedBytes.isNumericNaN(src)) {
    return OrderedBytes.decodeNumericAsDouble(src);
  }
  return OrderedBytes.decodeNumericAsBigDecimal(src);
}
项目:c5    文件:OrderedNumeric.java   
@Override
public int encode(PositionedByteRange dst, Number val) {
  if (null == val) {
    return OrderedBytes.encodeNull(dst, order);
  } else if (val instanceof BigDecimal) {
    return OrderedBytes.encodeNumeric(dst, (BigDecimal) val, order);
  } else if (val instanceof BigInteger) {
    return OrderedBytes.encodeNumeric(dst, new BigDecimal((BigInteger) val), order);
  } else if (val instanceof Double || val instanceof Float) {
    return OrderedBytes.encodeNumeric(dst, val.doubleValue(), order);
  } else {
    // TODO: other instances of Numeric to consider?
    return OrderedBytes.encodeNumeric(dst, val.longValue(), order);
  }
}
项目:ditb    文件:OrderedInt32.java   
@Override
public Integer decode(PositionedByteRange src) {
  return OrderedBytes.decodeInt32(src);
}
项目:ditb    文件:OrderedInt32.java   
@Override
public int encode(PositionedByteRange dst, Integer val) {
  if (null == val) throw new IllegalArgumentException("Null values not supported.");
  return OrderedBytes.encodeInt32(dst, val, order);
}