Return-Path: X-Original-To: apmail-accumulo-user-archive@www.apache.org Delivered-To: apmail-accumulo-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 71F1D1831C for ; Tue, 16 Jun 2015 13:37:16 +0000 (UTC) Received: (qmail 20839 invoked by uid 500); 16 Jun 2015 13:37:16 -0000 Delivered-To: apmail-accumulo-user-archive@accumulo.apache.org Received: (qmail 20790 invoked by uid 500); 16 Jun 2015 13:37:16 -0000 Mailing-List: contact user-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@accumulo.apache.org Delivered-To: mailing list user@accumulo.apache.org Received: (qmail 20781 invoked by uid 99); 16 Jun 2015 13:37:16 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Jun 2015 13:37:16 +0000 Received: from mail-yk0-f175.google.com (mail-yk0-f175.google.com [209.85.160.175]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id E22C61A0503 for ; Tue, 16 Jun 2015 13:37:15 +0000 (UTC) Received: by ykdr198 with SMTP id r198so13356261ykd.3 for ; Tue, 16 Jun 2015 06:37:15 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.129.102.65 with SMTP id a62mr475247ywc.19.1434461835027; Tue, 16 Jun 2015 06:37:15 -0700 (PDT) Received: by 10.129.24.211 with HTTP; Tue, 16 Jun 2015 06:37:14 -0700 (PDT) In-Reply-To: <557FB2FC.8090309@gmail.com> References: <557FB2FC.8090309@gmail.com> Date: Tue, 16 Jun 2015 09:37:14 -0400 Message-ID: Subject: Re: How to get the first key of the Tablet servers From: Christopher To: Accumulo User List Content-Type: text/plain; charset=UTF-8 Actually, scanning `new Range($endRow)` will only give you keys in that last row (if it exists). You'd actually want to scan: [null, $endRow] :: for the first split point, $endRow ($endRow, $endRow2] :: for each sequence of two split points, $endRow and $endRow2 ($endRow, null) :: for the last split point You can use the constructor, `Range(Text, boolean, Text, boolean)` for the startRow and stopRow (with inclusive flag set for each, when appropriated). Optionally, you could create a simple iterator based on the provided FirstEntryInRowIterator, called "FirstEntryInTablet", which just returns one item and then nothing else, and then simply scan the entire table with the default options. The only thing returned would be the first entries in each tablet. Of course, all this is assuming you want the first actual (existing) key for each tablet. If you want the first key a tablet could theoretically contain, that's even easier... no scanning necessary. That's just a key comprised of the split point + '\0' for the row, and empty values for everything else (except the first tablet... in the first tablet, the first possible key has a empty byte string for the row). -- Christopher L Tubbs II http://gravatar.com/ctubbsii On Tue, Jun 16, 2015 at 1:24 AM, Josh Elser wrote: > Not sure I understand your question. Do you mean of a Tablet instead of > TabletServer? A TabletServer will host many Tablets. > > Assuming so, the easiest way to get the first key for each Tablet is to > fetch the split points for a table. The split points are the end-row of each > Tablet in a table. > > Then, to get the first keys in each Tablet, construct a `new > Range($endRow)`, open a Scanner and fetch the first Key. Make sure you also > do this with `new Range()` as well to get the first Key in the first Tablet > for the table (the Tablet which starts at -inf). > > There is no easy way that I can think of to determine what the last key in a > Tablet is. What is the reason that you want to explicitly know this? Maybe > there is a different to do what you're trying to do? > > - Josh > > > Rukshan Chathuranga wrote: >> >> hi, >> >> Does anyone know how to get the first or last key of the tablet servers? >> >> Thanks and Regards. >> >> /Rukshan Chathuranga./ >> /Department Of Computer Science & Engineering, >> / >> /Faculty Of Engineering, >> / >> /University Of Moratuwa. //Sri Lanka./ >> /WEB: http://www.rukspot.com/ >> / >> >