Created on 07-28-2017 03:38 PM - edited 09-16-2022 05:00 AM
How do I add comments to a column in an impala table for specific columns after creating it.
Thanks
Created 08-02-2017 04:38 AM
ALTER TABLE test CHANGE {columname} {columnname} {datatype} comment 'test comment';
See below test case:
[impala-host:21000] > show create table test;
Query: show create table test
+---------------------------------------------------------------------------------------------------------------------+
| result                                                                                                              |
+---------------------------------------------------------------------------------------------------------------------+
| CREATE TABLE default.test (                                                                                         |
|   a INT,                                                                                                            |
|   b INT                                                                                                             |
| )                                                                                                                   |
| WITH SERDEPROPERTIES ('serialization.format'='1')                                                                   |
| STORED AS TEXTFILE                                                                                                  |
| LOCATION 'hdfs://namenode-host:8020/user/hive/warehouse/test'                                 |
| TBLPROPERTIES ('numFiles'='3', 'COLUMN_STATS_ACCURATE'='true', 'numRows'='9', 'totalSize'='40', 'rawDataSize'='31') |
+---------------------------------------------------------------------------------------------------------------------+
Fetched 1 row(s) in 7.42s
[impala-host:21000] > alter table test change a a int comment 'test comment';
Query: alter table test change a a int comment 'test comment'
Fetched 0 row(s) in 0.66s
[impala-host:21000] > show create table test;
Query: show create table test
+---------------------------------------------------------------------------------------------------------------------+
| result                                                                                                              |
+---------------------------------------------------------------------------------------------------------------------+
| CREATE TABLE default.test (                                                                                         |
|   a INT COMMENT 'test comment',                                                                                     |
|   b INT                                                                                                             |
| )                                                                                                                   |
| WITH SERDEPROPERTIES ('serialization.format'='1')                                                                   |
| STORED AS TEXTFILE                                                                                                  |
| LOCATION 'hdfs://namenode-host:8020/user/hive/warehouse/test'                                 |
| TBLPROPERTIES ('numFiles'='3', 'COLUMN_STATS_ACCURATE'='true', 'numRows'='9', 'totalSize'='40', 'rawDataSize'='31') |
+---------------------------------------------------------------------------------------------------------------------+
					
				
			
			
				
			
			
			
				
			
			
			
			
			
		Created 07-30-2017 07:39 PM
I didn't get a chance to test it, but just try this, it may help
Go to Hue -> Metastore manager -> db.table -> property -> update comment
Created 08-02-2017 04:38 AM
ALTER TABLE test CHANGE {columname} {columnname} {datatype} comment 'test comment';
See below test case:
[impala-host:21000] > show create table test;
Query: show create table test
+---------------------------------------------------------------------------------------------------------------------+
| result                                                                                                              |
+---------------------------------------------------------------------------------------------------------------------+
| CREATE TABLE default.test (                                                                                         |
|   a INT,                                                                                                            |
|   b INT                                                                                                             |
| )                                                                                                                   |
| WITH SERDEPROPERTIES ('serialization.format'='1')                                                                   |
| STORED AS TEXTFILE                                                                                                  |
| LOCATION 'hdfs://namenode-host:8020/user/hive/warehouse/test'                                 |
| TBLPROPERTIES ('numFiles'='3', 'COLUMN_STATS_ACCURATE'='true', 'numRows'='9', 'totalSize'='40', 'rawDataSize'='31') |
+---------------------------------------------------------------------------------------------------------------------+
Fetched 1 row(s) in 7.42s
[impala-host:21000] > alter table test change a a int comment 'test comment';
Query: alter table test change a a int comment 'test comment'
Fetched 0 row(s) in 0.66s
[impala-host:21000] > show create table test;
Query: show create table test
+---------------------------------------------------------------------------------------------------------------------+
| result                                                                                                              |
+---------------------------------------------------------------------------------------------------------------------+
| CREATE TABLE default.test (                                                                                         |
|   a INT COMMENT 'test comment',                                                                                     |
|   b INT                                                                                                             |
| )                                                                                                                   |
| WITH SERDEPROPERTIES ('serialization.format'='1')                                                                   |
| STORED AS TEXTFILE                                                                                                  |
| LOCATION 'hdfs://namenode-host:8020/user/hive/warehouse/test'                                 |
| TBLPROPERTIES ('numFiles'='3', 'COLUMN_STATS_ACCURATE'='true', 'numRows'='9', 'totalSize'='40', 'rawDataSize'='31') |
+---------------------------------------------------------------------------------------------------------------------+
					
				
			
			
				
			
			
			
			
			
			
			
		Created on 06-12-2019 07:57 PM - edited 06-12-2019 08:00 PM
Hi, here is a question.
How do I alter and remove a table comment?
THANKS.
Created 06-12-2019 10:09 PM
Created 06-13-2019 02:24 AM
Thanks for your quick reply.
What I wanna know is how do I alter and remove a "table level" comment.
I cannot find an example or document on the Internet.
Created 09-17-2019 01:49 PM
Created 09-18-2019 12:01 AM
 
					
				
				
			
		
