Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase >> mail # user >> Using filters in REST/stargate returns 204 (No content)


Copy link to this message
-
Re: Using filters in REST/stargate returns 204 (No content)
Hi Suresh:

Have you tried to create a scanner without the filter? Does it return
errors as well?

Best Regards,

Jerry

On Fri, Oct 19, 2012 at 1:16 PM, Kumar, Suresh <[EMAIL PROTECTED]>wrote:

>
> Here is the hbase shell command which works, I am not able to get these
> results using curl/stargate.
>
> scan 'apachelogs', { COLUMNS => 'mylog:pcol', FILTER =>
> "SingleColumnValueFilter('mylog','pcol', =, 'regexstring: ERROR
> xxxxx.')" }
>
> Here is the curl command which does not work:
>
> curl -v -H "Content-Type:text/xml" -d @args.txt
> http://localhost:8080/apachelogs/scanner
>
> where args.txt:
>
> <Scanner>
>         <filter>
>         {
>                 "latestVersion":true, "ifMissing":true,
>                 "qualifier":""cGNvbAo=", "family":""a2V5c3RvbmVsb2cK",
>                 "op":"EQUAL", "type":"SingleColumnValueFilter",
>
> "comparator":{"value":"RVJST1Igc2VydmljZSBhdXRoZW50aWNhdGUgVXNlcgo=","ty
> pe":"RegexStringComparator"}
>         }
>         </filter>
> </Scanner>
>
> Thanks,
> Suresh
>
> -----Original Message-----
> From: Andrew Purtell [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, October 18, 2012 1:19 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Using filters in REST/stargate returns 204 (No content)
>
> What does the HBase shell return if you try that scan programatically?
>
> On Thu, Oct 18, 2012 at 11:02 AM, Kumar, Suresh
> <[EMAIL PROTECTED]>wrote:
>
> >
> >
> > I have a HBase Java client which has a couple of filters and just work
> > fine, I get the expected result.
> >
> > Here is the code:
> >
> >
> >
> >                 HTable table = new HTable(conf, "apachelogs");
> >
> >
> >                 Scan scan = new Scan();
> >
> >
> >                 FilterList list = new
> > FilterList(FilterList.Operator.MUST_PASS_ALL);
> >
> >
> >                 RegexStringComparator comp = new
> > RegexStringComparator("ERROR xxxxx.");
> >
> >
> >
> >                 SingleColumnValueFilter filter = new
> > SingleColumnValueFilter(Bytes.toBytes("mylog"), Bytes.toBytes("pcol"),
> >
> >
> > CompareOp.EQUAL, comp);
> >
> >                 filter.setFilterIfMissing(true);
> >
> >                 list.addFilter(filter);
> >
> >                 scan.setFilter(list);
> >
> >                 ResultScanner scanner = table.getScanner(scan);
> >
> >
> >
> > I startup the REST server, and use curl for the above functionality, I
> > just base 64 encoded "ERROR xxxxx.":
> >
> >
> >
> > curl -v -H "Content-Type:text/xml" -d @args.txt
> > http://localhost:8080/apachelogs/scanner
> >
> >
> >
> > where args.txt is:
> >
> >
> >
> > <Scanner>
> >
> >     <filter>
> >
> >     {
> >
> >         "latestVersion":true, "ifMissing":true,
> >
> >         "qualifier":"pcol", "family":"mylog",
> >
> >         "op":"EQUAL", "type":"SingleColumnValueFilter",
> >
> >
> >
> "comparator":{"value":"RVJST1Igc2VydmljZSBhdXRoZW50aWNhdGUgVXNlcgo=","ty
> > pe":"RegexStringComparator"}
> >
> >     }
> >
> >     </filter>
> >
> > </Scanner>
> >
> >
> >
> > which returns
> >
> > * About to connect() to localhost port 8080 (#0)
> >
> > *   Trying 127.0.0.1... connected
> >
> > > POST /apachelogs/scanner HTTP/1.1
> >
> > > User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0
> > OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> >
> > > Host: localhost:8080
> >
> > > Accept: */*
> >
> > > Content-Type:text/xml
> >
> > > Content-Length: 318
> >
> > >
> >
> > * upload completely sent off: 318out of 318 bytes
> >
> > < HTTP/1.1 201 Created
> >
> > < Location:
> > http://localhost:8080/apachelogs/scanner/13505819795654de4e6c6
> >
> > < Content-Length: 0
> >
> > <
> >
> > * Connection #0 to host localhost left intact
> >
> > * Closing connection #0
> >
> >
> >
> > but  curl -v
> > http://localhost:8080/apachelogs/scanner/13505819795654de4e6c6
> >
> > returns HTTP/1.1 204 No Content
> >
> >
> >
> > Any clues?
> >
> >
> >
> > Thanks,
> >
> > Suresh
> >
> >
>
>
> --
> Best regards,
>
>    - Andy
>
> Problems worthy of attack prove their worth by hitting back. - Piet Hein