本文整理汇总了Java中org.apache.hadoop.hbase.util.OrderedBytes类的典型用法代码示例。如果您正苦于以下问题:Java OrderedBytes类的具体用法?Java OrderedBytes怎么用?Java OrderedBytes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OrderedBytes类属于org.apache.hadoop.hbase.util包,在下文中一共展示了OrderedBytes类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: deserialize
import org.apache.hadoop.hbase.util.OrderedBytes; //导入依赖的package包/类
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);
}
开发者ID:rayokota,项目名称:hgraphdb,代码行数:17,代码来源:IndexMetadataModel.java
示例2: generateHBaseDatasetDoubleOB
import org.apache.hadoop.hbase.util.OrderedBytes; //导入依赖的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
示例3: generateHBaseDatasetFloatOB
import org.apache.hadoop.hbase.util.OrderedBytes; //导入依赖的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
示例4: generateHBaseDatasetBigIntOB
import org.apache.hadoop.hbase.util.OrderedBytes; //导入依赖的package包/类
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);
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:31,代码来源:TestTableGenerator.java
示例5: generateHBaseDatasetIntOB
import org.apache.hadoop.hbase.util.OrderedBytes; //导入依赖的package包/类
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);
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:31,代码来源:TestTableGenerator.java
示例6: generateHBaseDatasetDoubleOBDesc
import org.apache.hadoop.hbase.util.OrderedBytes; //导入依赖的package包/类
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);
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:31,代码来源:TestTableGenerator.java
示例7: generateHBaseDatasetFloatOBDesc
import org.apache.hadoop.hbase.util.OrderedBytes; //导入依赖的package包/类
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);
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:31,代码来源:TestTableGenerator.java
示例8: generateHBaseDatasetBigIntOBDesc
import org.apache.hadoop.hbase.util.OrderedBytes; //导入依赖的package包/类
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);
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:31,代码来源:TestTableGenerator.java
示例9: generateHBaseDatasetIntOBDesc
import org.apache.hadoop.hbase.util.OrderedBytes; //导入依赖的package包/类
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);
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:31,代码来源:TestTableGenerator.java
示例10: decode
import org.apache.hadoop.hbase.util.OrderedBytes; //导入依赖的package包/类
@Override
public Number decode(PositionedByteRange src) {
if (OrderedBytes.isNumericInfinite(src) || OrderedBytes.isNumericNaN(src)) {
return OrderedBytes.decodeNumericAsDouble(src);
}
return OrderedBytes.decodeNumericAsBigDecimal(src);
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:8,代码来源:OrderedNumeric.java
示例11: encode
import org.apache.hadoop.hbase.util.OrderedBytes; //导入依赖的package包/类
@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);
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:16,代码来源:OrderedNumeric.java
示例12: serialize
import org.apache.hadoop.hbase.util.OrderedBytes; //导入依赖的package包/类
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;
}
开发者ID:rayokota,项目名称:hgraphdb,代码行数:12,代码来源:LabelConnectionModel.java
示例13: deserialize
import org.apache.hadoop.hbase.util.OrderedBytes; //导入依赖的package包/类
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);
}
开发者ID:rayokota,项目名称:hgraphdb,代码行数:11,代码来源:LabelConnectionModel.java
示例14: serialize
import org.apache.hadoop.hbase.util.OrderedBytes; //导入依赖的package包/类
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;
}
开发者ID:rayokota,项目名称:hgraphdb,代码行数:12,代码来源:IndexMetadataModel.java
示例15: encode
import org.apache.hadoop.hbase.util.OrderedBytes; //导入依赖的package包/类
@Override
public int encode(PositionedByteRange dst, Integer val) {
if (null == val) {
throw new IllegalArgumentException("Null values not supported.");
}
return OrderedBytes.encodeInt32(dst, val, order);
}
开发者ID:apache,项目名称:hbase,代码行数:8,代码来源:OrderedInt32.java
示例16: encode
import org.apache.hadoop.hbase.util.OrderedBytes; //导入依赖的package包/类
@Override
public int encode(PositionedByteRange dst, Float val) {
if (null == val) {
throw new IllegalArgumentException("Null values not supported.");
}
return OrderedBytes.encodeFloat32(dst, val, order);
}
开发者ID:apache,项目名称:hbase,代码行数:8,代码来源:OrderedFloat32.java
示例17: encode
import org.apache.hadoop.hbase.util.OrderedBytes; //导入依赖的package包/类
@Override
public int encode(PositionedByteRange dst, Long val) {
if (null == val) {
throw new IllegalArgumentException("Null values not supported.");
}
return OrderedBytes.encodeInt64(dst, val, order);
}
开发者ID:apache,项目名称:hbase,代码行数:8,代码来源:OrderedInt64.java
示例18: encode
import org.apache.hadoop.hbase.util.OrderedBytes; //导入依赖的package包/类
@Override
public int encode(PositionedByteRange dst, Short val) {
if (null == val) {
throw new IllegalArgumentException("Null values not supported.");
}
return OrderedBytes.encodeInt16(dst, val, order);
}
开发者ID:apache,项目名称:hbase,代码行数:8,代码来源:OrderedInt16.java
示例19: encode
import org.apache.hadoop.hbase.util.OrderedBytes; //导入依赖的package包/类
@Override
public int encode(PositionedByteRange dst, Double val) {
if (null == val) {
throw new IllegalArgumentException("Null values not supported.");
}
return OrderedBytes.encodeFloat64(dst, val, order);
}
开发者ID:apache,项目名称:hbase,代码行数:8,代码来源:OrderedFloat64.java
示例20: encode
import org.apache.hadoop.hbase.util.OrderedBytes; //导入依赖的package包/类
@Override
public int encode(PositionedByteRange dst, Byte val) {
if (null == val) {
throw new IllegalArgumentException("Null values not supported.");
}
return OrderedBytes.encodeInt8(dst, val, order);
}
开发者ID:apache,项目名称:hbase,代码行数:8,代码来源:OrderedInt8.java
注:本文中的org.apache.hadoop.hbase.util.OrderedBytes类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论