[ 
https://issues.apache.org/jira/browse/HBASE-2475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrew Purtell updated HBASE-2475:
----------------------------------

    Attachment: HBASE-2475.patch

For option 2 I tried the quick hack attached and:

{noformat}
2012-06-03 23:43:16,085 WARN  [1224001988@qtp-1382067420-0] log.Slf4jLog(76): 
/users/TheRealMT/info:password: 
org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field 
"Row" (Class org.apache.hadoop.hbase.rest.model.CellSetModel), not marked as 
ignorable
 at [Source: org.mortbay.jetty.HttpParser$Input@264d107e; line: 1, column: 9] 
(through reference chain: 
org.apache.hadoop.hbase.rest.model.CellSetModel["Row"])
2012-06-03 23:43:16,097 DEBUG [main] client.Client(148): PUT 
http://localhost:46871/users/TheRealMT/info:password 500 Unrecognized field 
"Row" (Class org.apache.hadoop.hbase.rest.model.CellSetModel), not marked as 
ignorable  at [Source: org.mortbay.jetty.HttpParser$Input@264d107e; line: 1, 
column: 9] (through reference chain: 
org.apache.hadoop.hbase.rest.model.CellSetModel["Row"]) in 1520 ms
{noformat}

So we can certainly pursue an alternate implementation with Jackson but the 
JSON representation and all related documentation will change.

I will note that the error messages provided by Jackson are much better than 
Jersey in contrast silently accepting input it thinks is broken.
                
> [stargate] Required ordering of JSON name/value pairs when performing 
> Insert/Update
> -----------------------------------------------------------------------------------
>
>                 Key: HBASE-2475
>                 URL: https://issues.apache.org/jira/browse/HBASE-2475
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Andrew Purtell
>            Assignee: Andrew Purtell
>              Labels: moved_from_0_20_5
>             Fix For: 0.20.5, 0.90.0
>
>         Attachments: HBASE-2475.patch
>
>
> From Tyler Coffin up on hbase-user@
> {quote}
> 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:
> {noformat}
> {"Row":[{"Cell":[{"column":"bWVzc2FnZTptc2c=","$":"Zm9vYmFy"}],"key":"MTIzNAo="}]}
> {noformat}
> This is the valid equivalent string:
> {noformat}
> {"Row":[{"key":"MTIzNAo=","Cell":[{"column":"bWVzc2FnZTptc2c=","$":"Zm9vYmFy"}]}]}
> {noformat}
> 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. However with JSON Objects (i.e. name/value pairs) order is not 
> required (JSON Arrays are ordered, but not Objects). Some JSON libraries will 
> preserve ordering of Objects but not all  which is how I discovered this 
> problem in the first place because I was using the Perl JSON library which 
> does not guarantee order). 
> I'm unsure if this is a bug in the REST implementation or an inconvenient 
> ambiguity in the JSON specification. Regardless I thought I'd share this 
> discovery with the community for feedback (or at the very least to document 
> this for users' future reference).
> For reference this is the table schema for the above query:
> {noformat}
> {NAME => 'reftrack', FAMILIES => [{NAME => 'message', COMPRESSION =>
> 'NONE', VERSIONS => '1', TTL => '2147483647', BLOCKSIZE => '65536',
> IN_MEMORY => 'false', BLOCKCACHE => 'true'}]}
> {noformat}
> {quote}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to