本文整理汇总了Java中org.apache.hadoop.hbase.index.client.DataType.INT属性的典型用法代码示例。如果您正苦于以下问题:Java DataType.INT属性的具体用法?Java DataType.INT怎么用?Java DataType.INT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.hadoop.hbase.index.client.DataType
的用法示例。
在下文中一共展示了DataType.INT属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStringOfValueAndType
public static String getStringOfValueAndType(final DataType type, final byte[] data) {
if (data == null) return "null";
if (type == DataType.SHORT || type == DataType.INT) {
return String.valueOf(Bytes.toInt(data));
}
if (type == DataType.DOUBLE) {
return String.valueOf(Bytes.toDouble(data));
}
if (type == DataType.LONG) {
return String.valueOf(Bytes.toLong(data));
}
if (type == DataType.STRING) {
return Bytes.toString(data);
}
return "mWinterGetStringOfValueAndType type not supported!";
}
示例2: mWinterCalRangeKey
private byte[] mWinterCalRangeKey(byte[] qualifier, byte[] key) throws IOException {
if (key == null) {
return null;
}
// winter the column indicated the target column-family to scan!
DataType type = LCCIndexConstant.getType(lccIndexQualifierType, qualifier);
byte[] lccValue = null;
if (type == DataType.DOUBLE) {
lccValue = Bytes.toBytes(LCCIndexConstant.paddedStringDouble(Bytes.toDouble(key)));
} else if (type == DataType.INT) {
lccValue = Bytes.toBytes(LCCIndexConstant.paddedStringInt(Bytes.toInt(key)));
} else if (type == DataType.LONG) {
lccValue = Bytes.toBytes(LCCIndexConstant.paddedStringLong(Bytes.toLong(key)));
} else if (type == DataType.STRING) {
// lccValue = Bytes.toBytes(LCCIndexConstant.paddedStringString(Bytes.toString(key)));
lccValue = key;
} else {
throw new IOException("winter range generating new endkey not implemented yet: "
+ Bytes.toString(qualifier));
}
return lccValue;
}
示例3: parseType
private DataType parseType(String str) {
if ("boolean".equalsIgnoreCase(str)) return DataType.BOOLEAN;
if ("double".equalsIgnoreCase(str)) return DataType.DOUBLE;
if ("int".equalsIgnoreCase(str)) return DataType.INT;
if ("LONG".equalsIgnoreCase(str)) return DataType.LONG;
if ("short".equalsIgnoreCase(str)) return DataType.SHORT;
if ("string".equalsIgnoreCase(str)) return DataType.STRING;
return DataType.STRING;
}
示例4: initIRIndex
private void initIRIndex(HBaseAdmin admin) throws IOException {
System.out.println("start init IRIndex");
HTableDescriptor tableDesc = new HTableDescriptor(tableName);
IndexDescriptor index1 = new IndexDescriptor(Bytes.toBytes("A"), DataType.DOUBLE);
IndexDescriptor index2 = new IndexDescriptor(Bytes.toBytes("B"), DataType.INT);
IndexColumnDescriptor family = new IndexColumnDescriptor("f", 2);
family.addIndex(index1);
family.addIndex(index2);
tableDesc.addFamily(family);
admin.createTable(tableDesc);
}
示例5: initIRIndex
private void initIRIndex(HBaseAdmin admin) throws IOException {
System.out.println("start init IRIndex");
HTableDescriptor tableDesc = new HTableDescriptor(tableName);
IndexDescriptor index1 = new IndexDescriptor(Bytes.toBytes("A"), DataType.DOUBLE);
IndexDescriptor index2 = new IndexDescriptor(Bytes.toBytes("B"), DataType.INT);
IndexColumnDescriptor family = new IndexColumnDescriptor("f");
family.addIndex(index1);
family.addIndex(index2);
tableDesc.addFamily(family);
admin.createTable(tableDesc);
}
示例6: getDataType
private DataType getDataType(byte[] qualifier) {
if (Bytes.compareTo(qualifier, Bytes.toBytes("i")) == 0) return DataType.INT;
if (Bytes.compareTo(qualifier, Bytes.toBytes("d")) == 0) return DataType.DOUBLE;
if (Bytes.compareTo(qualifier, Bytes.toBytes("s")) == 0) return DataType.STRING;
return null;
}
示例7: IzpPutThroughputTest
public IzpPutThroughputTest() throws IOException {
Configuration conf = HBaseConfiguration.create();
HBaseAdmin admin = new HBaseAdmin(conf);
fs =new Path(filePath).getFileSystem(conf);
// if(admin.tableExists(tableName)){
// indexadmin.disableTable(tableName);
// indexadmin.deleteTable(tableName);
// }
if (!admin.tableExists(tableName)) {
HTableDescriptor tableDesc = new HTableDescriptor(tableName);
if (index == 1) {
IndexDescriptor index1 = new IndexDescriptor(Bytes.toBytes("f"), DataType.STRING);
IndexDescriptor index2 = new IndexDescriptor(Bytes.toBytes("h"), DataType.STRING);
IndexDescriptor index3 = new IndexDescriptor(Bytes.toBytes("a"), DataType.STRING);
IndexDescriptor index4 = new IndexDescriptor(Bytes.toBytes("y"), DataType.STRING);
IndexDescriptor index5 = new IndexDescriptor(Bytes.toBytes("r"), DataType.STRING);
IndexDescriptor index6 = new IndexDescriptor(Bytes.toBytes("g"), DataType.STRING);
IndexDescriptor index7 = new IndexDescriptor(Bytes.toBytes("p"), DataType.STRING);
IndexDescriptor index8 = new IndexDescriptor(Bytes.toBytes("o"), DataType.STRING);
IndexDescriptor index9 = new IndexDescriptor(Bytes.toBytes("s"), DataType.INT);
IndexColumnDescriptor family1 = new IndexColumnDescriptor("f");
family1.addIndex(index1);
family1.addIndex(index2);
family1.addIndex(index3);
family1.addIndex(index4);
family1.addIndex(index5);
family1.addIndex(index6);
family1.addIndex(index7);
family1.addIndex(index8);
family1.addIndex(index9);
HColumnDescriptor family2 = new HColumnDescriptor("q");
tableDesc.addFamily(family1);
tableDesc.addFamily(family2);
byte[][] splitkeys=new byte[regionNum][];
for(int i=0;i<regionNum;i++){
splitkeys[i]=Bytes.toBytes(String.format("%03d", i));
}
admin.createTable(tableDesc, splitkeys);
} else {
HColumnDescriptor family = new HColumnDescriptor("f");
tableDesc.addFamily(family);
admin.createTable(tableDesc, Bytes.toBytes("000"), Bytes.toBytes("099"), 101);
}
}
admin.close();
}