I have created an hbase table using Phoenix with 3 columns. Then after creating the schema structure and populating with data, I wanted to add one new row with new dynamic columns. After doing so, I want to do a SELECT statement and get all columns including dynamic ones. However this is not working when doing "SELECT * FROM EXAMPLE;" -- any ideas how to do this?
Here is my code:
CREATE TABLE example ( my_pk bigint not null, m.first_name varchar(50), m.last_name varchar(50) CONSTRAINT pk PRIMARY KEY (my_pk))
Inserted dynamic data like so:
UPSERT INTO EXAMPLE (MY_PK, FIRST_NAME, LAST_NAME, lastGCTime TIME, usedMemory BIGINT, maxMemory BIGINT) VALUES(1, 'this', 'test', CURRENT_TIME(), 512, 1024)
So i guess you have to modify the schema in order for it to pick up the new columns -- it doesnt update schema automatically on the fly
For getting the dynamic columns in your result-set, you need to specify those columns and their schema while querying as well. This feature is available since Phoenix 1.2.
SELECT MY_PK, FIRST_NAME, LAST_NAME, lastGCTime TIME, usedMemory BIGINT, maxMemory BIGINT FROM EXAMPLE(lastGCTime TIME, usedMemory BIGINT, maxMemory BIGINT);
Source: Dynamic Columns in Phoenix