org.apache.hadoop.hbase.filter.Filter.filterKeyValue()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(169)

本文整理了Java中org.apache.hadoop.hbase.filter.Filter.filterKeyValue()方法的一些代码示例,展示了Filter.filterKeyValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Filter.filterKeyValue()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.filter.Filter
类名称:Filter
方法名:filterKeyValue

Filter.filterKeyValue介绍

[英]A way to filter based on the column family, column qualifier and/or the column value. Return code is described below. This allows filters to filter only certain number of columns, then terminate without matching ever column. If filterRowKey returns true, filterKeyValue needs to be consistent with it. filterKeyValue can assume that filterRowKey has already been called for the row. If your filter returns ReturnCode.NEXT_ROW, it should return ReturnCode.NEXT_ROW until #reset() is called just in case the caller calls for the next row. Concrete implementers can signal a failure condition in their code by throwing an IOException.
[中]基于列族、列限定符和/或列值进行筛选的方法。返回代码如下所述。这允许筛选器只筛选特定数量的列,然后终止而不匹配任何列。如果filterRowKey返回true,则filterKeyValue需要与之一致。filterKeyValue可以假定该行已调用filterRowKey。如果您的筛选器返回ReturnCode.NEXT_ROW,则它应该返回ReturnCode.NEXT_ROW,直到调用#reset(),以防调用者调用下一行。具体的实现者可以通过抛出IOException在代码中发出失败条件的信号。

代码示例

代码示例来源:origin: apache/hbase

/**
 * A way to filter based on the column family, column qualifier and/or the column value. Return
 * code is described below. This allows filters to filter only certain number of columns, then
 * terminate without matching ever column.
 *
 * If filterRowKey returns true, filterCell needs to be consistent with it.
 *
 * filterCell can assume that filterRowKey has already been called for the row.
 *
 * If your filter returns <code>ReturnCode.NEXT_ROW</code>, it should return
 * <code>ReturnCode.NEXT_ROW</code> until {@link #reset()} is called just in case the caller calls
 * for the next row.
 *
 * Concrete implementers can signal a failure condition in their code by throwing an
 * {@link IOException}.
 *
 * @param c the Cell in question
 * @return code as described below
 * @throws IOException in case an I/O or an filter specific failure needs to be signaled.
 * @see Filter.ReturnCode
 */
public ReturnCode filterCell(final Cell c) throws IOException{
 return filterKeyValue(c);
}

代码示例来源:origin: apache/kylin

break;
Filter.ReturnCode filterResult = filter.filterKeyValue(kv);
if (filterResult == Filter.ReturnCode.INCLUDE) {
  nkvs.add(kv);

代码示例来源:origin: org.apache.hbase/hbase-client

/**
 * A way to filter based on the column family, column qualifier and/or the column value. Return
 * code is described below. This allows filters to filter only certain number of columns, then
 * terminate without matching ever column.
 *
 * If filterRowKey returns true, filterCell needs to be consistent with it.
 *
 * filterCell can assume that filterRowKey has already been called for the row.
 *
 * If your filter returns <code>ReturnCode.NEXT_ROW</code>, it should return
 * <code>ReturnCode.NEXT_ROW</code> until {@link #reset()} is called just in case the caller calls
 * for the next row.
 *
 * Concrete implementers can signal a failure condition in their code by throwing an
 * {@link IOException}.
 *
 * @param c the Cell in question
 * @return code as described below
 * @throws IOException in case an I/O or an filter specific failure needs to be signaled.
 * @see Filter.ReturnCode
 */
public ReturnCode filterCell(final Cell c) throws IOException{
 return filterKeyValue(c);
}

代码示例来源:origin: forcedotcom/phoenix

private boolean seekToNextUnfilteredKeyValue() throws IOException {
  while (true) {
    KeyValue peeked = delegate.peek();
    // no more key values, so we are done
    if (peeked == null) { return false; }
    // filter the peeked value to see if it should be served
    ReturnCode code = filter.filterKeyValue(peeked);
    switch (code) {
    // included, so we are done
    case INCLUDE:
    case INCLUDE_AND_NEXT_COL:
      return true;
      // not included, so we need to go to the next row
    case SKIP:
    case NEXT_COL:
    case NEXT_ROW:
      delegate.next();
      break;
    // use a seek hint to find out where we should go
    case SEEK_NEXT_USING_HINT:
      delegate.seek(filter.getNextKeyHint(peeked));
    }
  }
}

代码示例来源:origin: apache/phoenix

private boolean seekToNextUnfilteredKeyValue() throws IOException {
  while (true) {
    Cell peeked = delegate.peek();
    // no more key values, so we are done
    if (peeked == null) { return false; }
    // filter the peeked value to see if it should be served
    ReturnCode code = filter.filterKeyValue(peeked);
    switch (code) {
    // included, so we are done
    case INCLUDE:
    case INCLUDE_AND_NEXT_COL:
      return true;
      // not included, so we need to go to the next row
    case SKIP:
    case NEXT_COL:
    case NEXT_ROW:
      delegate.next();
      break;
    // use a seek hint to find out where we should go
    case SEEK_NEXT_USING_HINT:
      Cell nextCellHint = filter.getNextCellHint(peeked);
      if(nextCellHint == KeyValue.LOWESTKEY) {
        delegate.next();
      } else {
        delegate.seek(PhoenixKeyValueUtil.maybeCopyCell(nextCellHint));
      }
    }
  }
}

代码示例来源:origin: apache/phoenix

private void assertInclude(byte[] next, Filter f) throws IOException {
  Cell c = new KeyValue(next, ByteUtil.EMPTY_BYTE_ARRAY, ByteUtil.EMPTY_BYTE_ARRAY, 0, ByteUtil.EMPTY_BYTE_ARRAY);
  assertTrue(f.filterKeyValue(c) == ReturnCode.INCLUDE);
  assertFalse(f.filterAllRemaining());
}

代码示例来源:origin: apache/metron

continue;
if (filter.filterKeyValue(kv) == Filter.ReturnCode.INCLUDE) {
 nkvs.add(kv);

代码示例来源:origin: apache/metron

continue;
Filter.ReturnCode filterResult = filter.filterKeyValue(kv);
if (filterResult == Filter.ReturnCode.INCLUDE) {
 nkvs.add(kv);

代码示例来源:origin: co.cask.tephra/tephra-hbase-compat-1.1

private ReturnCode runSubFilter(ReturnCode txFilterCode, Cell cell) throws IOException {
 if (cellFilter != null) {
  ReturnCode subFilterCode = cellFilter.filterKeyValue(cell);
  return determineReturnCode(txFilterCode, subFilterCode);
 }
 return txFilterCode;
}

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-0.98

private ReturnCode runSubFilter(ReturnCode txFilterCode, Cell cell) throws IOException {
 if (cellFilter != null) {
  ReturnCode subFilterCode = cellFilter.filterKeyValue(cell);
  return determineReturnCode(txFilterCode, subFilterCode);
 }
 return txFilterCode;
}

代码示例来源:origin: harbby/presto-connectors

@Override
public ReturnCode filterKeyValue(Cell v) throws IOException {
 ReturnCode c = filter.filterKeyValue(v);
 changeFR(c != ReturnCode.INCLUDE);
 return c;
}

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-1.1

private ReturnCode runSubFilter(ReturnCode txFilterCode, Cell cell) throws IOException {
 if (cellFilter != null) {
  ReturnCode subFilterCode = cellFilter.filterKeyValue(cell);
  return determineReturnCode(txFilterCode, subFilterCode);
 }
 return txFilterCode;
}

代码示例来源:origin: co.cask.hbase/hbase

public ReturnCode filterKeyValue(KeyValue v) {
 ReturnCode c = filter.filterKeyValue(v);
 changeFR(c != ReturnCode.INCLUDE);
 return c;
}

代码示例来源:origin: caskdata/tephra

private ReturnCode runSubFilter(ReturnCode txFilterCode, Cell cell) throws IOException {
 if (cellFilter != null) {
  ReturnCode subFilterCode = cellFilter.filterKeyValue(cell);
  return determineReturnCode(txFilterCode, subFilterCode);
 }
 return txFilterCode;
}

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-1.0-cdh

private ReturnCode runSubFilter(ReturnCode txFilterCode, Cell cell) throws IOException {
 if (cellFilter != null) {
  ReturnCode subFilterCode = cellFilter.filterKeyValue(cell);
  return determineReturnCode(txFilterCode, subFilterCode);
 }
 return txFilterCode;
}

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-1.0

private ReturnCode runSubFilter(ReturnCode txFilterCode, Cell cell) throws IOException {
 if (cellFilter != null) {
  ReturnCode subFilterCode = cellFilter.filterKeyValue(cell);
  return determineReturnCode(txFilterCode, subFilterCode);
 }
 return txFilterCode;
}

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-0.96

private ReturnCode runSubFilter(ReturnCode txFilterCode, Cell cell) throws IOException {
 if (cellFilter != null) {
  ReturnCode subFilterCode = cellFilter.filterKeyValue(cell);
  return determineReturnCode(txFilterCode, subFilterCode);
 }
 return txFilterCode;
}

代码示例来源:origin: caskdata/tephra

private ReturnCode runSubFilter(ReturnCode txFilterCode, Cell cell) throws IOException {
 if (cellFilter != null) {
  ReturnCode subFilterCode = cellFilter.filterKeyValue(cell);
  return determineReturnCode(txFilterCode, subFilterCode);
 }
 return txFilterCode;
}

代码示例来源:origin: caskdata/tephra

private ReturnCode runSubFilter(ReturnCode txFilterCode, Cell cell) throws IOException {
 if (cellFilter != null) {
  ReturnCode subFilterCode = cellFilter.filterKeyValue(cell);
  return determineReturnCode(txFilterCode, subFilterCode);
 }
 return txFilterCode;
}

代码示例来源:origin: apache/phoenix

private void assertSeekAndHint(byte[] next, Filter f, byte[] rowHint, boolean filterAll) throws IOException {
  Cell c = new KeyValue(next, ByteUtil.EMPTY_BYTE_ARRAY, ByteUtil.EMPTY_BYTE_ARRAY, 0, ByteUtil.EMPTY_BYTE_ARRAY);
  assertTrue(f.filterKeyValue(c) == ReturnCode.SEEK_NEXT_USING_HINT);
  Cell h = f.getNextCellHint(c);
  byte[] hintBytes = rowHint;
  assertTrue(Bytes.equals(hintBytes, 0, hintBytes.length, h.getRowArray(), h.getRowOffset(), h.getRowLength()));
  assertEquals(filterAll, f.filterAllRemaining());
}

相关文章