I have an HBase installation with a bunch of existing tables, with a bunch of data in them (which I would not want to delete). I recently came across using Apache Phoenix to be able to query HBase data with syntax like SQL, and it is still brilliant. However, since I am still not completely familiar with the various data types and how they map to the Java types that I stored in HBase, sometimes I get it wrong. If I had a HBase column that I saved as
Bytes.toBytes(Long long)
and I accidentally created my Phoenix table as a varchar, how can I now change the Phoenix column without losing all my data? If i do
alter table "mytable" add "myfamily"."mycolumn" unsigned_long
and then
alter table "mytable" drop column "mycolumn"
and then
alter table "mytable" add "myfamily"."mycolumn" varchar
all my HBase data is deleted from the "mycolumn" column! What is the best way to get around this?
phoenix.schema.dropMetaData
false, , , , . - , Squirrel Phoenix, false? ?
!
1
Phoenix , system.catalog, .
upsert into system.catalog (table_name, column_name, column_family, data_type) values ('mytable','mycolumn','mycf',3)
mycolumn . , mytable, mycolumn - unsigned_long. , HBase?
FYI:
COLUMN_NAME DATA_TYPE
MYTINYINT -6
MYBIGINT -5
MYDECIMAL 3
MYINTEGER 4
MYFLOAT 6
MYDOUBLE 8
MYUINTEGER 9
MYULONG 10
MYUTINYINT 11
MYVARCHAR 12
ROWID 12
MYUFLOAT 14
MYUDOUBLE 15
MYBOOLEAN 16
MYUTIME 18
MYUDATE 19
MYUTIMESTAMP 19
MYDATE 91
MYTIME 92
MYTIMESTAMP 93
2
, Phoenix, HBase, SYSTEM.CATALOG SYSTEM.STATS. . , - HBase!