SQL/hive (4) 썸네일형 리스트형 [hive] partition add / delete ALTER TABLE tmp.table ADD IF NOT EXISTS PARTITION (base_dt='2020-06-01') ALTER TABLE tmp.tableDROP IF EXISTS PARTITION(year = 2012, month = 12, day = 18); [hive] table, column add comment / add column / change column order / column rename table comment add ALTER TABLE table_name SET TBLPROPERTIES ('comment' = new_comment); column comment add ALTER TABLE table_name CHANGE col1 col1 colType COMMENT 'new_comment'; 파티션 컬럼은 테이블생성시에만 코멘트를 추가할 수 있다. Comment can be added to a partition column at the time of creation of the table. HUE > Table Browser > edit 가능 change column order ALTER TABLE tmp.table_name CHANGE col_name col_name col_typ.. [hive] partition column rename hive에서 실행할것. impala에서 하면 실행안됨 ALTER TABLE tmp.table PARTITION (base_dt='20200601') RENAME TO PARTITION (base_dt='2020-06-01') hadoop distcp /old_dir/base_dt=20200601/* /new_dir/base_dt=2020-06-01/filename 파티션 컬럼 경로 변경 ALTER TABLE tmp.table PARTITION (base_dt='2020-06-01') SET LOCATION '/newdir/base_dt=2020-06-01' [hive] table rename , change location 테이블명 변경 alter table tmp.oldname rename to tmp.newname 경로 변경 터미널에서 파일 복사 hadoop distcp hdfs://old_dir/* hdfs://new_dir 쿼리 alter table tmp.newname set location 'hdfs://new_dir' 이전 1 다음