本文整理了Java中org.apache.hadoop.hbase.filter.Filter.filterAllRemaining()
方法的一些代码示例,展示了Filter.filterAllRemaining()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Filter.filterAllRemaining()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.filter.Filter
类名称:Filter
方法名:filterAllRemaining
[英]If this returns true, the scan will terminate. Concrete implementers can signal a failure condition in their code by throwing an IOException.
[中]如果返回true,则扫描将终止。具体的实现者可以通过抛出IOException在代码中发出失败条件的信号。
代码示例来源:origin: apache/hbase
@Override
public boolean filterAllRemaining() throws IOException {
return this.filterAllRemaining || this.filter.filterAllRemaining();
}
代码示例来源:origin: apache/hbase
@Override
public boolean filterAllRemaining() throws IOException {
return this.filter.filterAllRemaining();
}
代码示例来源:origin: apache/hbase
@Override
public boolean filterAllRemaining() throws IOException {
if (isEmpty()) {
return super.filterAllRemaining();
}
for (int i = 0, n = filters.size(); i < n; i++) {
if (filters.get(i).filterAllRemaining()) {
return true;
}
}
return false;
}
代码示例来源:origin: apache/hbase
@Override
public boolean filterAllRemaining() throws IOException {
if (isEmpty()) {
return super.filterAllRemaining();
}
for (int i = 0, n = filters.size(); i < n; i++) {
if (!filters.get(i).filterAllRemaining()) {
return false;
}
}
return true;
}
代码示例来源:origin: apache/hbase
@Override
public boolean filterRowKey(byte[] rowKey, int offset, int length) throws IOException {
if (isEmpty()) {
return super.filterRowKey(rowKey, offset, length);
}
boolean retVal = false;
for (int i = 0, n = filters.size(); i < n; i++) {
Filter filter = filters.get(i);
if (filter.filterAllRemaining() || filter.filterRowKey(rowKey, offset, length)) {
retVal = true;
}
}
return retVal;
}
代码示例来源:origin: apache/hbase
@Override
public boolean filterRowKey(byte[] rowKey, int offset, int length) throws IOException {
if (isEmpty()) {
return super.filterRowKey(rowKey, offset, length);
}
boolean retVal = true;
for (int i = 0, n = filters.size(); i < n; i++) {
Filter filter = filters.get(i);
if (!filter.filterAllRemaining() && !filter.filterRowKey(rowKey, offset, length)) {
retVal = false;
}
}
return retVal;
}
代码示例来源:origin: apache/hbase
@Override
public boolean filterRowKey(Cell firstRowCell) throws IOException {
if (isEmpty()) {
return super.filterRowKey(firstRowCell);
}
boolean retVal = false;
for (int i = 0, n = filters.size(); i < n; i++) {
Filter filter = filters.get(i);
if (filter.filterAllRemaining() || filter.filterRowKey(firstRowCell)) {
// Can't just return true here, because there are some filters (such as PrefixFilter) which
// will catch the row changed event by filterRowKey(). If we return early here, those
// filters will have no chance to update their row state.
retVal = true;
}
}
return retVal;
}
代码示例来源:origin: apache/hbase
@Override
public boolean filterRowKey(Cell firstRowCell) throws IOException {
if (isEmpty()) {
return super.filterRowKey(firstRowCell);
}
boolean retVal = true;
for (int i = 0, n = filters.size(); i < n; i++) {
Filter filter = filters.get(i);
if (!filter.filterAllRemaining() && !filter.filterRowKey(firstRowCell)) {
// Can't just return false here, because there are some filters (such as PrefixFilter) which
// will catch the row changed event by filterRowKey(). If we return early here, those
// filters will have no chance to update their row state.
retVal = false;
}
}
return retVal;
}
代码示例来源:origin: apache/hbase
@Override
public ReturnCode filterCell(Cell c) throws IOException {
if (isEmpty()) {
return ReturnCode.INCLUDE;
}
ReturnCode rc = ReturnCode.INCLUDE;
this.seekHintFilters.clear();
for (int i = 0, n = filters.size(); i < n; i++) {
Filter filter = filters.get(i);
if (filter.filterAllRemaining()) {
return ReturnCode.NEXT_ROW;
}
ReturnCode localRC;
localRC = filter.filterCell(c);
if (localRC == ReturnCode.SEEK_NEXT_USING_HINT) {
seekHintFilters.add(filter);
}
rc = mergeReturnCode(rc, localRC);
// Only when rc is INCLUDE* case, we should pass the cell to the following sub-filters.
// otherwise we may mess up the global state (such as offset, count..) in the following
// sub-filters. (HBASE-20565)
if (!isIncludeRelatedReturnCode(rc)) {
return rc;
}
}
if (!seekHintFilters.isEmpty()) {
return ReturnCode.SEEK_NEXT_USING_HINT;
}
return rc;
}
代码示例来源:origin: apache/hbase
@Override
public Cell getNextCellHint(Cell currentCell) throws IOException {
if (isEmpty()) {
return super.getNextCellHint(currentCell);
}
Cell minKeyHint = null;
// If any condition can pass, we need to keep the min hint
for (int i = 0, n = filters.size(); i < n; i++) {
if (filters.get(i).filterAllRemaining()) {
continue;
}
Cell curKeyHint = filters.get(i).getNextCellHint(currentCell);
if (curKeyHint == null) {
// If we ever don't have a hint and this is must-pass-one, then no hint
return null;
}
// If this is the first hint we find, set it
if (minKeyHint == null) {
minKeyHint = curKeyHint;
continue;
}
if (this.compareCell(minKeyHint, curKeyHint) > 0) {
minKeyHint = curKeyHint;
}
}
return minKeyHint;
}
代码示例来源:origin: apache/hbase
@Override
public MatchCode match(Cell cell) throws IOException {
if (filter != null && filter.filterAllRemaining()) {
return MatchCode.DONE_SCAN;
}
MatchCode returnCode = preCheck(cell);
if (returnCode != null) {
return returnCode;
}
long timestamp = cell.getTimestamp();
byte typeByte = cell.getTypeByte();
// For a raw scan, we do not filter out any cells by delete marker, and delete marker is also
// returned, so we do not need to track delete.
return matchColumn(cell, timestamp, typeByte);
}
代码示例来源:origin: apache/hbase
@Override
public Cell getNextCellHint(Cell currentCell) throws IOException {
if (isEmpty()) {
return super.getNextCellHint(currentCell);
}
Cell maxHint = null;
for (Filter filter : seekHintFilters) {
if (filter.filterAllRemaining()) {
continue;
}
Cell curKeyHint = filter.getNextCellHint(currentCell);
if (maxHint == null) {
maxHint = curKeyHint;
continue;
}
if (this.compareCell(maxHint, curKeyHint) < 0) {
maxHint = curKeyHint;
}
}
return maxHint;
}
代码示例来源:origin: apache/hbase
private void testFiltersBeyondPageSize(final Filter f, final int pageSize) throws IOException {
int count = 0;
for (int i = 0; i < (pageSize * 2); i++) {
boolean filterOut = f.filterRow();
if(filterOut) {
break;
} else {
count++;
}
// If at last row, should tell us to skip all remaining
if(count == pageSize) {
assertTrue(f.filterAllRemaining());
} else {
assertFalse(f.filterAllRemaining());
}
}
assertEquals(pageSize, count);
}
代码示例来源:origin: apache/hbase
private void prefixRowTests(Filter filter, boolean lastFilterAllRemaining)
throws Exception {
for (char c = FIRST_CHAR; c <= LAST_CHAR; c++) {
byte [] t = createRow(c);
assertFalse("Failed with character " + c,
filter.filterRowKey(KeyValueUtil.createFirstOnRow(t)));
assertFalse(filter.filterAllRemaining());
}
String yahooSite = "com.yahoo.www";
byte [] yahooSiteBytes = Bytes.toBytes(yahooSite);
assertTrue("Failed with character " +
yahooSite, filter.filterRowKey(KeyValueUtil.createFirstOnRow(yahooSiteBytes)));
assertEquals(filter.filterAllRemaining(), lastFilterAllRemaining);
}
代码示例来源:origin: apache/hbase
private void stopRowTests(Filter filter) throws Exception {
assertFalse("Filtering on " + Bytes.toString(GOOD_ROW),
filter.filterRowKey(KeyValueUtil.createFirstOnRow(GOOD_ROW)));
assertFalse("Filtering on " + Bytes.toString(STOP_ROW),
filter.filterRowKey(KeyValueUtil.createFirstOnRow(STOP_ROW)));
assertTrue("Filtering on " + Bytes.toString(PAST_STOP_ROW),
filter.filterRowKey(KeyValueUtil.createFirstOnRow(PAST_STOP_ROW)));
assertTrue("FilterAllRemaining", filter.filterAllRemaining());
assertFalse("FilterNotNull", filter.filterRow());
}
代码示例来源:origin: apache/hbase
@Override
public MatchCode match(Cell cell) throws IOException {
if (filter != null && filter.filterAllRemaining()) {
return MatchCode.DONE_SCAN;
}
MatchCode returnCode = preCheck(cell);
if (returnCode != null) {
return returnCode;
}
long timestamp = cell.getTimestamp();
byte typeByte = cell.getTypeByte();
if (PrivateCellUtil.isDelete(typeByte)) {
boolean includeDeleteMarker = seePastDeleteMarkers ? tr.withinTimeRange(timestamp)
: tr.withinOrAfterTimeRange(timestamp);
if (includeDeleteMarker) {
this.deletes.add(cell);
}
return MatchCode.SKIP;
}
returnCode = checkDeleted(deletes, cell);
if (returnCode != null) {
return returnCode;
}
return matchColumn(cell, timestamp, typeByte);
}
代码示例来源:origin: apache/hbase
private void regexPatternFilterTests(Filter filter)
throws Exception {
KeyValue cell = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER,
FULLSTRING_1);
assertTrue("regexTrue",
filter.filterCell(cell) == Filter.ReturnCode.INCLUDE);
byte[] buffer = cell.getBuffer();
Cell c = new ByteBufferKeyValue(ByteBuffer.wrap(buffer), 0, buffer.length);
assertTrue("regexTrue", filter.filterCell(c) == Filter.ReturnCode.INCLUDE);
assertFalse("regexFilterAllRemaining", filter.filterAllRemaining());
assertFalse("regexFilterNotNull", filter.filterRow());
}
代码示例来源:origin: apache/hbase
private void mpAllTest(Filter filterMPALL) throws Exception {
/* Filter must do all below steps:
* <ul>
* <li>{@link #reset()}</li>
* <li>{@link #filterAllRemaining()} -> true indicates scan is over, false, keep going on.</li>
* <li>{@link #filterRowKey(byte[],int,int)} -> true to drop this row,
* if false, we will also call</li>
* <li>{@link #filterCell(org.apache.hadoop.hbase.KeyValue)} -> true to drop this cell</li>
* <li>{@link #filterRow()} -> last chance to drop entire row based on the sequence of
* filterValue() calls. Eg: filter a row if it doesn't contain a specified column.
* </li>
* </ul>
*/
filterMPALL.reset();
assertFalse(filterMPALL.filterAllRemaining());
byte [] rowkey = Bytes.toBytes("yyyyyyyyy");
for (int i = 0; i < MAX_PAGES - 1; i++) {
assertFalse(filterMPALL.filterRowKey(KeyValueUtil.createFirstOnRow(rowkey)));
KeyValue kv = new KeyValue(rowkey, rowkey, Bytes.toBytes(i),
Bytes.toBytes(i));
assertTrue(Filter.ReturnCode.INCLUDE == filterMPALL.filterCell(kv));
}
filterMPALL.reset();
rowkey = Bytes.toBytes("z");
assertTrue(filterMPALL.filterRowKey(KeyValueUtil.createFirstOnRow(rowkey)));
// Should fail here; row should be filtered out.
KeyValue kv = new KeyValue(rowkey, rowkey, rowkey, rowkey);
assertTrue(Filter.ReturnCode.NEXT_ROW == filterMPALL.filterCell(kv));
}
代码示例来源:origin: apache/hbase
private void substrFilterTests(Filter filter)
throws Exception {
KeyValue cell = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER,
FULLSTRING_1);
assertTrue("substrTrue",
filter.filterCell(cell) == Filter.ReturnCode.INCLUDE);
byte[] buffer = cell.getBuffer();
Cell c = new ByteBufferKeyValue(ByteBuffer.wrap(buffer), 0, buffer.length);
assertTrue("substrTrue", filter.filterCell(c) == Filter.ReturnCode.INCLUDE);
cell = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER,
FULLSTRING_2);
assertTrue("substrFalse", filter.filterCell(cell) == Filter.ReturnCode.INCLUDE);
buffer = cell.getBuffer();
c = new ByteBufferKeyValue(ByteBuffer.wrap(buffer), 0, buffer.length);
assertTrue("substrFalse", filter.filterCell(c) == Filter.ReturnCode.INCLUDE);
assertFalse("substrFilterAllRemaining", filter.filterAllRemaining());
assertFalse("substrFilterNotNull", filter.filterRow());
}
代码示例来源:origin: apache/hbase
private void regexFilterTests(Filter filter)
throws Exception {
KeyValue cell = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER,
FULLSTRING_1);
assertTrue("regexTrue",
filter.filterCell(cell) == Filter.ReturnCode.INCLUDE);
byte[] buffer = cell.getBuffer();
Cell c = new ByteBufferKeyValue(ByteBuffer.wrap(buffer), 0, buffer.length);
assertTrue("regexTrue", filter.filterCell(c) == Filter.ReturnCode.INCLUDE);
cell = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER,
FULLSTRING_2);
assertTrue("regexFalse", filter.filterCell(cell) == Filter.ReturnCode.INCLUDE);
buffer = cell.getBuffer();
c = new ByteBufferKeyValue(ByteBuffer.wrap(buffer), 0, buffer.length);
assertTrue("regexFalse", filter.filterCell(c) == Filter.ReturnCode.INCLUDE);
assertFalse("regexFilterAllRemaining", filter.filterAllRemaining());
assertFalse("regexFilterNotNull", filter.filterRow());
}
内容来源于网络,如有侵权,请联系作者删除!