【问题标题】:HBase filter inheritance consultationHBase过滤器继承咨询
【发布时间】:2011-07-27 06:19:11
【问题描述】:

我需要一个有点像 TimestampsFilter 的过滤器,只是它需要一个时间范围,并在该框架内应用带有时间戳的每一行。 这是我的实现:

public class TimeFilter extends TimestampsFilter {
private long from;
private long to;

public TimeFilter(long from, long to) {
    this.from = from;
    this.to = to;
}

@Override
public ReturnCode filterKeyValue(KeyValue v) {
    long timestamp = v.getTimestamp();
    if (from <= timestamp && to >= timestamp) {
        return ReturnCode.INCLUDE;
    }
    return ReturnCode.SKIP;
}
}

这个实现是否足够好? 我找不到适合我需要的现有过滤器。 有什么意见吗?

【问题讨论】:

    标签: hadoop hbase


    【解决方案1】:

    你不能在扫描中使用setTimeRange吗?

    【讨论】:

      猜你喜欢
      • 2014-02-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-07
      • 2011-07-17
      • 1970-01-01
      相关资源
      最近更新 更多