hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stack <st...@duboce.net>
Subject Re: HBase shell providing wrong results with startrow(with composite key having String and Ints)
Date Wed, 10 Jun 2015 15:06:31 GMT
On Mon, Jun 8, 2015 at 10:27 PM, anil gupta <anilgupta84@gmail.com> wrote:

> So, if we have to match against non-string data in hbase shell. We should
> always use double quotes?


Double-quotes means the shell (ruby) will interpret and undo any escaping
-- e..g. showing as hex -- of binary characters. What we emit on the shell
is a combo of ruby escaping and our running all through
https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/util/Bytes.html#toStringBinary(byte[])
first.

If you type 'help' in the shell on the end we try to say this but could do
a better job:

"If you are using binary keys or values and need to enter them in the
shell, use
double-quote'd hexadecimal representation. For example:

  hbase> get 't1', "key\x03\x3f\xcd"
  hbase> get 't1', "key\003\023\011"
  hbase> put 't1', "test\xef\xff", 'f1:', "\x01\x33\x40""

St.Ack




> Even for matching values of cells?
>
> On Mon, Jun 8, 2015 at 9:23 PM, Ted Yu <yuzhihong@gmail.com> wrote:
>
> > Double quotes allow you to do string interpolation.
> > Aother difference (one pertinent to Anil's question) is that 'escape
> > sequence' does not work using single quote.
> >
> > Cheers
> >
> > On Mon, Jun 8, 2015 at 9:11 PM, anil gupta <anilgupta84@gmail.com>
> wrote:
> >
> > > Hi Jean,
> > >
> > > My bad. I gave a wrong illustration. This is the query is was trying on
> > my
> > > composite key:
> > > hbase(main):017:0> scan 'CAR_ARCHIVE' , {COLUMNS=>'A', STARTROW =>
> > > '110\x00' , LIMIT=>1}
> > > ROW
> > > COLUMN+CELL
> > >
> > >  12\x0010123\x0019XFB2F56CE026679\x00\x80\x00\x00\x0
> column=A:BODYSTYLE,
> > > timestamp=1432899595317,
> > > value=SEDAN
> > >
> > >  0
> > >
> > >  12\x0010123\x0019XFB2F56CE026679\x00\x80\x00\x00\x0
> > > column=A:BODYSTYLESLUG, timestamp=1432899595317, value=sedan.
> > >
> > > I do have this rowkey:
> 110\x0033078\x001C4AJWAG0CL260823\x00\x80\x00\x00
> > > So, i was expecting to get that row.
> > >
> > >
> > > Solution: scan 'CAR_ARCHIVE' , {COLUMNS=>'A', STARTROW => "110\x00" ,
> > > LIMIT=>1}
> > >
> > > I dont really know what's the difference between single quotes and
> double
> > > quotes in startrow. Can anyone explain? Also, It would help others, if
> it
> > > can be documented somewhere.
> > >
> > > Thanks,
> > > Anil
> > >
> > >
> > > On Mon, Jun 8, 2015 at 4:07 PM, Jean-Marc Spaggiari <
> > > jean-marc@spaggiari.org
> > > > wrote:
> > >
> > > > Hi Anil,
> > > >
> > > > Can you please clarify what seems to be wrong for you?
> > > >
> > > > You asked for start row "33078". Which mean Rows starting with a "3",
> > > > followed by a "3", a "0", etc. and the first row returned start with
> a
> > > "4"
> > > > which is correct given the startrow you have specified.
> > > >
> > > > You seems to have a composite key. And you seems to scan without
> > building
> > > > the composite key. How have you created your table and what is your
> key
> > > > design?
> > > >
> > > > JM
> > > >
> > > > 2015-06-08 16:56 GMT-04:00 anil gupta <anilgupta84@gmail.com>:
> > > >
> > > > > Hi All,
> > > > >
> > > > > I m having a lot of trouble dealing with HBase shell. I am running
> > > > > following query:
> > > > >
> > > > > scan 'CAR_ARCHIVE' , {COLUMNS=>'A', STARTROW => '33078' , LIMIT=>1}
> > > > >
> > > > > ROW
> > > > > COLUMN+CELL
> > > > >
> > > > >  4\x0010135\x001C4BJWEG2CL117550\x00\x7F\xFF\xFF\xFF
> > > > > column=A:BODYSTYLE, timestamp=1430280906358, value=SPORT
> > > > > UTILITY
> > > > >
> > > > >  4\x0010135\x001C4BJWEG2CL117550\x00\x7F\xFF\xFF\xFF
> > > > > column=A:BODYSTYLESLUG, timestamp=1430280906358,
> > > > > value=sport-utility
> > > > >
> > > > >  4\x0010135\x001C4BJWEG2CL117550\x00\x7F\xFF\xFF\xFF
> > > > > column=A:CARFAXREPORTAVAILABLE, timestamp=1430280906358,
> > > > > value=\x01
> > > > >
> > > > >  4\x0010135\x001C4BJWEG2CL117550\x00\x7F\xFF\xFF\xFF
> > > > > column=A:CARTYPE, timestamp=1430280906358, value={"isLuxury":
> false,
> > > > > "isTruck": false, "isSedan": false, "isCoupe": false, "isSuv":
> true,
> > > > > "isConvertible": false, "isVan": false, "isWagon": false,
> > > > > "isEasyCareQualified": true}
> > > > >
> > > > > I specified, startRow='33078'. Then how come this result shows up?
> > > What's
> > > > > going over here?
> > > > >
> > > > > --
> > > > > Thanks & Regards,
> > > > > Anil Gupta
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Thanks & Regards,
> > > Anil Gupta
> > >
> >
>
>
>
> --
> Thanks & Regards,
> Anil Gupta
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message