本文整理匯總了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;
}