本文整理汇总了Java中org.apache.hadoop.hbase.index.Constants.IDX_COL_QUAL属性的典型用法代码示例。如果您正苦于以下问题:Java Constants.IDX_COL_QUAL属性的具体用法?Java Constants.IDX_COL_QUAL怎么用?Java Constants.IDX_COL_QUAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.hadoop.hbase.index.Constants
的用法示例。
在下文中一共展示了Constants.IDX_COL_QUAL属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: genSomeKeys
private List<KeyValue> genSomeKeys(String userTableName) throws Exception {
List<KeyValue> ret = new ArrayList<KeyValue>(4);
HTableDescriptor ihtd = new HTableDescriptor(TableName.valueOf(userTableName));
HColumnDescriptor hcd1 = new HColumnDescriptor("column1");
HColumnDescriptor hcd2 = new HColumnDescriptor("column2");
IndexSpecification iSpec1 = new IndexSpecification("Index");
iSpec1.addIndexColumn(hcd1, "q", ValueType.String, 10);
iSpec1.addIndexColumn(hcd2, "q", ValueType.String, 10);
ihtd.addFamily(hcd1);
ihtd.addFamily(hcd2);
TableIndices indices = new TableIndices();
indices.addIndex(iSpec1);
ihtd.setValue(Constants.INDEX_SPEC_KEY, indices.toByteArray());
admin.createTable(ihtd);
ByteArrayBuilder indexColVal = ByteArrayBuilder.allocate(4);
indexColVal.put(Bytes.toBytes((short) 3));
indexColVal.put(Bytes.toBytes((short) 32));
Put p1 = generatePuts("006".getBytes(), "05".getBytes());
Put p2 = generatePuts("003".getBytes(), "06".getBytes());
Put p3 = generatePuts("004".getBytes(), "06".getBytes());
Put p4 = generatePuts("007".getBytes(), "06".getBytes());
byte[] seekToPut =
new byte[3 + 1 + IndexUtils.getMaxIndexNameLength() + 10 + "006".getBytes().length];
System.arraycopy(p1.getRow(), 0, seekToPut, 0, p1.getRow().length);
byte[] seekToRow = "007".getBytes();
System.arraycopy(seekToRow, 0, seekToPut, p1.getRow().length - 3, seekToRow.length);
System.arraycopy("005".getBytes(), 0, seekToPut, 0, 3);
setSeekToRowKey(seekToPut, indexColVal);
byte[] expectedPut =
new byte[3 + 1 + IndexUtils.getMaxIndexNameLength() + 10 + "006".getBytes().length];
System.arraycopy(p4.getRow(), 0, expectedPut, 0, p4.getRow().length);
// Copy first 3 bytes to splitKey since getKeyValue will replace the start key with splitKey.
// Just for assertion this is been added
System.arraycopy("005".getBytes(), 0, expectedPut, 0, 3);
setExpected(expectedPut);
KeyValue kv =
new KeyValue(p1.getRow(), Constants.IDX_COL_FAMILY, Constants.IDX_COL_QUAL, 0,
indexColVal.array());
ret.add(kv);
KeyValue kv1 =
new KeyValue(p2.getRow(), Constants.IDX_COL_FAMILY, Constants.IDX_COL_QUAL, 0,
indexColVal.array());
ret.add(kv1);
KeyValue kv2 =
new KeyValue(p3.getRow(), Constants.IDX_COL_FAMILY, Constants.IDX_COL_QUAL, 0,
indexColVal.array());
ret.add(kv2);
KeyValue kv3 =
new KeyValue(p4.getRow(), Constants.IDX_COL_FAMILY, Constants.IDX_COL_QUAL, 0,
indexColVal.array());
ret.add(kv3);
return ret;
}
示例2: setSeekToRowKey
private void setSeekToRowKey(byte[] seekTorowKey3, ByteArrayBuilder indexColVal) {
KeyValue kv =
new KeyValue(seekTorowKey3, Constants.IDX_COL_FAMILY, Constants.IDX_COL_QUAL, 0,
indexColVal.array());
this.seekToKeyVal = kv;
}
示例3: genSomeKeys
private List<KeyValue> genSomeKeys(String userTableName) throws Exception {
List<KeyValue> ret = new ArrayList<KeyValue>(4);
HBaseAdmin admin = UTIL.getHBaseAdmin();
ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(UTIL);
IndexedHTableDescriptor ihtd = new IndexedHTableDescriptor(userTableName);
HColumnDescriptor hcd1 = new HColumnDescriptor("column1");
HColumnDescriptor hcd2 = new HColumnDescriptor("column2");
IndexSpecification iSpec1 = new IndexSpecification("Index");
iSpec1.addIndexColumn(hcd1, "q", ValueType.String, 10);
iSpec1.addIndexColumn(hcd2, "q", ValueType.String, 10);
ihtd.addFamily(hcd1);
ihtd.addFamily(hcd2);
ihtd.addIndex(iSpec1);
admin.createTable(ihtd);
ZKAssign.blockUntilNoRIT(zkw);
ByteArrayBuilder indexColVal = ByteArrayBuilder.allocate(4);
indexColVal.put(Bytes.toBytes((short) 3));
indexColVal.put(Bytes.toBytes((short) 32));
Put p1 = generatePuts("006".getBytes(), "05".getBytes());
Put p2 = generatePuts("003".getBytes(), "06".getBytes());
Put p3 = generatePuts("004".getBytes(), "06".getBytes());
Put p4 = generatePuts("007".getBytes(), "06".getBytes());
byte[] seekToPut =
new byte[3 + 1 + IndexUtils.getMaxIndexNameLength() + 10 + "006".getBytes().length];
System.arraycopy(p1.getRow(), 0, seekToPut, 0, p1.getRow().length);
byte[] seekToRow = "007".getBytes();
System.arraycopy(seekToRow, 0, seekToPut, p1.getRow().length - 3, seekToRow.length);
System.arraycopy("005".getBytes(), 0, seekToPut, 0, 3);
setSeekToRowKey(seekToPut, indexColVal);
byte[] expectedPut =
new byte[3 + 1 + IndexUtils.getMaxIndexNameLength() + 10 + "006".getBytes().length];
System.arraycopy(p4.getRow(), 0, expectedPut, 0, p4.getRow().length);
// Copy first 3 bytes to splitKey since getKeyValue will replace the start key with splitKey.
// Just for assertion this is been added
System.arraycopy("005".getBytes(), 0, expectedPut, 0, 3);
setExpected(expectedPut);
KeyValue kv =
new KeyValue(p1.getRow(), Constants.IDX_COL_FAMILY, Constants.IDX_COL_QUAL, 0,
indexColVal.array());
ret.add(kv);
KeyValue kv1 =
new KeyValue(p2.getRow(), Constants.IDX_COL_FAMILY, Constants.IDX_COL_QUAL, 0,
indexColVal.array());
ret.add(kv1);
KeyValue kv2 =
new KeyValue(p3.getRow(), Constants.IDX_COL_FAMILY, Constants.IDX_COL_QUAL, 0,
indexColVal.array());
ret.add(kv2);
KeyValue kv3 =
new KeyValue(p4.getRow(), Constants.IDX_COL_FAMILY, Constants.IDX_COL_QUAL, 0,
indexColVal.array());
ret.add(kv3);
return ret;
}