************************ ALTER TABLE ************************ ======================== RENAME TABLE ======================== *Synopsis* .. code-block:: sql ALTER TABLE RENAME TO For example: ALTER TABLE table1 RENAME TO table2; This statement lets you change the name of a table to a different name. ======================== RENAME COLUMN ======================== *Synopsis* .. code-block:: sql ALTER TABLE RENAME COLUMN TO For example: ALTER TABLE table1 RENAME COLUMN id TO id2; This statement will allow users to change a column's name. ======================== ADD COLUMN ======================== *Synopsis* .. code-block:: sql ALTER TABLE ADD COLUMN For example: ALTER TABLE table1 ADD COLUMN id text; This statement lets you add new columns to the end of the existing column. ======================== SET PROPERTY ======================== *Synopsis* .. code-block:: sql ALTER TABLE SET PROPERTY ( = , ...) For example: ALTER TABLE table1 SET PROPERTY 'timezone' = 'GMT-7' ALTER TABLE table1 SET PROPERTY 'text.delimiter' = '&' ALTER TABLE table1 SET PROPERTY 'compression.type'='RECORD','compression.codec'='org.apache.hadoop.io.compress.SnappyCodec' This statement will allow users to change a table property. ======================== DROP PARTITION ======================== *Synopsis* .. code-block:: sql ALTER TABLE [IF EXISTS] DROP PARTITION ( = , ...) [PURGE] For example: ALTER TABLE table1 DROP PARTITION (col1 = 1 , col2 = 2) ALTER TABLE table1 DROP PARTITION (col1 = '2015' , col2 = '01', col3 = '11' ) ALTER TABLE table1 DROP PARTITION (col1 = 'TAJO' ) PURGE You can use ``ALTER TABLE DROP PARTITION`` to drop a partition for a table. This doesn't remove the data for a table. But if ``PURGE`` is specified, the partition data will be removed. The metadata is completely lost in all cases. An error is thrown if the partition for the table doesn't exist. You can use ``IF EXISTS`` to skip the error. ======================== REPAIR PARTITION ======================== Tajo stores a list of partitions for each table in its catalog. If partitions are manually added to the distributed file system, the metastore is not aware of these partitions. Running the ``ALTER TABLE REPAIR PARTITION`` statement ensures that the tables are properly populated. *Synopsis* .. code-block:: sql ALTER TABLE REPAIR PARTITION .. note:: Even though an information of a partition is stored in the catalog, Tajo does not recover it when its partition directory doesn't exist in the file system.