hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Purtell <apurt...@apache.org>
Subject Re: Disable Base64 encoding in Stargate request and Return as String
Date Fri, 17 Jul 2015 23:57:45 GMT
The closest you can get to just a string is have your client use an accept
header of "Accept: application/octet-stream" with making a query. This will
return zero or one value in the response. If a value is present in the
table at the requested location, the response body will be the unencoded
bytes. If you've stored a string, you'll get back a string. If you've
stored an image, you'll get back the raw image bytes. Note that using an
accept header of "application/octet-stream" implicitly limits you to
queries that only return zero or one values. (Strictly speaking, per the
package doc: "If binary encoding is requested, only one cell can be
returned, the first to match the resource specification. The row, column,
and timestamp associated with the cell will be transmitted in X headers:
X-Row, X-Column, and X-Timestamp, respectively. Depending on the precision
of the resource specification, some of the X-headers may be elided as
​In general, the REST gateway supports

​several ​
alternate encodings. See
for some examples.

Note that HBase
​cell data
 is binary
​, not string.
​does not
 make sense to turn off base64 encoding for the default response encoding,
XML, because
​that ​
would produce invalid XML
​ if a value happens to include non XML safe bytes​
​HBase can't know that in advance. We need to encode keys and values in a
safe manner to avoid blowing up your
client's XML.

The same is roughly true for JSON.​

If your client sends an accept header of "Accept: application/protobuf"
you'll get back a protobuf encoded object. Your client will need to be
prepared to handle that representation. This is probably not what you want.

Why are we
​even ​
talking about using XML
​, JSON,​
​ or
 protobuf to
 responses? Because for many types of REST queries, HBase
​must return ​
a structured response.
​The client has asked for more than
​one value, simply one string​
. The response
​must include
 maybe a whole row
​'s worth​
​keys, values, and timestamps
 maybe multiple rows. It depends on the query you issued.
​ (See the '​
Cell or Row Query (Multiple Values)
​' section in the package doc.)​

On Fri, Jul 17, 2015 at 2:20 PM, anil gupta <anilgupta84@gmail.com> wrote:

> Hi All,
> We have a String Rowkey. We have String values of cells.
> Still, Stargate returns the data with Base64 encoding due to which a user
> cant read the data. Is there a way to disable Base64 encoding and then Rest
> request would just return Strings.
> --
> Thanks & Regards,
> Anil Gupta

Best regards,

   - Andy

Problems worthy of attack prove their worth by hitting back. - Piet Hein
(via Tom White)

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message