|
|
-
Null rowkey with empty get operation
Ben Kim 2012-05-29, 01:12
I have following Get code with HBase 0.92.0
Get get = new Get(Bytes.toBytes(rowkey)); get.addFamily(family); Filter filter = new QualifierFilter(CompareOp.NOT_EQUAL, new BinaryComparator(item)); get.setFilter(filter); Result r = table.get(get);
System.out.println(r); // (1) prints "keyvalues=NONE" System.out.println(Bytes.toString(r.getRow())); // (2) throws NullpointerException
printing out the result shows that all columns in a row was filtered out. but i still want to print out the row key of the empty result. But the value of r.getRow() is null
Shouldn't r.getRow() return the rowkey even if the keyvalues are emtpy? --
*Benjamin Kim** benkimkimben at gmail*
+
Ben Kim 2012-05-29, 01:12
-
RE: Null rowkey with empty get operation
Anoop Sam John 2012-05-29, 05:33
Hi Ben, In HBase rowkey exists with KVs only. As in your case there is no KVs in the result, and so no rowkey. What is the use case that you are referring here? When you issued Get with a rowkey and empty result for that , you know the rowkey already right? I mean any specific reason why you try to find the rowkey from the result object?
-Anoop-
________________________________________ From: Ben Kim [[EMAIL PROTECTED]] Sent: Tuesday, May 29, 2012 6:42 AM To: [EMAIL PROTECTED] Subject: Null rowkey with empty get operation
I have following Get code with HBase 0.92.0
Get get = new Get(Bytes.toBytes(rowkey)); get.addFamily(family); Filter filter = new QualifierFilter(CompareOp.NOT_EQUAL, new BinaryComparator(item)); get.setFilter(filter); Result r = table.get(get);
System.out.println(r); // (1) prints "keyvalues=NONE" System.out.println(Bytes.toString(r.getRow())); // (2) throws NullpointerException
printing out the result shows that all columns in a row was filtered out. but i still want to print out the row key of the empty result. But the value of r.getRow() is null
Shouldn't r.getRow() return the rowkey even if the keyvalues are emtpy? --
*Benjamin Kim** benkimkimben at gmail*
+
Anoop Sam John 2012-05-29, 05:33
-
Re: Null rowkey with empty get operation
Ben Kim 2012-05-29, 07:34
Maybe I showed you a bad example. This makes more sense when it comes to using List<Get> For instance,
List<Get> gets = new ArrayList(); for(String rowkey : rowkeys){ Get get = new Get(Bytes.toBytes(rowkey)); get.addFamily(family); Filter filter = new QualifierFilter(CompareOp.NOT_EQUAL, new BinaryComparator(item)); get.setFilter(filter); gets.add(get); } Result[] results = table.get(get);
Now I have multiple results, I need to find the rowkey of the result that has no keyvalue. but results[0].getRow() is null if results[0] has no keyvalue. so it's hard to derive which row the empty result belongs to :(
Thank you for your response, Ben
On Tue, May 29, 2012 at 2:33 PM, Anoop Sam John <[EMAIL PROTECTED]> wrote:
> Hi Ben, > In HBase rowkey exists with KVs only. As in your case there is no KVs > in the result, and so no rowkey. What is the use case that you are > referring here? When you issued Get with a rowkey and empty result for that > , you know the rowkey already right? I mean any specific reason why you try > to find the rowkey from the result object? > > -Anoop- > > ________________________________________ > From: Ben Kim [[EMAIL PROTECTED]] > Sent: Tuesday, May 29, 2012 6:42 AM > To: [EMAIL PROTECTED] > Subject: Null rowkey with empty get operation > > I have following Get code with HBase 0.92.0 > > Get get = new Get(Bytes.toBytes(rowkey)); > get.addFamily(family); > Filter filter = new QualifierFilter(CompareOp.NOT_EQUAL, new > BinaryComparator(item)); > get.setFilter(filter); > Result r = table.get(get); > > System.out.println(r); // (1) prints "keyvalues=NONE" > System.out.println(Bytes.toString(r.getRow())); // (2) throws > NullpointerException > > > > printing out the result shows that all columns in a row was filtered out. > but i still want to print out the row key of the empty result. > But the value of r.getRow() is null > > Shouldn't r.getRow() return the rowkey even if the keyvalues are emtpy? > > > -- > > *Benjamin Kim** > benkimkimben at gmail* >
--
*Benjamin Kim* **Mo : +82 10.5357.0521* benkimkimben at gmail*
+
Ben Kim 2012-05-29, 07:34
-
RE: Null rowkey with empty get operation
Anoop Sam John 2012-05-29, 08:11
Hi Now it is a bit different case of consideration. As of now you need to deal with your input rowkeys and rowkeys that you get from the Results. empty rows = input rowkeys - rowkeys from result
As Lars said you might need to check with isEmpty() on every Result or null check on result.getRow (). Agree that this wont be straight forward considering the app code.
-Anoop- ________________________________________ From: Ben Kim [[EMAIL PROTECTED]] Sent: Tuesday, May 29, 2012 1:04 PM To: [EMAIL PROTECTED] Subject: Re: Null rowkey with empty get operation
Maybe I showed you a bad example. This makes more sense when it comes to using List<Get> For instance,
List<Get> gets = new ArrayList(); for(String rowkey : rowkeys){ Get get = new Get(Bytes.toBytes(rowkey)); get.addFamily(family); Filter filter = new QualifierFilter(CompareOp.NOT_EQUAL, new BinaryComparator(item)); get.setFilter(filter); gets.add(get); } Result[] results = table.get(get);
Now I have multiple results, I need to find the rowkey of the result that has no keyvalue. but results[0].getRow() is null if results[0] has no keyvalue. so it's hard to derive which row the empty result belongs to :(
Thank you for your response, Ben
On Tue, May 29, 2012 at 2:33 PM, Anoop Sam John <[EMAIL PROTECTED]> wrote:
> Hi Ben, > In HBase rowkey exists with KVs only. As in your case there is no KVs > in the result, and so no rowkey. What is the use case that you are > referring here? When you issued Get with a rowkey and empty result for that > , you know the rowkey already right? I mean any specific reason why you try > to find the rowkey from the result object? > > -Anoop- > > ________________________________________ > From: Ben Kim [[EMAIL PROTECTED]] > Sent: Tuesday, May 29, 2012 6:42 AM > To: [EMAIL PROTECTED] > Subject: Null rowkey with empty get operation > > I have following Get code with HBase 0.92.0 > > Get get = new Get(Bytes.toBytes(rowkey)); > get.addFamily(family); > Filter filter = new QualifierFilter(CompareOp.NOT_EQUAL, new > BinaryComparator(item)); > get.setFilter(filter); > Result r = table.get(get); > > System.out.println(r); // (1) prints "keyvalues=NONE" > System.out.println(Bytes.toString(r.getRow())); // (2) throws > NullpointerException > > > > printing out the result shows that all columns in a row was filtered out. > but i still want to print out the row key of the empty result. > But the value of r.getRow() is null > > Shouldn't r.getRow() return the rowkey even if the keyvalues are emtpy? > > > -- > > *Benjamin Kim** > benkimkimben at gmail* >
--
*Benjamin Kim* **Mo : +82 10.5357.0521* benkimkimben at gmail*
+
Anoop Sam John 2012-05-29, 08:11
-
Re: Null rowkey with empty get operation
Ben Kim 2012-05-29, 10:21
It looks like Result is returning the rowkey of the first keyvalue. That's why I was getting null when getting a Result's rowkey.
in Result.getRow() method it is returning this.kvs[0].getRow()
this probably is to save the cost of a Get RPC call, but i still think that Result should have its own rowkey variable.
On Tue, May 29, 2012 at 5:11 PM, Anoop Sam John <[EMAIL PROTECTED]> wrote:
> Hi > Now it is a bit different case of consideration. As of now you need to > deal with your input rowkeys and rowkeys that you get from the Results. > empty rows = input rowkeys - rowkeys from result > > As Lars said you might need to check with isEmpty() on every Result or > null check on result.getRow (). Agree that this wont be straight forward > considering the app code. > > -Anoop- > ________________________________________ > From: Ben Kim [[EMAIL PROTECTED]] > Sent: Tuesday, May 29, 2012 1:04 PM > To: [EMAIL PROTECTED] > Subject: Re: Null rowkey with empty get operation > > Maybe I showed you a bad example. This makes more sense when it comes to > using List<Get> > For instance, > > List<Get> gets = new ArrayList(); > for(String rowkey : rowkeys){ > Get get = new Get(Bytes.toBytes(rowkey)); > get.addFamily(family); > Filter filter = new QualifierFilter(CompareOp.NOT_EQUAL, new > BinaryComparator(item)); > get.setFilter(filter); > gets.add(get); > } > Result[] results = table.get(get); > > Now I have multiple results, I need to find the rowkey of the result that > has no keyvalue. > but results[0].getRow() is null if results[0] has no keyvalue. so it's > hard to derive which row the empty result belongs to :( > > Thank you for your response, > Ben > > > > On Tue, May 29, 2012 at 2:33 PM, Anoop Sam John <[EMAIL PROTECTED]> > wrote: > > > Hi Ben, > > In HBase rowkey exists with KVs only. As in your case there is no > KVs > > in the result, and so no rowkey. What is the use case that you are > > referring here? When you issued Get with a rowkey and empty result for > that > > , you know the rowkey already right? I mean any specific reason why you > try > > to find the rowkey from the result object? > > > > -Anoop- > > > > ________________________________________ > > From: Ben Kim [[EMAIL PROTECTED]] > > Sent: Tuesday, May 29, 2012 6:42 AM > > To: [EMAIL PROTECTED] > > Subject: Null rowkey with empty get operation > > > > I have following Get code with HBase 0.92.0 > > > > Get get = new Get(Bytes.toBytes(rowkey)); > > get.addFamily(family); > > Filter filter = new QualifierFilter(CompareOp.NOT_EQUAL, new > > BinaryComparator(item)); > > get.setFilter(filter); > > Result r = table.get(get); > > > > System.out.println(r); // (1) prints "keyvalues=NONE" > > System.out.println(Bytes.toString(r.getRow())); // (2) throws > > NullpointerException > > > > > > > > printing out the result shows that all columns in a row was filtered out. > > but i still want to print out the row key of the empty result. > > But the value of r.getRow() is null > > > > Shouldn't r.getRow() return the rowkey even if the keyvalues are emtpy? > > > > > > -- > > > > *Benjamin Kim** > > benkimkimben at gmail* > > > > > > -- > > *Benjamin Kim* > **Mo : +82 10.5357.0521* > benkimkimben at gmail* >
--
*Benjamin Kim* **Mo : +82 10.5357.0521* benkimkimben at gmail*
+
Ben Kim 2012-05-29, 10:21
-
Re: Null rowkey with empty get operation
lars hofhansl 2012-05-29, 08:03
Hi Ben,
check with Result.isEmpty(). If that returns true the Result object has no results.
-- Lars
________________________________ From: Ben Kim <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Sent: Tuesday, May 29, 2012 12:34 AM Subject: Re: Null rowkey with empty get operation Maybe I showed you a bad example. This makes more sense when it comes to using List<Get> For instance,
List<Get> gets = new ArrayList(); for(String rowkey : rowkeys){ Get get = new Get(Bytes.toBytes(rowkey)); get.addFamily(family); Filter filter = new QualifierFilter(CompareOp.NOT_EQUAL, new BinaryComparator(item)); get.setFilter(filter); gets.add(get); } Result[] results = table.get(get);
Now I have multiple results, I need to find the rowkey of the result that has no keyvalue. but results[0].getRow() is null if results[0] has no keyvalue. so it's hard to derive which row the empty result belongs to :(
Thank you for your response, Ben
On Tue, May 29, 2012 at 2:33 PM, Anoop Sam John <[EMAIL PROTECTED]> wrote:
> Hi Ben, > In HBase rowkey exists with KVs only. As in your case there is no KVs > in the result, and so no rowkey. What is the use case that you are > referring here? When you issued Get with a rowkey and empty result for that > , you know the rowkey already right? I mean any specific reason why you try > to find the rowkey from the result object? > > -Anoop- > > ________________________________________ > From: Ben Kim [[EMAIL PROTECTED]] > Sent: Tuesday, May 29, 2012 6:42 AM > To: [EMAIL PROTECTED] > Subject: Null rowkey with empty get operation > > I have following Get code with HBase 0.92.0 > > Get get = new Get(Bytes.toBytes(rowkey)); > get.addFamily(family); > Filter filter = new QualifierFilter(CompareOp.NOT_EQUAL, new > BinaryComparator(item)); > get.setFilter(filter); > Result r = table.get(get); > > System.out.println(r); // (1) prints "keyvalues=NONE" > System.out.println(Bytes.toString(r.getRow())); // (2) throws > NullpointerException > > > > printing out the result shows that all columns in a row was filtered out. > but i still want to print out the row key of the empty result. > But the value of r.getRow() is null > > Shouldn't r.getRow() return the rowkey even if the keyvalues are emtpy? > > > -- > > *Benjamin Kim** > benkimkimben at gmail* >
--
*Benjamin Kim* **Mo : +82 10.5357.0521* benkimkimben at gmail*
+
lars hofhansl 2012-05-29, 08:03
-
Re: Null rowkey with empty get operation
N Keywal 2012-05-29, 10:26
There is a one to one mapping between the result and the get arrays; so the result for rowkeys[i] is in results[i]. That's not what you want?
On Tue, May 29, 2012 at 9:34 AM, Ben Kim <[EMAIL PROTECTED]> wrote: > Maybe I showed you a bad example. This makes more sense when it comes to > using List<Get> > For instance, > > List<Get> gets = new ArrayList(); > for(String rowkey : rowkeys){ > Get get = new Get(Bytes.toBytes(rowkey)); > get.addFamily(family); > Filter filter = new QualifierFilter(CompareOp.NOT_EQUAL, new > BinaryComparator(item)); > get.setFilter(filter); > gets.add(get); > } > Result[] results = table.get(get); > > Now I have multiple results, I need to find the rowkey of the result that > has no keyvalue. > but results[0].getRow() is null if results[0] has no keyvalue. so it's > hard to derive which row the empty result belongs to :( > > Thank you for your response, > Ben > > > > On Tue, May 29, 2012 at 2:33 PM, Anoop Sam John <[EMAIL PROTECTED]> wrote: > >> Hi Ben, >> In HBase rowkey exists with KVs only. As in your case there is no KVs >> in the result, and so no rowkey. What is the use case that you are >> referring here? When you issued Get with a rowkey and empty result for that >> , you know the rowkey already right? I mean any specific reason why you try >> to find the rowkey from the result object? >> >> -Anoop- >> >> ________________________________________ >> From: Ben Kim [[EMAIL PROTECTED]] >> Sent: Tuesday, May 29, 2012 6:42 AM >> To: [EMAIL PROTECTED] >> Subject: Null rowkey with empty get operation >> >> I have following Get code with HBase 0.92.0 >> >> Get get = new Get(Bytes.toBytes(rowkey)); >> get.addFamily(family); >> Filter filter = new QualifierFilter(CompareOp.NOT_EQUAL, new >> BinaryComparator(item)); >> get.setFilter(filter); >> Result r = table.get(get); >> >> System.out.println(r); // (1) prints "keyvalues=NONE" >> System.out.println(Bytes.toString(r.getRow())); // (2) throws >> NullpointerException >> >> >> >> printing out the result shows that all columns in a row was filtered out. >> but i still want to print out the row key of the empty result. >> But the value of r.getRow() is null >> >> Shouldn't r.getRow() return the rowkey even if the keyvalues are emtpy? >> >> >> -- >> >> *Benjamin Kim** >> benkimkimben at gmail* >> > > > > -- > > *Benjamin Kim* > **Mo : +82 10.5357.0521* > benkimkimben at gmail*
+
N Keywal 2012-05-29, 10:26
|
|