I'm on the road. Let me circle back to this soon.
Also, I filed https://issues.apache.org/jira/browse/HBASE-5417. Now that 0.92
has ParseFilter (with documentation) this seems a good way forward. If you're
willing to use a patched version of the REST gateway we can get you up and
running with it soon.
Best regards,
- Andy
On Feb 16, 2012, at 12:18 PM, Mario Lassnig <[email protected]> wrote:
> Hi Andrew,
>
> thanks, I suspected something like this.
>
> I'm using the rest api from python, so I made a litte
> helper to construct a few example JSON representations,
> to get me on the right track.
>
> Now I patchwork the string together in python and it produces
> the same JSON representation as stringifyFilter.
> So far so good.
>
> However... it doesn't work... and it's weird,
> because it ignores the filter, I always get the full content of the table
> back.
>
> Could you please provide a simple toy problem that works,
> because I suspect that I'm missing some critical thing here.
>
> I'd be happy to help then to mash this into proper documentation.
>
> Thanks,
> Mario
>
>
>
> On 12-2-16 20:31 , Andrew Purtell wrote:
>> Hi,
>>
>> One option is to build a Scan object and attach the filter construction you
>> would like using the Java API:
>>
>> Scan scan = new Scan();
>> Filter filter = new ... ;
>>
>> scan.setFilter(filter);
>>
>>
>> and then use REST's model API to construct and submit the request:
>>
>> ScannerModel model = ScannerModel.fromScan(scan);
>> // submit the scanner model using methods in
>> org.apache.hadoop.hbase.rest.client
>>
>> But for non Java clients you can stringify the filter:
>>
>> String filterAsJSON = ScannerModel.stringifyFilter(filter);
>>
>> Building a Filter object hierarchy and dumping the JSON representation of it
>> can be done interactively using the HBase shell, which is JRuby.
>>
>> This will give you back a representation of the scanner that you can plug in.
>>
>> curl -v -H 'Content-Type: text/xml' \
>> -d '<Scanner startRow="ddo" stopRow="ddp" batch="1024"
>> filter="FILTER JSON REPRESENTATION GOES HERE"/>'
>>
>> Of course documenting the JSON representations of filters would be quite
>> helpful I realize, but filters have been evolving and I didn't want to
>> produce documentation that would be quickly out of date. Patches for such
>> documentation and maintenance thereof would always be welcome!
>>
>>
>> Best regards,
>>
>>
>> - Andy
>>
>> Problems worthy of attack prove their worth by hitting back. - Piet Hein
>> (via Tom White)
>>
>>
>>
>> ----- Original Message -----
>>> From: Mario Lassnig<[email protected]>
>>> To: [email protected]
>>> Cc:
>>> Sent: Thursday, February 16, 2012 2:48 AM
>>> Subject: HBase REST SingleColumnValueFilter
>>>
>>> Hello,
>>>
>>> I cannot figure out how to use filters in the HBase REST interface (HBase
>>> 0.90.4-cdh3u3). The documentation just gives me a schema definition for a
>>> "filter string", but doesn't show how to use it.
>>>
>>> So, I'm able to do this:
>>>
>>> curl -v -H 'Content-Type: text/xml' -d '<Scanner
>>> startRow="ddo" stopRow="ddp"
>>> batch="1024"/>' 'http://hbasegw:8080/table/scanner'
>>>
>>> and then retrieve with
>>>
>>> curl -s -H "Content-Type: text/xml"
>>> http://hbasegw:8080/table/scanner/13293426893883128482b
>>>
>>> But now I want to use a few SingleColumnValueFilters that all must succeed
>>> (e.g., like the java FilterList(FilterList.Operator.MUST_PASS_ALL..)
>>>
>>> and have to encode that somehow in the XML. Does anyone have an example for
>>> this?
>>>
>>> Thanks, Mario
>>>
>
> --
> Mario Lassnig
> CERN PH-ADP-DDM 1-R-022
> CH-1211 Geneve 23
> [email protected]
> +41 22 76 71268
>