Created
January 29, 2014 18:12
-
-
Save gtata/8693622 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Looks like the filter functionality is not working. Has that been implemented yet? I was trying to do the following operation but the filter was being ignored based on my results because my result was showing everything in my table and not filtering. Please advice. Thanks. | |
FilterList list = new FilterList(FilterList.Operator.MUST_PASS_ALL); | |
SingleColumnValueFilter filter1 = new SingleColumnValueFilter("myColFam".getBytes(), "myCol".getBytes(), CompareOp.EQUAL, Bytes.toBytes("myValue")); | |
list.addFilter(filter1); | |
scan.setFilter(list); | |
ResultScanner scanner = table.getScanner(scan); | |
List<String> rowKeyList = new ArrayList<String>(); | |
for (Result result : scanner) { | |
byte[] row = result.getRow(); | |
rowKeyList.add(Bytes.toString(row)); | |
String rowKey = Bytes.toString(row); | |
Get get = new Get(row); | |
get.addColumn("myColFam".getBytes(), "myCol".getBytes()); | |
KeyValue keyValue = table.get(get).getColumnLatest("myColFam".getBytes(), "myCol".getBytes()); | |
if (keyValue != null) { | |
byte[] byteValue = keyValue.getValue(); | |
String stringValue = Bytes.toString(byteValue); | |
logger.info(String.format("testHBaseData() :: RowKey = %s, Value = %s ", rowKey, stringValue)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks like the filter functionality is not working. Has that been implemented yet? I was trying to do the following operation but the filter was being ignored based on my results because my result was showing everything in my table and not filtering. Please advice. Thanks.
FilterList list = new FilterList(FilterList.Operator.MUST_PASS_ALL);
SingleColumnValueFilter filter1 = new SingleColumnValueFilter("myColFam".getBytes(), "myCol".getBytes(), CompareOp.EQUAL, Bytes.toBytes("myValue"));
list.addFilter(filter1);
scan.setFilter(list);
ResultScanner scanner = table.getScanner(scan);
List rowKeyList = new ArrayList();
for (Result result : scanner) {
byte[] row = result.getRow();
rowKeyList.add(Bytes.toString(row));
String rowKey = Bytes.toString(row);
Get get = new Get(row);
get.addColumn("myColFam".getBytes(), "myCol".getBytes());
KeyValue keyValue = table.get(get).getColumnLatest("myColFam".getBytes(), "myCol".getBytes());
if (keyValue != null) {
byte[] byteValue = keyValue.getValue();
String stringValue = Bytes.toString(byteValue);
logger.info(String.format("testHBaseData() :: RowKey = %s, Value = %s ", rowKey, stringValue));
}
}