|
Vajrakumar
2012-11-21, 18:04
Doug Meil
2012-11-21, 18:50
Vajrakumar
2012-11-22, 10:16
Doug Meil
2012-11-22, 12:17
Ryan Smith
2012-11-22, 12:20
Harsh J
2012-11-22, 14:50
Mohammad Tariq
2012-11-22, 15:46
Ryan Smith
2012-11-22, 15:56
|
-
Paging On HBASE like solrVajrakumar 2012-11-21, 18:04
Hello all,
As we do paging in solr using start and rowCount I need to implement same through hbase. In Detail: I have 1000 rows data which I need to display in 10 pages each page containing 100 rows. So on click of next page we will send current rowStart (1,101,201,301,401,501...) and rowCount (100 for all the pages) to a method which will query hbase and return me the result. One solution is to always query more than rowCount starting from th rowkey of last passed row, and in a for loop count depending on row key and return when it becomes 100 (i.e., rowCount) . But its poor solution i know. Thanks in advance. Sent from Samsung Mobile +
Vajrakumar 2012-11-21, 18:04
-
Re: Paging On HBASE like solrDoug Meil 2012-11-21, 18:50
Hi there, Pretty similar approach with Hbase. See the Scan class. http://hbase.apache.org/book.html#data_model_operations On 11/21/12 1:04 PM, "Vajrakumar" <[EMAIL PROTECTED]> wrote: >Hello all, >As we do paging in solr using start and rowCount I need to implement same >through hbase. > >In Detail: >I have 1000 rows data which I need to display in 10 pages each page >containing 100 rows. >So on click of next page we will send current rowStart >(1,101,201,301,401,501...) and rowCount (100 for all the pages) to a >method which will query hbase and return me the result. > >One solution is to always query more than rowCount starting from th >rowkey of last passed row, and in a for loop count depending on row key >and return when it becomes 100 (i.e., rowCount) . But its poor solution i >know. > >Thanks in advance. > >Sent from Samsung Mobile +
Doug Meil 2012-11-21, 18:50
-
RE: Paging On HBASE like solrVajrakumar 2012-11-22, 10:16
Hello Doug,
First of all thanks for taking time to reply. As per my knowledge goes below two lines take the rowkey as a parameter for representing start and end. scan.setStartRow( Bytes.toBytes("row")); // start key is inclusive scan.setStopRow( Bytes.toBytes("row" + (char)0)); // stop key is exclusive But, In my case irrespective of rowkey I need 100 rows always. If I go with this concept if 5 rows are deleted in between 1 to 100 then it will give me 95 but not 100. But for me always I need 100 (I mean rowCount whatever I pass) rows. And as after usage there may be deletions of rows or adding and all on DB, I can't keep track of rows for this paging.. Paging needs a fixed number of rows in each page always. -----Original Message----- From: Doug Meil [mailto:[EMAIL PROTECTED]] Sent: 22 November 2012 00:21 To: [EMAIL PROTECTED] Subject: Re: Paging On HBASE like solr Hi there, Pretty similar approach with Hbase. See the Scan class. http://hbase.apache.org/book.html#data_model_operations On 11/21/12 1:04 PM, "Vajrakumar" <[EMAIL PROTECTED]> wrote: >Hello all, >As we do paging in solr using start and rowCount I need to implement >same through hbase. > >In Detail: >I have 1000 rows data which I need to display in 10 pages each page >containing 100 rows. >So on click of next page we will send current rowStart >(1,101,201,301,401,501...) and rowCount (100 for all the pages) to a >method which will query hbase and return me the result. > >One solution is to always query more than rowCount starting from th >rowkey of last passed row, and in a for loop count depending on row key >and return when it becomes 100 (i.e., rowCount) . But its poor solution >i know. > >Thanks in advance. > >Sent from Samsung Mobile +
Vajrakumar 2012-11-22, 10:16
-
Re: Paging On HBASE like solrDoug Meil 2012-11-22, 12:17
Hi there- Then don't use an end-row and break out of the loop when you hit 100 rows. On 11/22/12 5:16 AM, "Vajrakumar" <[EMAIL PROTECTED]> wrote: >Hello Doug, >First of all thanks for taking time to reply. > >As per my knowledge goes below two lines take the rowkey as a parameter >for >representing start and end. > >scan.setStartRow( Bytes.toBytes("row")); // start key is >inclusive >scan.setStopRow( Bytes.toBytes("row" + (char)0)); // stop key is >exclusive > > >But, >In my case irrespective of rowkey I need 100 rows always. If I go with >this >concept if 5 rows are deleted in between 1 to 100 then it will give me 95 >but not 100. >But for me always I need 100 (I mean rowCount whatever I pass) rows. > > >And as after usage there may be deletions of rows or adding and all on >DB, I >can't keep track of rows for this paging.. >Paging needs a fixed number of rows in each page always. > > > > >-----Original Message----- >From: Doug Meil [mailto:[EMAIL PROTECTED]] >Sent: 22 November 2012 00:21 >To: [EMAIL PROTECTED] >Subject: Re: Paging On HBASE like solr > > >Hi there, > >Pretty similar approach with Hbase. See the Scan class. > >http://hbase.apache.org/book.html#data_model_operations > > > > > > >On 11/21/12 1:04 PM, "Vajrakumar" <[EMAIL PROTECTED]> wrote: > >>Hello all, >>As we do paging in solr using start and rowCount I need to implement >>same through hbase. >> >>In Detail: >>I have 1000 rows data which I need to display in 10 pages each page >>containing 100 rows. >>So on click of next page we will send current rowStart >>(1,101,201,301,401,501...) and rowCount (100 for all the pages) to a >>method which will query hbase and return me the result. >> >>One solution is to always query more than rowCount starting from th >>rowkey of last passed row, and in a for loop count depending on row key >>and return when it becomes 100 (i.e., rowCount) . But its poor solution >>i know. >> >>Thanks in advance. >> >>Sent from Samsung Mobile > > > > +
Doug Meil 2012-11-22, 12:17
-
Re: Paging On HBASE like solrRyan Smith 2012-11-22, 12:20
But then the range might not be respected. I think another way to ask
is, is it possible to iterate over the rowkeys in an hbase table sequentially? On Thu, Nov 22, 2012 at 7:17 AM, Doug Meil <[EMAIL PROTECTED]>wrote: > > Hi there- > > Then don't use an end-row and break out of the loop when you hit 100 rows. > > > > > > On 11/22/12 5:16 AM, "Vajrakumar" <[EMAIL PROTECTED]> wrote: > > >Hello Doug, > >First of all thanks for taking time to reply. > > > >As per my knowledge goes below two lines take the rowkey as a parameter > >for > >representing start and end. > > > >scan.setStartRow( Bytes.toBytes("row")); // start key is > >inclusive > >scan.setStopRow( Bytes.toBytes("row" + (char)0)); // stop key is > >exclusive > > > > > >But, > >In my case irrespective of rowkey I need 100 rows always. If I go with > >this > >concept if 5 rows are deleted in between 1 to 100 then it will give me 95 > >but not 100. > >But for me always I need 100 (I mean rowCount whatever I pass) rows. > > > > > >And as after usage there may be deletions of rows or adding and all on > >DB, I > >can't keep track of rows for this paging.. > >Paging needs a fixed number of rows in each page always. > > > > > > > > > >-----Original Message----- > >From: Doug Meil [mailto:[EMAIL PROTECTED]] > >Sent: 22 November 2012 00:21 > >To: [EMAIL PROTECTED] > >Subject: Re: Paging On HBASE like solr > > > > > >Hi there, > > > >Pretty similar approach with Hbase. See the Scan class. > > > >http://hbase.apache.org/book.html#data_model_operations > > > > > > > > > > > > > >On 11/21/12 1:04 PM, "Vajrakumar" <[EMAIL PROTECTED]> wrote: > > > >>Hello all, > >>As we do paging in solr using start and rowCount I need to implement > >>same through hbase. > >> > >>In Detail: > >>I have 1000 rows data which I need to display in 10 pages each page > >>containing 100 rows. > >>So on click of next page we will send current rowStart > >>(1,101,201,301,401,501...) and rowCount (100 for all the pages) to a > >>method which will query hbase and return me the result. > >> > >>One solution is to always query more than rowCount starting from th > >>rowkey of last passed row, and in a for loop count depending on row key > >>and return when it becomes 100 (i.e., rowCount) . But its poor solution > >>i know. > >> > >>Thanks in advance. > >> > >>Sent from Samsung Mobile > > > > > > > > > > > +
Ryan Smith 2012-11-22, 12:20
-
Re: Paging On HBASE like solrHarsh J 2012-11-22, 14:50
Ryan,
Not sure I understood what you meant. As I see it, there are two things when you have a start key and need a limited scan: - Stop at 100th consecutive row, even if there are holes in the actual consecutive key range. -- This is possible with a start key plus boundary stop key that is 100 + start key, correct? You may get < 100 but only cause you have defined the scanner to behave that way. - Stop at 100th consecutive available-data row. -- This is possible with a naive counter as you loop over a scanner result object with just a start key, correct? You may get < 100 in a whole count iteration, only if there is no further data to fetch in the table. A result scanner object does iterate over the specified range (or the lack thereof, which evaluates to table's limits) in sequential manner. The result scanner object's general iterative next() doesn't return a whole list of rows in one call. Would this not work for you? On Thu, Nov 22, 2012 at 5:50 PM, Ryan Smith <[EMAIL PROTECTED]> wrote: > But then the range might not be respected. I think another way to ask > is, is it possible to iterate over the rowkeys in an hbase table > sequentially? > > On Thu, Nov 22, 2012 at 7:17 AM, Doug Meil <[EMAIL PROTECTED]>wrote: > >> >> Hi there- >> >> Then don't use an end-row and break out of the loop when you hit 100 rows. >> >> >> >> >> >> On 11/22/12 5:16 AM, "Vajrakumar" <[EMAIL PROTECTED]> wrote: >> >> >Hello Doug, >> >First of all thanks for taking time to reply. >> > >> >As per my knowledge goes below two lines take the rowkey as a parameter >> >for >> >representing start and end. >> > >> >scan.setStartRow( Bytes.toBytes("row")); // start key is >> >inclusive >> >scan.setStopRow( Bytes.toBytes("row" + (char)0)); // stop key is >> >exclusive >> > >> > >> >But, >> >In my case irrespective of rowkey I need 100 rows always. If I go with >> >this >> >concept if 5 rows are deleted in between 1 to 100 then it will give me 95 >> >but not 100. >> >But for me always I need 100 (I mean rowCount whatever I pass) rows. >> > >> > >> >And as after usage there may be deletions of rows or adding and all on >> >DB, I >> >can't keep track of rows for this paging.. >> >Paging needs a fixed number of rows in each page always. >> > >> > >> > >> > >> >-----Original Message----- >> >From: Doug Meil [mailto:[EMAIL PROTECTED]] >> >Sent: 22 November 2012 00:21 >> >To: [EMAIL PROTECTED] >> >Subject: Re: Paging On HBASE like solr >> > >> > >> >Hi there, >> > >> >Pretty similar approach with Hbase. See the Scan class. >> > >> >http://hbase.apache.org/book.html#data_model_operations >> > >> > >> > >> > >> > >> > >> >On 11/21/12 1:04 PM, "Vajrakumar" <[EMAIL PROTECTED]> wrote: >> > >> >>Hello all, >> >>As we do paging in solr using start and rowCount I need to implement >> >>same through hbase. >> >> >> >>In Detail: >> >>I have 1000 rows data which I need to display in 10 pages each page >> >>containing 100 rows. >> >>So on click of next page we will send current rowStart >> >>(1,101,201,301,401,501...) and rowCount (100 for all the pages) to a >> >>method which will query hbase and return me the result. >> >> >> >>One solution is to always query more than rowCount starting from th >> >>rowkey of last passed row, and in a for loop count depending on row key >> >>and return when it becomes 100 (i.e., rowCount) . But its poor solution >> >>i know. >> >> >> >>Thanks in advance. >> >> >> >>Sent from Samsung Mobile >> > >> > >> > >> > >> >> >> -- Harsh J +
Harsh J 2012-11-22, 14:50
-
Re: Paging On HBASE like solrMohammad Tariq 2012-11-22, 15:46
Hello Vajra,
Give Hbase PageFilter a shot and see if it works for you. You need to specify a pageSize parameter, which controls how many rows per page should be returned. One thing which you have to keep in mind is to remember the last row that was returned. HTH Regards, Mohammad Tariq On Thu, Nov 22, 2012 at 8:20 PM, Harsh J <[EMAIL PROTECTED]> wrote: > Ryan, > > Not sure I understood what you meant. As I see it, there are two > things when you have a start key and need a limited scan: > > - Stop at 100th consecutive row, even if there are holes in the actual > consecutive key range. > -- This is possible with a start key plus boundary stop key that is > 100 + start key, correct? You may get < 100 but only cause you have > defined the scanner to behave that way. > > - Stop at 100th consecutive available-data row. > -- This is possible with a naive counter as you loop over a scanner > result object with just a start key, correct? You may get < 100 in a > whole count iteration, only if there is no further data to fetch in > the table. > > A result scanner object does iterate over the specified range (or the > lack thereof, which evaluates to table's limits) in sequential manner. > The result scanner object's general iterative next() doesn't return a > whole list of rows in one call. > > Would this not work for you? > > On Thu, Nov 22, 2012 at 5:50 PM, Ryan Smith <[EMAIL PROTECTED]> > wrote: > > But then the range might not be respected. I think another way to > ask > > is, is it possible to iterate over the rowkeys in an hbase table > > sequentially? > > > > On Thu, Nov 22, 2012 at 7:17 AM, Doug Meil < > [EMAIL PROTECTED]>wrote: > > > >> > >> Hi there- > >> > >> Then don't use an end-row and break out of the loop when you hit 100 > rows. > >> > >> > >> > >> > >> > >> On 11/22/12 5:16 AM, "Vajrakumar" <[EMAIL PROTECTED]> wrote: > >> > >> >Hello Doug, > >> >First of all thanks for taking time to reply. > >> > > >> >As per my knowledge goes below two lines take the rowkey as a > parameter > >> >for > >> >representing start and end. > >> > > >> >scan.setStartRow( Bytes.toBytes("row")); // start > key is > >> >inclusive > >> >scan.setStopRow( Bytes.toBytes("row" + (char)0)); // stop key is > >> >exclusive > >> > > >> > > >> >But, > >> >In my case irrespective of rowkey I need 100 rows always. If I go with > >> >this > >> >concept if 5 rows are deleted in between 1 to 100 then it will give me > 95 > >> >but not 100. > >> >But for me always I need 100 (I mean rowCount whatever I pass) rows. > >> > > >> > > >> >And as after usage there may be deletions of rows or adding and all on > >> >DB, I > >> >can't keep track of rows for this paging.. > >> >Paging needs a fixed number of rows in each page always. > >> > > >> > > >> > > >> > > >> >-----Original Message----- > >> >From: Doug Meil [mailto:[EMAIL PROTECTED]] > >> >Sent: 22 November 2012 00:21 > >> >To: [EMAIL PROTECTED] > >> >Subject: Re: Paging On HBASE like solr > >> > > >> > > >> >Hi there, > >> > > >> >Pretty similar approach with Hbase. See the Scan class. > >> > > >> >http://hbase.apache.org/book.html#data_model_operations > >> > > >> > > >> > > >> > > >> > > >> > > >> >On 11/21/12 1:04 PM, "Vajrakumar" <[EMAIL PROTECTED]> wrote: > >> > > >> >>Hello all, > >> >>As we do paging in solr using start and rowCount I need to implement > >> >>same through hbase. > >> >> > >> >>In Detail: > >> >>I have 1000 rows data which I need to display in 10 pages each page > >> >>containing 100 rows. > >> >>So on click of next page we will send current rowStart > >> >>(1,101,201,301,401,501...) and rowCount (100 for all the pages) to a > >> >>method which will query hbase and return me the result. > >> >> > >> >>One solution is to always query more than rowCount starting from th > >> >>rowkey of last passed row, and in a for loop count depending on row > key > >> >>and return when it becomes 100 (i.e., rowCount) . But its poor +
Mohammad Tariq 2012-11-22, 15:46
-
Re: Paging On HBASE like solrRyan Smith 2012-11-22, 15:56
Thanks Harsh,
Thats how I understood hbase table scans to work currently. However I need true sequential rowscans. I currently run a MR job to create solr indexes which give me sequential access to the rowkey data. Just wondering if HBase offered a native solution as of yet. Thanks again,-Ryan On Thu, Nov 22, 2012 at 9:50 AM, Harsh J <[EMAIL PROTECTED]> wrote: > Ryan, > > Not sure I understood what you meant. As I see it, there are two > things when you have a start key and need a limited scan: > > - Stop at 100th consecutive row, even if there are holes in the actual > consecutive key range. > -- This is possible with a start key plus boundary stop key that is > 100 + start key, correct? You may get < 100 but only cause you have > defined the scanner to behave that way. > > - Stop at 100th consecutive available-data row. > -- This is possible with a naive counter as you loop over a scanner > result object with just a start key, correct? You may get < 100 in a > whole count iteration, only if there is no further data to fetch in > the table. > > A result scanner object does iterate over the specified range (or the > lack thereof, which evaluates to table's limits) in sequential manner. > The result scanner object's general iterative next() doesn't return a > whole list of rows in one call. > > Would this not work for you? > > On Thu, Nov 22, 2012 at 5:50 PM, Ryan Smith <[EMAIL PROTECTED]> > wrote: > > But then the range might not be respected. I think another way to > ask > > is, is it possible to iterate over the rowkeys in an hbase table > > sequentially? > > > > On Thu, Nov 22, 2012 at 7:17 AM, Doug Meil < > [EMAIL PROTECTED]>wrote: > > > >> > >> Hi there- > >> > >> Then don't use an end-row and break out of the loop when you hit 100 > rows. > >> > >> > >> > >> > >> > >> On 11/22/12 5:16 AM, "Vajrakumar" <[EMAIL PROTECTED]> wrote: > >> > >> >Hello Doug, > >> >First of all thanks for taking time to reply. > >> > > >> >As per my knowledge goes below two lines take the rowkey as a > parameter > >> >for > >> >representing start and end. > >> > > >> >scan.setStartRow( Bytes.toBytes("row")); // start > key is > >> >inclusive > >> >scan.setStopRow( Bytes.toBytes("row" + (char)0)); // stop key is > >> >exclusive > >> > > >> > > >> >But, > >> >In my case irrespective of rowkey I need 100 rows always. If I go with > >> >this > >> >concept if 5 rows are deleted in between 1 to 100 then it will give me > 95 > >> >but not 100. > >> >But for me always I need 100 (I mean rowCount whatever I pass) rows. > >> > > >> > > >> >And as after usage there may be deletions of rows or adding and all on > >> >DB, I > >> >can't keep track of rows for this paging.. > >> >Paging needs a fixed number of rows in each page always. > >> > > >> > > >> > > >> > > >> >-----Original Message----- > >> >From: Doug Meil [mailto:[EMAIL PROTECTED]] > >> >Sent: 22 November 2012 00:21 > >> >To: [EMAIL PROTECTED] > >> >Subject: Re: Paging On HBASE like solr > >> > > >> > > >> >Hi there, > >> > > >> >Pretty similar approach with Hbase. See the Scan class. > >> > > >> >http://hbase.apache.org/book.html#data_model_operations > >> > > >> > > >> > > >> > > >> > > >> > > >> >On 11/21/12 1:04 PM, "Vajrakumar" <[EMAIL PROTECTED]> wrote: > >> > > >> >>Hello all, > >> >>As we do paging in solr using start and rowCount I need to implement > >> >>same through hbase. > >> >> > >> >>In Detail: > >> >>I have 1000 rows data which I need to display in 10 pages each page > >> >>containing 100 rows. > >> >>So on click of next page we will send current rowStart > >> >>(1,101,201,301,401,501...) and rowCount (100 for all the pages) to a > >> >>method which will query hbase and return me the result. > >> >> > >> >>One solution is to always query more than rowCount starting from th > >> >>rowkey of last passed row, and in a for loop count depending on row > key > >> >>and return when it becomes 100 (i.e., rowCount) . But its poor +
Ryan Smith 2012-11-22, 15:56
|