|
|
-
Adding comment to a table for columns
Chunky Gupta 2013-02-21, 11:16
Hi,
I am using this syntax to add comments for all columns :-
CREATE EXTERNAL TABLE test ( c STRING COMMENT 'Common class', time STRING COMMENT 'Common time', url STRING COMMENT 'Site URL' ) PARTITIONED BY (dt STRING ) LOCATION 's3://BucketName/'
Output of Describe Extended table is like :- (Output is just an example copied from internet)
hive> DESCRIBE EXTENDED table_name;
Detailed Table Information Table(tableName:table_name, dbName:benchmarking, owner:root, createTime:1309480053, lastAccessTime:0, retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:session_key, type:string, comment:null), FieldSchema(name:remote_address, type:string, comment:null), FieldSchema(name:canister_lssn, type:string, comment:null), FieldSchema(name:canister_session_id, type:bigint, comment:null), FieldSchema(name:tltsid, type:string, comment:null), FieldSchema(name:tltuid, type:string, comment:null), FieldSchema(name:tltvid, type:string, comment:null), FieldSchema(name:canister_server, type:string, comment:null), FieldSchema(name:session_timestamp, type:string, comment:null), FieldSchema(name:session_duration, type:string, comment:null), FieldSchema(name:hit_count, type:bigint, comment:null), FieldSchema(name:http_user_agent, type:string, comment:null), FieldSchema(name:extractid, type:bigint, comment:null), FieldSchema(name:site_link, type:string, comment:null), FieldSchema(name:dt, type:string, comment:null), FieldSchema(name:hour, type:int, comment:null)], location:hdfs://hadoop2/user/hive/warehouse/benchmarking.db/table_name, inputFormat:org.apache.hadoop.mapred.SequenceFileInputFormat, outputFormat:org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat, compressed:false, numBuckets:-1, serdeInfo:SerDeInfo(name:null, serializationLib:org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe)
Is there any way of getting this detailed comments and column name in readable format, just like the output of "Describe table_name" ?. Thanks,
Chunky.
-
Re: Adding comment to a table for columns
bejoy_ks@... 2013-02-21, 11:20
Hi Gupta
You can the describe output in a formatted way using
DESCRIBE FORMATTED <table name>;
Regards Bejoy KS
Sent from remote device, Please excuse typos
-----Original Message----- From: Chunky Gupta <[EMAIL PROTECTED]> Date: Thu, 21 Feb 2013 16:46:30 To: <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] Subject: Adding comment to a table for columns
Hi,
I am using this syntax to add comments for all columns :-
CREATE EXTERNAL TABLE test ( c STRING COMMENT 'Common class', time STRING COMMENT 'Common time', url STRING COMMENT 'Site URL' ) PARTITIONED BY (dt STRING ) LOCATION 's3://BucketName/'
Output of Describe Extended table is like :- (Output is just an example copied from internet)
hive> DESCRIBE EXTENDED table_name;
Detailed Table Information Table(tableName:table_name, dbName:benchmarking, owner:root, createTime:1309480053, lastAccessTime:0, retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:session_key, type:string, comment:null), FieldSchema(name:remote_address, type:string, comment:null), FieldSchema(name:canister_lssn, type:string, comment:null), FieldSchema(name:canister_session_id, type:bigint, comment:null), FieldSchema(name:tltsid, type:string, comment:null), FieldSchema(name:tltuid, type:string, comment:null), FieldSchema(name:tltvid, type:string, comment:null), FieldSchema(name:canister_server, type:string, comment:null), FieldSchema(name:session_timestamp, type:string, comment:null), FieldSchema(name:session_duration, type:string, comment:null), FieldSchema(name:hit_count, type:bigint, comment:null), FieldSchema(name:http_user_agent, type:string, comment:null), FieldSchema(name:extractid, type:bigint, comment:null), FieldSchema(name:site_link, type:string, comment:null), FieldSchema(name:dt, type:string, comment:null), FieldSchema(name:hour, type:int, comment:null)], location:hdfs://hadoop2/user/hive/warehouse/benchmarking.db/table_name, inputFormat:org.apache.hadoop.mapred.SequenceFileInputFormat, outputFormat:org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat, compressed:false, numBuckets:-1, serdeInfo:SerDeInfo(name:null, serializationLib:org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe)
Is there any way of getting this detailed comments and column name in readable format, just like the output of "Describe table_name" ?. Thanks,
Chunky.
-
RE: Adding comment to a table for columns
Bhaskar, Snehalata 2013-02-21, 11:21
Try using 'describe formatted' command i.e. describe formatted test
Thanks and regards, Snehalata Deorukhkar
From: Chunky Gupta [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 21, 2013 4:47 PM To: [EMAIL PROTECTED] Subject: Adding comment to a table for columns Hi,
I am using this syntax to add comments for all columns :-
CREATE EXTERNAL TABLE test ( c STRING COMMENT 'Common class', time STRING COMMENT 'Common time', url STRING COMMENT 'Site URL' ) PARTITIONED BY (dt STRING ) LOCATION 's3://BucketName/'
Output of Describe Extended table is like :- (Output is just an example copied from internet)
hive> DESCRIBE EXTENDED table_name;
Detailed Table Information Table(tableName:table_name, dbName:benchmarking, owner:root, createTime:1309480053, lastAccessTime:0, retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:session_key, type:string, comment:null), FieldSchema(name:remote_address, type:string, comment:null), FieldSchema(name:canister_lssn, type:string, comment:null), FieldSchema(name:canister_session_id, type:bigint, comment:null), FieldSchema(name:tltsid, type:string, comment:null), FieldSchema(name:tltuid, type:string, comment:null), FieldSchema(name:tltvid, type:string, comment:null), FieldSchema(name:canister_server, type:string, comment:null), FieldSchema(name:session_timestamp, type:string, comment:null), FieldSchema(name:session_duration, type:string, comment:null), FieldSchema(name:hit_count, type:bigint, comment:null), FieldSchema(name:http_user_agent, type:string, comment:null), FieldSchema(name:extractid, type:bigint, comment:null), FieldSchema(name:site_link, type:string, comment:null), FieldSchema(name:dt, type:string, comment:null), FieldSchema(name:hour, type:int, comment:null)], location:hdfs://hadoop2/user/hive/warehouse/benchmarking.db/table_name, inputFormat:org.apache.hadoop.mapred.SequenceFileInputFormat, outputFormat:org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat, compressed:false, numBuckets:-1, serdeInfo:SerDeInfo(name:null, serializationLib:org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe)
Is there any way of getting this detailed comments and column name in readable format, just like the output of "Describe table_name" ?.
Thanks,
Chunky.
Confidential: This electronic message and all contents contain information from Syntel, Inc. which may be privileged, confidential or otherwise protected from disclosure. The information is intended to be for the addressee only. If you are not the addressee, any disclosure, copy, distribution or use of the contents of this message is prohibited. If you have received this electronic message in error, please notify the sender immediately and destroy the original message and all copies.
-
Re: Adding comment to a table for columns
Chunky Gupta 2013-02-21, 11:45
Hi Bejoy, Bhaskar
I tried using FORMATTED, but it will not give me comments which I have put while creating table. Its output is like :-
col_name data_type comment c string from deserializer time string from deserializer
Thanks, Chunky.
On Thu, Feb 21, 2013 at 4:50 PM, <[EMAIL PROTECTED]> wrote:
> ** > Hi Gupta > > You can the describe output in a formatted way using > > DESCRIBE FORMATTED <table name>; > Regards > Bejoy KS > > Sent from remote device, Please excuse typos > ------------------------------ > *From: * Chunky Gupta <[EMAIL PROTECTED]> > *Date: *Thu, 21 Feb 2013 16:46:30 +0530 > *To: *<[EMAIL PROTECTED]> > *ReplyTo: * [EMAIL PROTECTED] > *Subject: *Adding comment to a table for columns > > Hi, > > I am using this syntax to add comments for all columns :- > > CREATE EXTERNAL TABLE test ( c STRING COMMENT 'Common class', time STRING > COMMENT 'Common time', url STRING COMMENT 'Site URL' ) PARTITIONED BY (dt > STRING ) LOCATION 's3://BucketName/' > > Output of Describe Extended table is like :- (Output is just an example > copied from internet) > > hive> DESCRIBE EXTENDED table_name; > > Detailed Table Information Table(tableName:table_name, > dbName:benchmarking, owner:root, createTime:1309480053, lastAccessTime:0, > retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:session_key, > type:string, comment:null), FieldSchema(name:remote_address, type:string, > comment:null), FieldSchema(name:canister_lssn, type:string, comment:null), > FieldSchema(name:canister_session_id, type:bigint, comment:null), > FieldSchema(name:tltsid, type:string, comment:null), > FieldSchema(name:tltuid, type:string, comment:null), > FieldSchema(name:tltvid, type:string, comment:null), > FieldSchema(name:canister_server, type:string, comment:null), > FieldSchema(name:session_timestamp, type:string, comment:null), > FieldSchema(name:session_duration, type:string, comment:null), > FieldSchema(name:hit_count, type:bigint, comment:null), > FieldSchema(name:http_user_agent, type:string, comment:null), > FieldSchema(name:extractid, type:bigint, comment:null), > FieldSchema(name:site_link, type:string, comment:null), > FieldSchema(name:dt, type:string, comment:null), FieldSchema(name:hour, > type:int, comment:null)], > location:hdfs://hadoop2/user/hive/warehouse/benchmarking.db/table_name, > inputFormat:org.apache.hadoop.mapred.SequenceFileInputFormat, > outputFormat:org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat, > compressed:false, numBuckets:-1, serdeInfo:SerDeInfo(name:null, > serializationLib:org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe) > > Is there any way of getting this detailed comments and column name in > readable format, just like the output of "Describe table_name" ?. > > > Thanks, > > Chunky. >
-
Re: Adding comment to a table for columns
bejoy_ks@... 2013-02-21, 11:52
Hi Gupta
Try out
DESCRIBE EXTENDED FORMATTED <table-name>
I vaguely recall a operation like this. Please check hive wiki for the exact syntax.
Regards Bejoy KS
Sent from remote device, Please excuse typos
-----Original Message----- From: Chunky Gupta <[EMAIL PROTECTED]> Date: Thu, 21 Feb 2013 17:15:37 To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] Subject: Re: Adding comment to a table for columns
Hi Bejoy, Bhaskar
I tried using FORMATTED, but it will not give me comments which I have put while creating table. Its output is like :-
col_name data_type comment c string from deserializer time string from deserializer
Thanks, Chunky.
On Thu, Feb 21, 2013 at 4:50 PM, <[EMAIL PROTECTED]> wrote:
> ** > Hi Gupta > > You can the describe output in a formatted way using > > DESCRIBE FORMATTED <table name>; > Regards > Bejoy KS > > Sent from remote device, Please excuse typos > ------------------------------ > *From: * Chunky Gupta <[EMAIL PROTECTED]> > *Date: *Thu, 21 Feb 2013 16:46:30 +0530 > *To: *<[EMAIL PROTECTED]> > *ReplyTo: * [EMAIL PROTECTED] > *Subject: *Adding comment to a table for columns > > Hi, > > I am using this syntax to add comments for all columns :- > > CREATE EXTERNAL TABLE test ( c STRING COMMENT 'Common class', time STRING > COMMENT 'Common time', url STRING COMMENT 'Site URL' ) PARTITIONED BY (dt > STRING ) LOCATION 's3://BucketName/' > > Output of Describe Extended table is like :- (Output is just an example > copied from internet) > > hive> DESCRIBE EXTENDED table_name; > > Detailed Table Information Table(tableName:table_name, > dbName:benchmarking, owner:root, createTime:1309480053, lastAccessTime:0, > retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:session_key, > type:string, comment:null), FieldSchema(name:remote_address, type:string, > comment:null), FieldSchema(name:canister_lssn, type:string, comment:null), > FieldSchema(name:canister_session_id, type:bigint, comment:null), > FieldSchema(name:tltsid, type:string, comment:null), > FieldSchema(name:tltuid, type:string, comment:null), > FieldSchema(name:tltvid, type:string, comment:null), > FieldSchema(name:canister_server, type:string, comment:null), > FieldSchema(name:session_timestamp, type:string, comment:null), > FieldSchema(name:session_duration, type:string, comment:null), > FieldSchema(name:hit_count, type:bigint, comment:null), > FieldSchema(name:http_user_agent, type:string, comment:null), > FieldSchema(name:extractid, type:bigint, comment:null), > FieldSchema(name:site_link, type:string, comment:null), > FieldSchema(name:dt, type:string, comment:null), FieldSchema(name:hour, > type:int, comment:null)], > location:hdfs://hadoop2/user/hive/warehouse/benchmarking.db/table_name, > inputFormat:org.apache.hadoop.mapred.SequenceFileInputFormat, > outputFormat:org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat, > compressed:false, numBuckets:-1, serdeInfo:SerDeInfo(name:null, > serializationLib:org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe) > > Is there any way of getting this detailed comments and column name in > readable format, just like the output of "Describe table_name" ?. > > > Thanks, > > Chunky. >
-
Re: Adding comment to a table for columns
Chunky Gupta 2013-02-21, 13:16
Hi Bejoy,
I checked and didn't find anywhere using extended and formatted simultaneously to describe table. It is like :-
DESCRIBE [EXTENDED|FORMATTED] table_name[DOT col_name ( [DOT field_name] | [DOT '$elem$'] | [DOT '$key$'] | [DOT '$value$'] )* ]
Everywhere it says i can use only one at a time.
I tried using both as you suggested and gets this error :- FAILED: Parse Error: line 1:19 mismatched input 'extended' expecting Identifier near 'formatted' in specifying table types
If you can please try to remember the exact operation , or if there is any other way of doing it then please let me know.
Thanks, Chunky. On Thu, Feb 21, 2013 at 5:22 PM, <[EMAIL PROTECTED]> wrote: > > Hi Gupta > > Try out > > DESCRIBE EXTENDED FORMATTED <table-name> > > I vaguely recall a operation like this. > Please check hive wiki for the exact syntax. > > Regards > Bejoy KS > > Sent from remote device, Please excuse typos > ________________________________ > From: Chunky Gupta <[EMAIL PROTECTED]> > Date: Thu, 21 Feb 2013 17:15:37 +0530 > To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; < [EMAIL PROTECTED]> > ReplyTo: [EMAIL PROTECTED] > Subject: Re: Adding comment to a table for columns > > Hi Bejoy, Bhaskar > > I tried using FORMATTED, but it will not give me comments which I have put while creating table. Its output is like :- > > col_name data_type comment > c string from deserializer > time string from deserializer > > Thanks, > Chunky. > > On Thu, Feb 21, 2013 at 4:50 PM, <[EMAIL PROTECTED]> wrote: >> >> Hi Gupta >> >> You can the describe output in a formatted way using >> >> DESCRIBE FORMATTED <table name>; >> Regards >> Bejoy KS >> >> Sent from remote device, Please excuse typos >> ________________________________ >> From: Chunky Gupta <[EMAIL PROTECTED]> >> Date: Thu, 21 Feb 2013 16:46:30 +0530 >> To: <[EMAIL PROTECTED]> >> ReplyTo: [EMAIL PROTECTED] >> Subject: Adding comment to a table for columns >> >> Hi, >> >> I am using this syntax to add comments for all columns :- >> >> CREATE EXTERNAL TABLE test ( c STRING COMMENT 'Common class', time STRING COMMENT 'Common time', url STRING COMMENT 'Site URL' ) PARTITIONED BY (dt STRING ) LOCATION 's3://BucketName/' >> >> Output of Describe Extended table is like :- (Output is just an example copied from internet) >> >> hive> DESCRIBE EXTENDED table_name; >> >> Detailed Table Information Table(tableName:table_name, dbName:benchmarking, owner:root, createTime:1309480053, lastAccessTime:0, retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:session_key, type:string, comment:null), FieldSchema(name:remote_address, type:string, comment:null), FieldSchema(name:canister_lssn, type:string, comment:null), FieldSchema(name:canister_session_id, type:bigint, comment:null), FieldSchema(name:tltsid, type:string, comment:null), FieldSchema(name:tltuid, type:string, comment:null), FieldSchema(name:tltvid, type:string, comment:null), FieldSchema(name:canister_server, type:string, comment:null), FieldSchema(name:session_timestamp, type:string, comment:null), FieldSchema(name:session_duration, type:string, comment:null), FieldSchema(name:hit_count, type:bigint, comment:null), FieldSchema(name:http_user_agent, type:string, comment:null), FieldSchema(name:extractid, type:bigint, comment:null), FieldSchema(name:site_link, type:string, comment:null), FieldSchema(name:dt, type:string, comment:null), FieldSchema(name:hour, type:int, comment:null)], location:hdfs://hadoop2/user/hive/warehouse/benchmarking.db/table_name, inputFormat:org.apache.hadoop.mapred.SequenceFileInputFormat, outputFormat:org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat, compressed:false, numBuckets:-1, serdeInfo:SerDeInfo(name:null, serializationLib:org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe) >> >> Is there any way of getting this detailed comments and column name in readable format, just like the output of "Describe table_name" ?.
|
|