本文整理汇总了Java中org.apache.hadoop.hbase.KeyValue.makeColumn方法的典型用法代码示例。如果您正苦于以下问题:Java KeyValue.makeColumn方法的具体用法?Java KeyValue.makeColumn怎么用?Java KeyValue.makeColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.KeyValue
的用法示例。
在下文中一共展示了KeyValue.makeColumn方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractKeyValues
import org.apache.hadoop.hbase.KeyValue; //导入方法依赖的package包/类
/**
* Extract columns values from the current record. This method returns
* null if any of the columns are not found.
*
* Override this method if you want to deal with nulls differently.
*
* @param r
* @return array of byte values
*/
protected byte[][] extractKeyValues(Result r) {
byte[][] keyVals = null;
ArrayList<byte[]> foundList = new ArrayList<byte[]>();
int numCols = columns.length;
if (numCols > 0) {
for (Cell value: r.listCells()) {
byte [] column = KeyValue.makeColumn(CellUtil.cloneFamily(value),
CellUtil.cloneQualifier(value));
for (int i = 0; i < numCols; i++) {
if (Bytes.equals(column, columns[i])) {
foundList.add(CellUtil.cloneValue(value));
break;
}
}
}
if(foundList.size() == numCols) {
keyVals = foundList.toArray(new byte[numCols][]);
}
}
return keyVals;
}
示例2: extractKeyValues
import org.apache.hadoop.hbase.KeyValue; //导入方法依赖的package包/类
/**
* Extract columns values from the current record. This method returns
* null if any of the columns are not found.
* <p>
* Override this method if you want to deal with nulls differently.
*
* @param r The current values.
* @return Array of byte values.
*/
protected byte[][] extractKeyValues(Result r) {
byte[][] keyVals = null;
ArrayList<byte[]> foundList = new ArrayList<byte[]>();
int numCols = columns.length;
if (numCols > 0) {
for (Cell value: r.listCells()) {
byte [] column = KeyValue.makeColumn(CellUtil.cloneFamily(value),
CellUtil.cloneQualifier(value));
for (int i = 0; i < numCols; i++) {
if (Bytes.equals(column, columns[i])) {
foundList.add(CellUtil.cloneValue(value));
break;
}
}
}
if(foundList.size() == numCols) {
keyVals = foundList.toArray(new byte[numCols][]);
}
}
return keyVals;
}
示例3: fromFilter
import org.apache.hadoop.hbase.KeyValue; //导入方法依赖的package包/类
public static Range[] fromFilter(SingleColumnValueFilter filter) {
if (!(filter.getComparator() instanceof BinaryComparator)) {
return new Range[0];
}
byte[] column = KeyValue.makeColumn(filter.getFamily(), filter.getQualifier());
CompareOp compareOp = filter.getOperator();
byte[] value = filter.getComparator().getValue();
if (compareOp == CompareOp.NOT_EQUAL) {
return new Range[] { new Range(column, null, CompareOp.NO_OP, value, CompareOp.LESS),
new Range(column, value, CompareOp.GREATER, null, CompareOp.NO_OP) };
} else {
switch (compareOp) {
case EQUAL:
case GREATER_OR_EQUAL:
case GREATER:
return new Range[] { new Range(column, value, compareOp, null, CompareOp.NO_OP) };
case LESS:
case LESS_OR_EQUAL:
return new Range[] { new Range(column, null, CompareOp.NO_OP, value, compareOp) };
default:
return new Range[0];
}
}
}
示例4: printLine
import org.apache.hadoop.hbase.KeyValue; //导入方法依赖的package包/类
private static void printLine(Result r, Map<byte[], DataType> columnInfoMap) {
StringBuilder sb = new StringBuilder();
sb.append("row=" + Bytes.toString(r.getRow()));
byte[] tmp = null;
for (KeyValue kv : r.list()) {
tmp = KeyValue.makeColumn(kv.getFamily(), kv.getQualifier());
sb.append("," + Bytes.toString(tmp) + "=");
if (columnInfoMap == null || columnInfoMap.isEmpty()) {
sb.append(Bytes.toString(kv.getValue()));
} else {
switch (columnInfoMap.get(tmp)) {
case DOUBLE:
sb.append(Bytes.toDouble(kv.getValue()));
break;
case LONG:
sb.append(Bytes.toLong(kv.getValue()));
break;
case INT:
sb.append(Bytes.toInt(kv.getValue()));
break;
case STRING:
sb.append(Bytes.toString(kv.getValue()));
break;
default:
sb.append(Bytes.toString(kv.getValue()));
break;
}
}
}
System.out.println(sb.toString());
}
示例5: CellModel
import org.apache.hadoop.hbase.KeyValue; //导入方法依赖的package包/类
/**
* Constructor
* @param column
* @param qualifier
* @param timestamp
* @param value
*/
public CellModel(byte[] column, byte[] qualifier, long timestamp,
byte[] value) {
this.column = KeyValue.makeColumn(column, qualifier);
this.timestamp = timestamp;
this.value = value;
}