Re: Row Scan In HBase Not Working When Table Created With Phoenix

2018-07-29 Thread Jaanai Zhang
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 :

> 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  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
>> 
>> Redwood City, CA 94063
>> 
>>
>> On Thu, Jul 26, 2018 at 5:44 PM, alchemist > > 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'}
>>> ROWCOLUMN+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\x01column=0:FNAME,
>>> timestamp=1532651140732, value=A
>>>
>>>  \x80\x00\x00\x01column=0:LNAME,
>>> timestamp=1532651140732, value=B
>>>
>>>  \x80\x00\x00\x01column=0:_0,
>>> timestamp=1532651140732, value=x
>>>
>>>  \x80\x00\x00\x02column=0:FNAME,
>>> timestamp=1532651151877, value=B
>>>
>>>  \x80\x00\x00\x02column=0:LNAME,
>>> timestamp=1532651151877, value=B
>>>
>>>  \x80\x00\x00\x02column=0:_0,
>>> timestamp=1532651151877, value=x
>>>
>>>  \x80\x00\x00\x03column=0:FNAME,
>>> timestamp=1532651164899, value=C
>>>
>>>  \x80\x00\x00\x03column=0:LNAME,
>>> timestamp=1532651164899, value=B
>>>
>>>
>>>
>>> --
>>> Sent from: http://apache-phoenix-user-list.1124778.n5.nabble.com/
>>>
>>
>>
>
>
> --
> Thanks & Regards,
> Anil Gupta
>


Re: Row Scan In HBase Not Working When Table Created With Phoenix

2018-07-28 Thread anil gupta
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  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
> 
> Redwood City, CA 94063
> 
>
> On Thu, Jul 26, 2018 at 5:44 PM, alchemist 
> 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'}
>> ROWCOLUMN+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\x01column=0:FNAME,
>> timestamp=1532651140732, value=A
>>
>>  \x80\x00\x00\x01column=0:LNAME,
>> timestamp=1532651140732, value=B
>>
>>  \x80\x00\x00\x01column=0:_0,
>> timestamp=1532651140732, value=x
>>
>>  \x80\x00\x00\x02column=0:FNAME,
>> timestamp=1532651151877, value=B
>>
>>  \x80\x00\x00\x02column=0:LNAME,
>> timestamp=1532651151877, value=B
>>
>>  \x80\x00\x00\x02column=0:_0,
>> timestamp=1532651151877, value=x
>>
>>  \x80\x00\x00\x03column=0:FNAME,
>> timestamp=1532651164899, value=C
>>
>>  \x80\x00\x00\x03column=0:LNAME,
>> timestamp=1532651164899, value=B
>>
>>
>>
>> --
>> Sent from: http://apache-phoenix-user-list.1124778.n5.nabble.com/
>>
>
>


-- 
Thanks & Regards,
Anil Gupta


Re: Row Scan In HBase Not Working When Table Created With Phoenix

2018-07-26 Thread Miles Spielberg
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
Redwood City, CA 94063

On Thu, Jul 26, 2018 at 5:44 PM, alchemist 
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'}
> ROWCOLUMN+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\x01column=0:FNAME,
> timestamp=1532651140732, value=A
>
>  \x80\x00\x00\x01column=0:LNAME,
> timestamp=1532651140732, value=B
>
>  \x80\x00\x00\x01column=0:_0,
> timestamp=1532651140732, value=x
>
>  \x80\x00\x00\x02column=0:FNAME,
> timestamp=1532651151877, value=B
>
>  \x80\x00\x00\x02column=0:LNAME,
> timestamp=1532651151877, value=B
>
>  \x80\x00\x00\x02column=0:_0,
> timestamp=1532651151877, value=x
>
>  \x80\x00\x00\x03column=0:FNAME,
> timestamp=1532651164899, value=C
>
>  \x80\x00\x00\x03column=0:LNAME,
> timestamp=1532651164899, value=B
>
>
>
> --
> Sent from: http://apache-phoenix-user-list.1124778.n5.nabble.com/
>


Row Scan In HBase Not Working When Table Created With Phoenix

2018-07-26 Thread alchemist
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'}
ROWCOLUMN+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\x01column=0:FNAME,
timestamp=1532651140732, value=A
 
 \x80\x00\x00\x01column=0:LNAME,
timestamp=1532651140732, value=B

 \x80\x00\x00\x01column=0:_0,
timestamp=1532651140732, value=x
   
 \x80\x00\x00\x02column=0:FNAME,
timestamp=1532651151877, value=B

 \x80\x00\x00\x02column=0:LNAME,
timestamp=1532651151877, value=B

 \x80\x00\x00\x02column=0:_0,
timestamp=1532651151877, value=x
   
 \x80\x00\x00\x03column=0:FNAME,
timestamp=1532651164899, value=C

 \x80\x00\x00\x03column=0:LNAME,
timestamp=1532651164899, value=B  



--
Sent from: http://apache-phoenix-user-list.1124778.n5.nabble.com/