Return-Path: X-Original-To: apmail-hbase-user-archive@www.apache.org Delivered-To: apmail-hbase-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 88ED090F7 for ; Sun, 3 Jun 2012 10:33:18 +0000 (UTC) Received: (qmail 86262 invoked by uid 500); 3 Jun 2012 10:33:16 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 86135 invoked by uid 500); 3 Jun 2012 10:33:16 -0000 Mailing-List: contact user-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hbase.apache.org Delivered-To: mailing list user@hbase.apache.org Received: (qmail 85836 invoked by uid 500); 3 Jun 2012 10:33:16 -0000 Delivered-To: apmail-hadoop-hbase-user@hadoop.apache.org Received: (qmail 85667 invoked by uid 99); 3 Jun 2012 10:33:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Jun 2012 10:33:15 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of andrew.purtell@gmail.com designates 209.85.213.176 as permitted sender) Received: from [209.85.213.176] (HELO mail-yx0-f176.google.com) (209.85.213.176) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Jun 2012 10:33:06 +0000 Received: by yenm14 with SMTP id m14so3101170yen.35 for ; Sun, 03 Jun 2012 03:32:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:references:from:content-transfer-encoding:content-type :in-reply-to:message-id:date:cc:to:mime-version:x-mailer; bh=0FZUWg2Sxqv7Mf4dk6NT9YcbajoVaG+FnRswnIdgkWU=; b=V3rTP8qF12ns6nVwverLpk2Pp82YnWpQ7vkPfFECyaxQhjYt9mZdxmwr1xGKgDiVSf AP7qtCWmizNzWtCQTogvG2fRlu+05+kLi5mmvQGXkZSgcIwLu41tXQ54XzizHgbgG33M vb0Nwmba4B8ym2NTG212qaSAcKPZkw4LQ0bVhxkP4Jg77FdpOYts3whiqgL1BzeZTRPj sgSqDwAF+6XzRBaZqLihR6EAEfj0KsCWF/pUkAplHJg3MTJ9kB9hBHdO4imvlm1SJfD9 2h+MponAddI+BGCi7YvAdm5EpoTfBy27VV2+xNBlWntYDibH424EqE4Y4BFHuox/fZPb f4Kg== Received: by 10.236.115.136 with SMTP id e8mr3648241yhh.63.1338719565463; Sun, 03 Jun 2012 03:32:45 -0700 (PDT) Received: from [10.52.48.10] ([166.137.9.105]) by mx.google.com with ESMTPS id r18sm10378109anj.6.2012.06.03.03.32.44 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 03 Jun 2012 03:32:44 -0700 (PDT) Subject: Re: REST Interface: Required ordering of JSON name/value pairs when performing Insert/Update References: <682550.37360.qm@web65508.mail.ac4.yahoo.com> From: Andrew Purtell Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii In-Reply-To: Message-Id: Date: Sun, 3 Jun 2012 12:32:06 +0200 Cc: "hbase-user@hadoop.apache.org" , "apurtell@apache.org" To: "user@hbase.apache.org" Mime-Version: 1.0 (1.0) X-Mailer: iPhone Mail (9B206) Thanks for the report. I reopened the JIRA. It might be the best we can do is make a documentation u= pdate. I'm in Berlin this week for Buzzwords, might not get a chance to look at thi= s until late this week or early next.=20 - Andy On Jun 3, 2012, at 11:51 AM, Nick Dimiduk wrote: > Hi Andy, >=20 > 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. >=20 > When I: >=20 > $ curl -v -XPUT \ > -H "Content-Type: application/json" \ > http://localhost:9999/users/TheRealMT/info:password \ > -d '{ > "Row": [ > { > "Cell": [ > { > * "@column": "aW5mbzpwYXNzd29yZA=3D=3D",* > * "$": "NzBOQHJJIE4wIDcwdDBSMA=3D=3D"* > } > ], > "@key": "VGhlUmVhbE1U" > } > ] > }' >=20 > The logs show: >=20 > 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,"qu= alifier":"password", > *"vlen":16*}]},"row":"TheRealMT"} >=20 > And the write is successful. >=20 > But if I: >=20 > $ curl -v -XPUT \ > -H "Content-Type: application/json" \ > http://localhost:9999/users/TheRealMT/info:password \ > -d '{ > "Row": [ > { > "Cell": [ > { > * "$": "NzBOQHJJIE4wIDcwdDBSMA=3D=3D",* > * "@column": "aW5mbzpwYXNzd29yZA=3D=3D"* > } > ], > "@key": "VGhlUmVhbE1U" > } > ] > }' >=20 > The log shows: >=20 > 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,"qu= alifier":"password", > *"vlen":0*}]},"row":"TheRealMT"} >=20 > And my cell is now empty. >=20 > For reference: >=20 > $ 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 >=20 > Thanks, > -n >=20 > On Tue, Apr 20, 2010 at 3:08 PM, Andrew Purtell wrot= e: >=20 >> I filed a JIRA for this and will take a look at it soon: >> https://issues.apache.org/jira/browse/HBASE-2475 >>=20 >> Thanks for the report, very helpful. >>=20 >>> In the equivalent XML notation, the ordering is >>> specifically required per the schema. >>=20 >> ... and Jersey adds a marshaller and unmarshaller to the JAXB framework t= o >> produce JSON. This is an artifact of jersey-json or something dumb we did= >> when hooking up JAXB. >>=20 >> - Andy >>=20 >>> From: Tyler Coffin >>> Subject: REST Interface: Required ordering of JSON name/value pairs when= >> performing Insert/Update >>>=20 >>> 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). >>>=20 >>> Example: >>> This string receives the above error: >>>=20 >> {"Row":[{"Cell":[{"column":"bWVzc2FnZTptc2c=3D","$":"Zm9vYmFy"}],"key":"M= TIzNAo=3D"}]} >>> This is the valid equivalent string: >>>=20 >> {"Row":[{"key":"MTIzNAo=3D","Cell":[{"column":"bWVzc2FnZTptc2c=3D","$":"Z= m9vYmFy"}]}]} >>> As you can see the only difference between these two >>> instances is that >>> the "key" and "Cell" name/value pairs have their order >>> reversed. >>>=20 >>> In the equivalent XML notation, the ordering is >>> specifically required per the schema. >>=20 >>=20 >>=20 >>=20 >>=20 >>=20