| ==== |
| ---- HIVE_QUERY |
| use $DATABASE; |
| create table tt (x int) tblproperties ( |
| 'transactional'='true', |
| 'transactional_properties'='insert_only'); |
| |
| insert into tt values (1); |
| insert into tt values (2); |
| insert into tt values (3); |
| ==== |
| ---- QUERY |
| invalidate metadata tt; |
| select * from tt; |
| ---- RESULTS |
| 1 |
| 2 |
| 3 |
| ==== |
| ---- HIVE_QUERY |
| use $DATABASE; |
| alter table tt compact 'major' and wait; |
| ==== |
| ---- QUERY |
| refresh tt; |
| select * from tt |
| ---- RESULTS |
| 1 |
| 2 |
| 3 |
| ==== |
| ---- QUERY |
| show files in tt; |
| ---- LABELS |
| Path,Size,Partition |
| ---- RESULTS |
| row_regex:'$NAMENODE/$MANAGED_WAREHOUSE_DIR/$DATABASE.db/tt/base_0000003_v\d+/000000_0','\d+B','' |
| ---- TYPES |
| STRING,STRING,STRING |
| ==== |
| ---- HIVE_QUERY |
| use $DATABASE; |
| create table upgraded_table (x int); |
| insert into upgraded_table values (1); |
| # Upgrade to the table to insert only acid when there are already values in it. |
| alter table upgraded_table set tblproperties |
| ('transactional' = 'true', 'transactional_properties' = 'insert_only', |
| 'EXTERNAL'='FALSE'); |
| insert into upgraded_table values (2); |
| insert into upgraded_table values (3); |
| ==== |
| ---- QUERY |
| invalidate metadata upgraded_table; |
| select * from upgraded_table; |
| ---- RESULTS |
| 1 |
| 2 |
| 3 |
| ==== |
| ---- HIVE_QUERY |
| use $DATABASE; |
| alter table upgraded_table compact 'major' and wait; |
| ==== |
| ---- QUERY |
| refresh upgraded_table; |
| select * from upgraded_table; |
| ---- RESULTS |
| 1 |
| 2 |
| 3 |
| ==== |
| ---- HIVE_QUERY |
| use $DATABASE; |
| create table full_acid (x int) stored as orc tblproperties('transactional'='true'); |
| |
| insert into full_acid values (1); |
| insert into full_acid values (2); |
| insert into full_acid values (3); |
| ==== |
| ---- QUERY |
| invalidate metadata full_acid; |
| select * from full_acid; |
| ---- RESULTS |
| 1 |
| 2 |
| 3 |
| ==== |
| ---- HIVE_QUERY |
| use $DATABASE; |
| alter table full_acid compact 'major' and wait; |
| ==== |
| ---- QUERY |
| refresh full_acid; |
| select * from full_acid |
| ---- RESULTS |
| 1 |
| 2 |
| 3 |
| ==== |
| ---- QUERY |
| show files in full_acid; |
| ---- LABELS |
| Path,Size,Partition |
| ---- RESULTS |
| row_regex:'$NAMENODE/$MANAGED_WAREHOUSE_DIR/$DATABASE.db/full_acid/base_0000003_v\d+/.*','\d+B','' |
| ---- TYPES |
| STRING,STRING,STRING |
| ==== |