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 0A562E88B for ; Tue, 19 Feb 2013 16:17:14 +0000 (UTC) Received: (qmail 12604 invoked by uid 500); 19 Feb 2013 16:17:11 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 12456 invoked by uid 500); 19 Feb 2013 16:17:11 -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 12445 invoked by uid 99); 19 Feb 2013 16:17:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Feb 2013 16:17:11 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of dontariq@gmail.com designates 209.85.128.169 as permitted sender) Received: from [209.85.128.169] (HELO mail-ve0-f169.google.com) (209.85.128.169) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Feb 2013 16:17:06 +0000 Received: by mail-ve0-f169.google.com with SMTP id 15so5943551vea.14 for ; Tue, 19 Feb 2013 08:16:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=VtaCtUUoEhTbEw5nUF17TTIu4Q5squS69nNexQDGr0k=; b=0bdapbzuHwSKYoCNQLfXfymdj86m1hbG64cTIMUnBHceZi4xtTlmoYFBJ7tYEvKcr0 Nyab2apyG/vHtkscywRZ1lijE11z+QhZTJapoWS4QFf4xPpSahf3rrTG3MhK1WFI9ieN xqjGe6UuMDhrIKxqrnPGmgKMoafBR/sowJPNBjVqUxYUn6mCTOa3ggJX4UEL9XrWu9n9 oPv1FvZl5D5Zs97Bbwl6QrRIZobVK6Kz586KU1yoVfOdDm40er13i/fGyPbopngH8UX4 paoKuQ6fxqtMA+RlP7DqZFR1G3Bq15uj9qMYEYlj0LaqiYfCPNtoAf2VnIyJsenMrXcy KkNA== X-Received: by 10.58.254.33 with SMTP id af1mr22176090ved.0.1361290606024; Tue, 19 Feb 2013 08:16:46 -0800 (PST) MIME-Version: 1.0 Received: by 10.59.8.227 with HTTP; Tue, 19 Feb 2013 08:16:05 -0800 (PST) In-Reply-To: References: From: Mohammad Tariq Date: Tue, 19 Feb 2013 21:46:05 +0530 Message-ID: Subject: Re: Rowkey design question To: "user@hbase.apache.org" Content-Type: multipart/alternative; boundary=047d7bdc8db002196404d6162beb X-Virus-Checked: Checked by ClamAV on apache.org --047d7bdc8db002196404d6162beb Content-Type: text/plain; charset=ISO-8859-1 Hello Paul, Try this and see if it works : scan.setStartRow(Bytes.toBytes(startDate.getTime() + "")); scan.setStopRow(Bytes.toBytes(endDate.getTime() + 1 + "")); Also try not to use TS as the rowkey, as it may lead to RS hotspotting. Just add a hash to your rowkeys so that data is distributed evenly on all the RSs. Warm Regards, Tariq https://mtariq.jux.com/ cloudfront.blogspot.com On Tue, Feb 19, 2013 at 9:41 PM, Paul van Hoven < paul.van.hoven@googlemail.com> wrote: > Hi, > > I'm currently playing with hbase. The design of the rowkey seems to be > critical. > > The rowkey for a certain database table of mine is: > > timestamp+ipaddress > > It looks something like this when performing a scan on the table in the > shell: > hbase(main):012:0> scan 'ToyDataTable' > ROW COLUMN+CELL > 1357020000000+192.168.178.9 column=CF:SampleCol, > timestamp=1361288601717, value=Entry_1 = 2013-01-01 07:00:00 > > Since I got several rows for different timestamps I'd like to tell a > scan to just a region of the table for example from 2013-01-07 to > 2013-01-09. Previously I only had a timestamp as the rowkey and I > could restrict the rowkey like that: > > SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); > Date startDate = formatter.parse("2013-01-07 > 07:00:00"); > Date endDate = formatter.parse("2013-01-10 > 07:00:00"); > > HTableInterface toyDataTable = > pool.getTable("ToyDataTable"); > Scan scan = new Scan( Bytes.toBytes( > startDate.getTime() ), > Bytes.toBytes( endDate.getTime() ) ); > > But this no longer works with my new design. > > Is there a way to tell the scan object to filter the rows with respect > to the timestamp, or do I have to use a filter object? > --047d7bdc8db002196404d6162beb--