Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id EACC8200B38 for ; Fri, 8 Jul 2016 14:18:32 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E9570160A5A; Fri, 8 Jul 2016 12:18:32 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3D126160A58 for ; Fri, 8 Jul 2016 14:18:32 +0200 (CEST) Received: (qmail 9425 invoked by uid 500); 8 Jul 2016 12:18:30 -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 9413 invoked by uid 99); 8 Jul 2016 12:18:30 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Jul 2016 12:18:30 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id CFC6E18053D for ; Fri, 8 Jul 2016 12:18:29 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.592 X-Spam-Level: ** X-Spam-Status: No, score=2.592 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, URI_HEX=1.313] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=cloudera-com.20150623.gappssmtp.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 5kulWTFNUmPF for ; Fri, 8 Jul 2016 12:18:27 +0000 (UTC) Received: from mail-vk0-f50.google.com (mail-vk0-f50.google.com [209.85.213.50]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 6B9B15FBC7 for ; Fri, 8 Jul 2016 12:18:27 +0000 (UTC) Received: by mail-vk0-f50.google.com with SMTP id v6so54501169vkb.2 for ; Fri, 08 Jul 2016 05:18:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudera-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=WZRlEqM8807v/0nmeQd+RmsdYue0JNC8yZhUy7BJwd0=; b=tsS6hgldchXJ9AZgIkfopfwRMIu4N3nbY6JChO54rEHjHSGd2xTpON/qGLkLk8Ak/U qT8XdsFCjyWqF2j1NbsJnB7PDBgm0UmWuU/6kkATb9gjR2cwyVVEoSCOyCXLScu7sftV 6B7xwqajiWTbfMUybCsmp5Rm8qwjD9ORehhJqRkh0hfPABQVIBbcQFFyQ3ffUfluISEb jKigGIS1i3VlIzZVuXRShgmSvvp+w99ZG1cHha6Ov7wjjucDkUJYdKUuhDQVgHUqMl1U rsWYLidGW2O+s2KTy5yiiRzAkNcGiUDSsmCRzOf/9Y7Jhl8bKj/Fq42rY4mbmkO4MQHa F7Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=WZRlEqM8807v/0nmeQd+RmsdYue0JNC8yZhUy7BJwd0=; b=m3z6K+ZSlk/KX4oby1rPQf09b/3V2I3bQasUyB9ZUVJvuvhwMQtSZS3uBKMdqPTihQ kzbrVUCL7I9rrU7lr8O6JbC9jgHyhlIOZQh8kn/riiydZ4cjTZ1s8QjbettWIYibdhxb +Ax8IWTURabJ2CZtytROiVaf7UokP4UCIpfI/Ia7IaibCbbs2olaSjKjAbsvlbz7Kt/u fyJZFBFKzswdBm6Em/8wRmr3O2jCINv2Qj0Y/DKhbuxGyJ0+iDOqSc1dTI6MYfIOCazS OlX8K2GNPazcXu4FEUTLMnbWn7q7Ef8fCeVWoNnkqi2MwfxB9S609GaFE0tCujb3z1Gj FKSg== X-Gm-Message-State: ALyK8tL5p8FqYqYhBfDnT6klzNnfpEUY6ZfoQxI06d0v4uas/SaipqXV/sC+6/5FOFL0Sj3U21M9VF4PbkR9Qz5o MIME-Version: 1.0 X-Received: by 10.31.227.197 with SMTP id a188mr2069793vkh.136.1467980299838; Fri, 08 Jul 2016 05:18:19 -0700 (PDT) Received: by 10.159.54.231 with HTTP; Fri, 8 Jul 2016 05:18:19 -0700 (PDT) In-Reply-To: <1467966367146-4081100.post@n3.nabble.com> References: <1467966367146-4081100.post@n3.nabble.com> Date: Fri, 8 Jul 2016 07:18:19 -0500 Message-ID: Subject: Re: Is it ok to store all integers as Strings instead of byte[] in hbase? From: Dima Spivak To: "user@hbase.apache.org" Content-Type: multipart/alternative; boundary=001a114dad2a4f498505371eccff archived-at: Fri, 08 Jul 2016 12:18:33 -0000 --001a114dad2a4f498505371eccff Content-Type: text/plain; charset=UTF-8 Hey Mahesha, It might be worthwhile to read through the architecture section of our ref guide: https://hbase.apache.org/book.html#_architecture Cheers, Dima On Friday, July 8, 2016, Mahesha999 wrote: > I am trying out some hbase code. I realised that when I insert data through > hbase shell using put command, then everything (both numeric and string) is > put as string: > > hbase(main):001:0> create 'employee', {NAME => 'f'} > hbase(main):003:0> put 'employee', 'ganesh','f:age',30 > hbase(main):004:0> put 'employee', 'ganesh','f:desg','mngr' > hbase(main):005:0> scan 'employee' > ROW COLUMN+CELL > ganesh column=f:age, timestamp=1467926618738, value=30 > ganesh column=f:desg, timestamp=1467926639557, value=mngr > > However when I put data using Java API, non-string stuff gets serialized as > byte[]: > > Cluster lNodes = new Cluster(); > lNodes.add("digitate-VirtualBox:8090"); > Client lClient= new Client(lNodes); > RemoteHTable remoteht = new RemoteHTable(lClient, "employee"); > > Put lPut = new Put(Bytes.toBytes("mahesh")); > lPut.add(Bytes.toBytes("f"), Bytes.toBytes("age"), Bytes.toBytes(25)); > lPut.add(Bytes.toBytes("f"), Bytes.toBytes("desg"), Bytes.toBytes("dev")); > remoteht.put(lPut); > > Scan in hbase shell shows age 25 of mahesh is stored as \x00\x00\x00\x19: > > hbase(main):006:0> scan 'employee' > ROW COLUMN+CELL > ganesh column=f:age, timestamp=1467926618738, value=30 > ganesh column=f:desg, timestamp=1467926639557, value=mngr > mahesh column=f:age, timestamp=1467926707712, > value=\x00\x00\x00\x19 > mahesh column=f:desg, timestamp=1467926707712, value=dev > > *1.* Considering I will be storing only numeric and string data in hbase, > what benefits it does provide to store numeric data as byte[] (as in case > of > above) or as string: > lPut.add(Bytes.toBytes("f"), Bytes.toBytes("age"), Bytes.toBytes("25")); > //instead of toBytes(25) > > *2.*Also why strings are stored as is and are not serialized to byte[] even > when put using Java API? > > > > -- > View this message in context: > http://apache-hbase.679495.n3.nabble.com/Is-it-ok-to-store-all-integers-as-Strings-instead-of-byte-in-hbase-tp4081100.html > Sent from the HBase User mailing list archive at Nabble.com. > --001a114dad2a4f498505371eccff--