0
votes

I want to add the comment on each column in Hive Parquet table. I am trying to add comment as below:

create external table parquet_db.bdv_table
(
registration_dttm timestamp comment 'Registration date',
id int comment 'id_for_person',
name string comment 'user_name',
email string comment 'email address'
)
ROW FORMAT SERDE 'parquet.hive.serde.ParquetHiveSerDe'
STORED AS parquet
Location '/user/****/***'; 

But comments are not appearing on, however DDL gets created and data is also loading. Please let me know, how to add the comments in Hive Parquet table for each column.

1
That should work fine... How are you trying to view the comments? SHOW CREATE TABLE won't do it by default - OneCricketeer
However, I have tried to view the comments by following commands: 1. describe bdv_table 2. describe formatted bdv_table 3. show create table bdv_test. ............... but comments are not appearing. I think this is the issue with SerDe. - Prashant Agarwal
can you use --comments? - pvy4917
--comment .... yes tried, but giving parse exception error while creating. - Prashant Agarwal
Please read Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers? - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions. - halfer

1 Answers

1
votes

You can drop the SERDE specification from the create table statement. Just using STORED AS PARQUET will default to using org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe.

After creating table, desc parquet_db.bdv_table should show the comment in output.