You must use schema to encode data if you want to use HBASE API, that means you need to use some Phoenix code. this way is not recommended if you are not developer, you can use SQL that is more convenient.
---------------------------------------- Yun Zhang Best regards! 2018-07-29 1:41 GMT+08:00 anil gupta <[email protected]>: > In addition to Miles comment, its recommended to use Phoenix for reads if > you wrote data using Phoenix. > To mimic your range scan in Phoenix query: select * from EMPPH2 where id > >= 1 and id < 3; > > On Thu, Jul 26, 2018 at 11:10 PM, Miles Spielberg <[email protected]> wrote: > >> SQL INTEGER is not stored as strings, but as 4-bytes of encoded binary. >> See https://phoenix.apache.org/language/datatypes.html#integer_type >> >> Miles Spielberg >> Staff Software Engineer >> >> >> O. 650.485.1102 >> 900 Jefferson Ave >> <https://maps.google.com/?q=900+Jefferson+Ave+%0D%0A%0D%0ARedwood+City+,+CA+94063&entry=gmail&source=g> >> Redwood City, CA 94063 >> <https://maps.google.com/?q=900+Jefferson+Ave+%0D%0A%0D%0ARedwood+City+,+CA+94063&entry=gmail&source=g> >> >> On Thu, Jul 26, 2018 at 5:44 PM, alchemist <[email protected] >> > wrote: >> >>> create table empPh2(id integer primary key, fname varchar, lname >>> varchar)COLUMN_ENCODED_BYTES=0 >>> upsert into empPh2 values (1, 'A', 'B'); >>> upsert into empPh2 values (2, 'B', 'B'); >>> upsert into empPh2 values (3, 'C', 'B'); >>> upsert into empPh2 values (4, 'John', 'B'); >>> >>> >>> Then when to HBase to do the range query using following command: >>> >>> hbase(main):004:0> scan 'EMPPH2', {STARTROW => '1', ENDROW => '3'} >>> ROW COLUMN+CELL >>> >>> >>> 0 row(s) in 0.0030 seconds >>> >>> I saw row in HBASE has extra symbols. Not sure how to have 1:1 mapping >>> between HBASE table to Phoenix table. >>> >>> ROW COLUMN+CELL >>> >>> >>> \x80\x00\x00\x01 column=0:FNAME, >>> timestamp=1532651140732, value=A >>> >>> \x80\x00\x00\x01 column=0:LNAME, >>> timestamp=1532651140732, value=B >>> >>> \x80\x00\x00\x01 column=0:_0, >>> timestamp=1532651140732, value=x >>> >>> \x80\x00\x00\x02 column=0:FNAME, >>> timestamp=1532651151877, value=B >>> >>> \x80\x00\x00\x02 column=0:LNAME, >>> timestamp=1532651151877, value=B >>> >>> \x80\x00\x00\x02 column=0:_0, >>> timestamp=1532651151877, value=x >>> >>> \x80\x00\x00\x03 column=0:FNAME, >>> timestamp=1532651164899, value=C >>> >>> \x80\x00\x00\x03 column=0:LNAME, >>> timestamp=1532651164899, value=B >>> >>> >>> >>> -- >>> Sent from: http://apache-phoenix-user-list.1124778.n5.nabble.com/ >>> >> >> > > > -- > Thanks & Regards, > Anil Gupta >
