Return-Path: X-Original-To: apmail-hbase-issues-archive@www.apache.org Delivered-To: apmail-hbase-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B83B690F3 for ; Sun, 3 Jun 2012 10:31:27 +0000 (UTC) Received: (qmail 82205 invoked by uid 500); 3 Jun 2012 10:31:27 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 81923 invoked by uid 500); 3 Jun 2012 10:31:24 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 81891 invoked by uid 99); 3 Jun 2012 10:31:23 -0000 Received: from issues-vm.apache.org (HELO issues-vm) (140.211.11.160) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Jun 2012 10:31:23 +0000 Received: from isssues-vm.apache.org (localhost [127.0.0.1]) by issues-vm (Postfix) with ESMTP id 1B5C2140BEF for ; Sun, 3 Jun 2012 10:31:23 +0000 (UTC) Date: Sun, 3 Jun 2012 10:31:23 +0000 (UTC) From: "Andrew Purtell (JIRA)" To: issues@hbase.apache.org Message-ID: <511320635.31533.1338719483114.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Reopened] (HBASE-2475) [stargate] Required ordering of JSON name/value pairs when performing Insert/Update MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HBASE-2475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andrew Purtell reopened HBASE-2475: ----------------------------------- Some JSON field ordering issues remain according to reports. These may be an artifact of how JSON is hooked up to JAXB. The weird '$' special field for specifying a value is due to how the bindings work, for example. Reopening for more investigation and at least a documentation update. > [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 > > > 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