hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Purtell <andrew.purt...@gmail.com>
Subject Re: REST Interface: Required ordering of JSON name/value pairs when performing Insert/Update
Date Sun, 03 Jun 2012 10:32:06 GMT
Thanks for the report.

I reopened the JIRA. It might be the best we can do is make a documentation update.

I'm in Berlin this week for Buzzwords, might not get a chance to look at this until late this
week or early next. 

    - Andy

On Jun 3, 2012, at 11:51 AM, Nick Dimiduk <ndimiduk@gmail.com> wrote:

> Hi Andy,
> 
> What's the status of this bug? The JIRA says it was resolved in 0.20.5 and
> 0.90.0 but I'm able to repro in 0.92.0.
> 
> When I:
> 
> $ curl -v -XPUT \
>  -H "Content-Type: application/json" \
>  http://localhost:9999/users/TheRealMT/info:password \
>  -d '{
>    "Row": [
>        {
>            "Cell": [
>                {
> *                    "@column": "aW5mbzpwYXNzd29yZA==",*
> *                    "$": "NzBOQHJJIE4wIDcwdDBSMA=="*
>                }
>            ],
>            "@key": "VGhlUmVhbE1U"
>        }
>    ]
> }'
> 
> The logs show:
> 
> 12/06/03 02:43:16 DEBUG rest.RowResource: PUT
> http://localhost:9999/users/TheRealMT/info:password
> 12/06/03 02:43:16 DEBUG rest.RowResource: PUT
> {"totalColumns":1,"families":{"info":[{"timestamp":9223372036854775807,"qualifier":"password",
> *"vlen":16*}]},"row":"TheRealMT"}
> 
> And the write is successful.
> 
> But if I:
> 
> $ curl -v -XPUT \
>  -H "Content-Type: application/json" \
>  http://localhost:9999/users/TheRealMT/info:password \
>  -d '{
>    "Row": [
>        {
>            "Cell": [
>                {
> *                    "$": "NzBOQHJJIE4wIDcwdDBSMA==",*
> *                    "@column": "aW5mbzpwYXNzd29yZA=="*
>                }
>            ],
>            "@key": "VGhlUmVhbE1U"
>        }
>    ]
> }'
> 
> The log shows:
> 
> 12/06/03 02:46:22 DEBUG rest.RowResource: PUT
> http://localhost:9999/users/TheRealMT/info:password
> 12/06/03 02:46:22 DEBUG rest.RowResource: PUT
> {"totalColumns":1,"families":{"info":[{"timestamp":9223372036854775807,"qualifier":"password",
> *"vlen":0*}]},"row":"TheRealMT"}
> 
> And my cell is now empty.
> 
> For reference:
> 
> $ curl http://localhost:9999/version
> rest 0.0.2 [JVM: Apple Inc. 1.6.0_31-20.6-b01-415] [OS: Mac OS X 10.7.4
> x86_64] [Server: jetty/6.1.26] [Jersey: 1.4]
> $ curl http://localhost:9999/version/cluster
> 0.92.0
> 
> Thanks,
> -n
> 
> On Tue, Apr 20, 2010 at 3:08 PM, Andrew Purtell <apurtell@apache.org> wrote:
> 
>> I filed a JIRA for this and will take a look at it soon:
>> https://issues.apache.org/jira/browse/HBASE-2475
>> 
>> Thanks for the report, very helpful.
>> 
>>> In the equivalent XML notation, the ordering is
>>> specifically required per the schema.
>> 
>> ... and Jersey adds a marshaller and unmarshaller to the JAXB framework to
>> produce JSON. This is an artifact of jersey-json or something dumb we did
>> when hooking up JAXB.
>> 
>>  - Andy
>> 
>>> From: Tyler Coffin
>>> Subject: REST Interface: Required ordering of JSON name/value pairs when
>> performing Insert/Update
>>> 
>>> I am using the Stargate REST interface to HBase for
>>> inserting data. When using JSON to transmit the query content,
>>> I have found that specific ordering of key/value pairs within
>>> the JSON string is required in order for the query to succeed
>>> (otherwise a response of 'HTTP/1.1 500 Row key is invalid' error
>>> is thrown if "key" and "Cell" are reversed).
>>> 
>>> Example:
>>> This string receives the above error:
>>> 
>> {"Row":[{"Cell":[{"column":"bWVzc2FnZTptc2c=","$":"Zm9vYmFy"}],"key":"MTIzNAo="}]}
>>> This is the valid equivalent string:
>>> 
>> {"Row":[{"key":"MTIzNAo=","Cell":[{"column":"bWVzc2FnZTptc2c=","$":"Zm9vYmFy"}]}]}
>>> As you can see the only difference between these two
>>> instances is that
>>> the "key" and "Cell" name/value pairs have their order
>>> reversed.
>>> 
>>> In the equivalent XML notation, the ordering is
>>> specifically required per the schema.
>> 
>> 
>> 
>> 
>> 
>> 

Mime
View raw message