Hbase: Is possible to filter by integer value if the value is saved as string?

2013-07-18 Thread Frank Luo
I don't think it is possible, but would like to confirm with smart folks out 
there.

Supposing I have a cell storing an integer but in string presentation. For 
example, here is how I put a value of 200:

put.add(family, qualifier, Bytes.toBytes(200));

Now, I want to scan with a filter that only return if the value is larger than 
250. Is that possible?

Thanks in advance

Frank


Re: Hbase: Is possible to filter by integer value if the value is saved as string?

2013-07-18 Thread Ted Yu
Looks like you should be able to do so by passing your own comparator to:

  public SingleColumnValueFilter(final byte [] family, final byte []
qualifier,

  final CompareOp compareOp, final ByteArrayComparable comparator) {
Cheers

On Thu, Jul 18, 2013 at 1:20 PM, Frank Luo j...@merkleinc.com wrote:

 I don't think it is possible, but would like to confirm with smart folks
 out there.

 Supposing I have a cell storing an integer but in string presentation. For
 example, here is how I put a value of 200:

 put.add(family, qualifier, Bytes.toBytes(200));

 Now, I want to scan with a filter that only return if the value is larger
 than 250. Is that possible?

 Thanks in advance

 Frank



RE: Hbase: Is possible to filter by integer value if the value is saved as string?

2013-07-18 Thread Frank Luo
That requires creating my own ByteArrayComparable class and deploy to all 
servers, right?

My company doesn't want to customize hbase, hence is not an option to me.

-Original Message-
From: Ted Yu [mailto:yuzhih...@gmail.com] 
Sent: Thursday, July 18, 2013 3:25 PM
To: user@hbase.apache.org
Subject: Re: Hbase: Is possible to filter by integer value if the value is 
saved as string?

Looks like you should be able to do so by passing your own comparator to:

  public SingleColumnValueFilter(final byte [] family, final byte [] qualifier,

  final CompareOp compareOp, final ByteArrayComparable comparator) { Cheers

On Thu, Jul 18, 2013 at 1:20 PM, Frank Luo j...@merkleinc.com wrote:

 I don't think it is possible, but would like to confirm with smart 
 folks out there.

 Supposing I have a cell storing an integer but in string presentation. 
 For example, here is how I put a value of 200:

 put.add(family, qualifier, Bytes.toBytes(200));

 Now, I want to scan with a filter that only return if the value is 
 larger than 250. Is that possible?

 Thanks in advance

 Frank




Bulk Load on HBase 0.95.1-hadoop1

2013-07-18 Thread Jonathan Cardoso
I was trying to follow the instructions from
thishttp://www.thecloudavenue.com/2013/04/bulk-loading-data-in-hbase.htmlwebsite
to insert a lot of data to HBase using MapReduce, but as with other
approaches I found on the web I have always the same problem:

I have compile erros because classes from package
org.apache.hadoop.hbase.mapreduce.* cannot be found.

 To run a mapreduce task using HBase I have to downgrade the version of my
HBase to, for example, 0.92?


*Jonathan Cardoso** **
Universidade Federal de Goias*


Re: Bulk Load on HBase 0.95.1-hadoop1

2013-07-18 Thread Jean-Daniel Cryans
0.95.1 is a developer preview release, if you are just starting with HBase
please grab the stable release from 0.94, for example
http://mirrors.sonic.net/apache/hbase/stable/

J-D


On Thu, Jul 18, 2013 at 1:51 PM, Jonathan Cardoso
jonathancar...@gmail.comwrote:

 I was trying to follow the instructions from
 thishttp://www.thecloudavenue.com/2013/04/bulk-loading-data-in-hbase.html
 website
 to insert a lot of data to HBase using MapReduce, but as with other
 approaches I found on the web I have always the same problem:

 I have compile erros because classes from package
 org.apache.hadoop.hbase.mapreduce.* cannot be found.

  To run a mapreduce task using HBase I have to downgrade the version of my
 HBase to, for example, 0.92?


 *Jonathan Cardoso** **
 Universidade Federal de Goias*



Re: Bulk Load on HBase 0.95.1-hadoop1

2013-07-18 Thread Elliott Clark
0.95 currently has all of the map-reduce code located in hbase-server
module.  Check there if you are just trying to poke around.  However
like JD said this is a developer release so make sure you're aware
there will be sharp edges.

On Thu, Jul 18, 2013 at 1:55 PM, Jean-Daniel Cryans jdcry...@apache.org wrote:
 0.95.1 is a developer preview release, if you are just starting with HBase
 please grab the stable release from 0.94, for example
 http://mirrors.sonic.net/apache/hbase/stable/

 J-D


 On Thu, Jul 18, 2013 at 1:51 PM, Jonathan Cardoso
 jonathancar...@gmail.comwrote:

 I was trying to follow the instructions from
 thishttp://www.thecloudavenue.com/2013/04/bulk-loading-data-in-hbase.html
 website
 to insert a lot of data to HBase using MapReduce, but as with other
 approaches I found on the web I have always the same problem:

 I have compile erros because classes from package
 org.apache.hadoop.hbase.mapreduce.* cannot be found.

  To run a mapreduce task using HBase I have to downgrade the version of my
 HBase to, for example, 0.92?


 *Jonathan Cardoso** **
 Universidade Federal de Goias*



Re: Hbase: Is possible to filter by integer value if the value is saved as string?

2013-07-18 Thread Kevin
Sure, try using the BinaryComparator. For example,

BinaryComparator c = new BinaryComparator(Bytes.toBytes(200));
System.out.println(c.compareTo(Bytes.toBytes(201))); // returns -1


On Thu, Jul 18, 2013 at 4:28 PM, Frank Luo j...@merkleinc.com wrote:

 That requires creating my own ByteArrayComparable class and deploy to all
 servers, right?

 My company doesn't want to customize hbase, hence is not an option to me.

 -Original Message-
 From: Ted Yu [mailto:yuzhih...@gmail.com]
 Sent: Thursday, July 18, 2013 3:25 PM
 To: user@hbase.apache.org
 Subject: Re: Hbase: Is possible to filter by integer value if the value is
 saved as string?

 Looks like you should be able to do so by passing your own comparator to:

   public SingleColumnValueFilter(final byte [] family, final byte []
 qualifier,

   final CompareOp compareOp, final ByteArrayComparable comparator) {
 Cheers

 On Thu, Jul 18, 2013 at 1:20 PM, Frank Luo j...@merkleinc.com wrote:

  I don't think it is possible, but would like to confirm with smart
  folks out there.
 
  Supposing I have a cell storing an integer but in string presentation.
  For example, here is how I put a value of 200:
 
  put.add(family, qualifier, Bytes.toBytes(200));
 
  Now, I want to scan with a filter that only return if the value is
  larger than 250. Is that possible?
 
  Thanks in advance
 
  Frank
 




Re: Hbase: Is possible to filter by integer value if the value is saved as string?

2013-07-18 Thread Ted Yu
What would happen to this ?

System.out.println(c.compareTo(Bytes.toBytes(30)));

On Thu, Jul 18, 2013 at 5:55 PM, Kevin kevin.macksa...@gmail.com wrote:

 Sure, try using the BinaryComparator. For example,

 BinaryComparator c = new BinaryComparator(Bytes.toBytes(200));
 System.out.println(c.compareTo(Bytes.toBytes(201))); // returns
 -1


 On Thu, Jul 18, 2013 at 4:28 PM, Frank Luo j...@merkleinc.com wrote:

  That requires creating my own ByteArrayComparable class and deploy to all
  servers, right?
 
  My company doesn't want to customize hbase, hence is not an option to
 me.
 
  -Original Message-
  From: Ted Yu [mailto:yuzhih...@gmail.com]
  Sent: Thursday, July 18, 2013 3:25 PM
  To: user@hbase.apache.org
  Subject: Re: Hbase: Is possible to filter by integer value if the value
 is
  saved as string?
 
  Looks like you should be able to do so by passing your own comparator to:
 
public SingleColumnValueFilter(final byte [] family, final byte []
  qualifier,
 
final CompareOp compareOp, final ByteArrayComparable comparator) {
  Cheers
 
  On Thu, Jul 18, 2013 at 1:20 PM, Frank Luo j...@merkleinc.com wrote:
 
   I don't think it is possible, but would like to confirm with smart
   folks out there.
  
   Supposing I have a cell storing an integer but in string presentation.
   For example, here is how I put a value of 200:
  
   put.add(family, qualifier, Bytes.toBytes(200));
  
   Now, I want to scan with a filter that only return if the value is
   larger than 250. Is that possible?
  
   Thanks in advance
  
   Frank
  
 
 



Re: Bulk Load on HBase 0.95.1-hadoop1

2013-07-18 Thread Jonathan Cardoso
Great! Thank you guys

*Jonathan Cardoso** **
Universidade Federal de Goias*


2013/7/18 Elliott Clark ecl...@apache.org

 0.95 currently has all of the map-reduce code located in hbase-server
 module.  Check there if you are just trying to poke around.  However
 like JD said this is a developer release so make sure you're aware
 there will be sharp edges.

 On Thu, Jul 18, 2013 at 1:55 PM, Jean-Daniel Cryans jdcry...@apache.org
 wrote:
  0.95.1 is a developer preview release, if you are just starting with
 HBase
  please grab the stable release from 0.94, for example
  http://mirrors.sonic.net/apache/hbase/stable/
 
  J-D
 
 
  On Thu, Jul 18, 2013 at 1:51 PM, Jonathan Cardoso
  jonathancar...@gmail.comwrote:
 
  I was trying to follow the instructions from
  this
 http://www.thecloudavenue.com/2013/04/bulk-loading-data-in-hbase.html
  website
  to insert a lot of data to HBase using MapReduce, but as with other
  approaches I found on the web I have always the same problem:
 
  I have compile erros because classes from package
  org.apache.hadoop.hbase.mapreduce.* cannot be found.
 
   To run a mapreduce task using HBase I have to downgrade the version of
 my
  HBase to, for example, 0.92?
 
 
  *Jonathan Cardoso** **
  Universidade Federal de Goias*
 



How to join 2 tables using hadoop?

2013-07-18 Thread Pavan Sudheendra
Hi,

I know that HBase by default doesn't support table joins like RDBMS..
But anyway, I have a table who value contains a json with a particular
ID in it..
This id references another table where it is a key..

I want to fetch the id first from table A , query table 2 and get its
corresponding value..

What is the best way of achieving this using the MR framework?
Apologizes, i'm still new to Hadoop and HBase so please go easy on me.

Thanks for any help

--
Regards-
Pavan


Re: Hbase: Is possible to filter by integer value if the value is saved as string?

2013-07-18 Thread anil gupta
Only way to achieve this is to write your own ByteArrayComparable.
BinaryComparator wont work for your case.
But, I am wondering why you would store an Integer as String when you want
to do numerical comparison?


On Thu, Jul 18, 2013 at 6:03 PM, Ted Yu yuzhih...@gmail.com wrote:

 What would happen to this ?

 System.out.println(c.compareTo(Bytes.toBytes(30)));

 On Thu, Jul 18, 2013 at 5:55 PM, Kevin kevin.macksa...@gmail.com wrote:

  Sure, try using the BinaryComparator. For example,
 
  BinaryComparator c = new BinaryComparator(Bytes.toBytes(200));
  System.out.println(c.compareTo(Bytes.toBytes(201))); // returns
  -1
 
 
  On Thu, Jul 18, 2013 at 4:28 PM, Frank Luo j...@merkleinc.com wrote:
 
   That requires creating my own ByteArrayComparable class and deploy to
 all
   servers, right?
  
   My company doesn't want to customize hbase, hence is not an option to
  me.
  
   -Original Message-
   From: Ted Yu [mailto:yuzhih...@gmail.com]
   Sent: Thursday, July 18, 2013 3:25 PM
   To: user@hbase.apache.org
   Subject: Re: Hbase: Is possible to filter by integer value if the value
  is
   saved as string?
  
   Looks like you should be able to do so by passing your own comparator
 to:
  
 public SingleColumnValueFilter(final byte [] family, final byte []
   qualifier,
  
 final CompareOp compareOp, final ByteArrayComparable comparator)
 {
   Cheers
  
   On Thu, Jul 18, 2013 at 1:20 PM, Frank Luo j...@merkleinc.com wrote:
  
I don't think it is possible, but would like to confirm with smart
folks out there.
   
Supposing I have a cell storing an integer but in string
 presentation.
For example, here is how I put a value of 200:
   
put.add(family, qualifier, Bytes.toBytes(200));
   
Now, I want to scan with a filter that only return if the value is
larger than 250. Is that possible?
   
Thanks in advance
   
Frank
   
  
  
 




-- 
Thanks  Regards,
Anil Gupta