Hi Daniel,
You mapped the HBase table using the below statement,
CREATE VIEW "t1" ( pk VARCHAR PRIMARY KEY, "f1".val
VARCHAR );
By default, Phoenix sends characters in capital letter, so here second column
of view is mapped to the qualifier "f1:VAL".
But you inserted records at HBase in "f1:val" instead of "f1:VAL" as,
r1 column=f1:val, timestamp=1396558762590, value=a
So NULL value is displayed in VAL column at Phoenix side.
You can map as "f1"."val" to resolve this or insert records in "f1:VAL".
Cheers,
Pankaj
From: Daniel Rodriguez [mailto:df.rodriguez143@gmail.com]
Sent: 04 April 2014 06:18
To: user
Subject: Basic mapping to HBase table
Hi all,
I spent a couple of hours today trying phoenix for the first time, looks amazing.
My final objective is to do SQL on a big hbase table that has a composite key, i decided to
start slow and I was able to create a table on phoenix, upsert values and see them on hbase,
but I am not able to do the oposite: map (using a view) values on an existing hbase to a phoenix
table, i am always getting "null" values.
Here is a basic example copied from the docs:
HBASE:
> create 't1', {NAME => 'f1', VERSIONS => 5}
PHOENIX:
> CREATE VIEW "t1" ( pk VARCHAR PRIMARY KEY, "f1".val VARCHAR );
> select * from "t1";
+------------+------------+
| PK | VAL |
+------------+------------+
+------------+------------+
Works fine since there is no data.
I add data to hbase:
> put 't1,'r1','f1','a'
> scan 't1'
ROW COLUMN+CELL
r1 column=f1:, timestamp=1396558806334, value=a
But if i try to select from phoenix i get only null values.:
> select * from "t1";
+------------+------------+
| PK | VAL |
+------------+------------+
| r1 | null |
+------------+------------+
I also tried to save it on an specific column in the column family:
> scan 't1'
ROW COLUMN+CELL
r1 column=f1:, timestamp=1396558806334, value=a
r1 column=f1:val, timestamp=1396558762590, value=a
I also tried to change from varchar to integer and insert numbers but i got the same result
in both cases.
I am using phoenix 2.2.0 on EMR.
Any help you can give me is appreciated.
Thanks,
Daniel
|