- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Add comments to columns in an impala table
- Labels:
-
Apache Impala
Created on ‎07-28-2017 03:38 PM - edited ‎09-16-2022 05:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, here is a question.
How do I alter and remove a table comment?
THANKS.
Created ‎06-12-2019 10:09 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could just set the comment as empty string like "", I am not sure if you can remove the field completely.
Cheers
Eric
Created ‎06-13-2019 02:24 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Created ‎09-18-2019 12:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ALTER TABLE test CHANGE col1 col1 int COMMENT 'test comment';
But I do not think you can remove it, but rather to just empty it.
Cheers
Eric
