2015-06-10 29 views
1

我試圖構建一些過濾器來過濾Bigtable中的數據。我正在使用bigtable-hbase驅動程序和HBase驅動程序。其實這裏是我的依賴從pom.xmlLongComparator在Google Cloud Bigtable中無法使用HBase API

這樣
<dependency> 
     <groupId>org.apache.hbase</groupId> 
     <artifactId>hbase-common</artifactId> 
     <version>${hbase.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.hbase</groupId> 
     <artifactId>hbase-protocol</artifactId> 
     <version>${hbase.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.hbase</groupId> 
     <artifactId>hbase-client</artifactId> 
     <version>${hbase.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.hbase</groupId> 
     <artifactId>hbase-server</artifactId> 
     <version>${hbase.version}</version> 
    </dependency> 

    <dependency> 
     <groupId>com.google.cloud.bigtable</groupId> 
     <artifactId>bigtable-hbase</artifactId> 
     <version>${bigtable.version}</version> 
    </dependency> 

我過濾數據:

Filter filterName = new SingleColumnValueFilter(Bytes.toBytes("FName"), Bytes.toBytes("FName"), 
       CompareFilter.CompareOp.EQUAL, new RegexStringComparator("JOHN")); 
FilterList filters = new FilterList(); 

filters.addFilter(filterName); 

Scan scan1 = new Scan(); 
scan1.setFilter(filters); 

該工程確定。但後來我添加以下到以前的代碼:

Filter filterSalary = new SingleColumnValueFilter(Bytes.toBytes("Salary"), Bytes.toBytes("Salary"), 
       CompareFilter.CompareOp.GREATER_OR_EQUAL, new LongComparator(100000)); 
filters.addFilter(filterSalary); 

,它給我這個例外:

Exception in thread "main" com.google.cloud.bigtable.hbase.adapters.filters.UnsupportedFilterException: Unsupported filters encountered: FilterSupportStatus{isSupported=false, reason='ValueFilter must have either a BinaryComparator with any compareOp or a RegexStringComparator with an EQUAL compareOp. Found (LongComparator, GREATER_OR_EQUAL)'} 
at com.google.cloud.bigtable.hbase.adapters.filters.FilterAdapter.throwIfUnsupportedFilter(FilterAdapter.java:144) 
at com.google.cloud.bigtable.hbase.adapters.ScanAdapter.throwIfUnsupportedScan(ScanAdapter.java:55) 
at com.google.cloud.bigtable.hbase.adapters.ScanAdapter.adapt(ScanAdapter.java:91) 
at com.google.cloud.bigtable.hbase.adapters.ScanAdapter.adapt(ScanAdapter.java:43) 
at com.google.cloud.bigtable.hbase.BigtableTable.getScanner(BigtableTable.java:247) 

所以我的問題是如何篩選的長數據類型?是hbase問題還是bigtable具體?

我發現這個How do you use a custom comparator with SingleColumnValueFilter on HBase?但我無法加載我的罐子到服務器,所以它不適用於我的情況。

回答

相關問題