hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben West <bwsithspaw...@yahoo.com>
Subject Re: Spaces disappear in HBase?
Date Sun, 09 Oct 2011 22:04:42 GMT
Thanks Andy!

I do not see this in the wiki anywhere (http://wiki.apache.org/hadoop/Hbase/Stargate) - could
we put it in? I'm not certain I know what exactly needs to be encoded: just values when you're
inserting? How about the row names when you're scanning? (I've been having trouble with this.)


----- Original Message -----
From: Andrew Purtell <apurtell@apache.org>
To: "user@hbase.apache.org" <user@hbase.apache.org>; Ben West <bwsithspawn00@yahoo.com>
Sent: Monday, October 3, 2011 6:50 PM
Subject: Re: Spaces disappear in HBase?

Keys and values need to be base64 encoded in all non-binary representations, XML and JSON
Best regards,

   - Andy

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

>From: Ben West <bwsithspawn00@yahoo.com>
>To: "user@hbase.apache.org" <user@hbase.apache.org>
>Sent: Sunday, October 2, 2011 1:15 PM
>Subject: Spaces disappear in HBase?
>Hey all,
>I'm running the standalone HBase server (0.90.4) and REST client (version 0.0.2). When
I POST data and then GET it back, the data is changed; particularly the spaces seem to be
removed. Does anyone know what's going on?
>Here is a python script replicating my problem; I have a table named 'eipi' with a column
family 'eipi':
>import sys
>import urllib2
>import simplejson
>def getData(name, val):
>cell = { 'Row': 
>{'@key' : 'foo', 
>'Cell': [{'@column': 'eipi:%s' % name, 
>'$': val }] 
>return simplejson.dumps(cell)
>def sendData(key, colName, colVal):
>opener = urllib2.build_opener()
>url = 'http://localhost:8081/eipi/%s/eipi:%s' % (key, colName)
>print colVal
>req = urllib2.Request(url, 
>headers = { 'Content-Type': 'application/json' },
>data = getData(colName, colVal))
>f = opener.open(req)
>def printData(key):
>opener = urllib2.build_opener()
>url = 'http://localhost:8081/eipi/%s' % key
>req = urllib2.Request(url, 
>headers = { 'Accept': 'application/json' })
>f = opener.open(req)
>parsed = simplejson.load(f)
>sendData('test','eipi:test','some stuff')
>> python getHBase.py 
>some stuff
>(The space was removed, as well as a trailing 'f'...)

View raw message