Most RDBMSs include the possibility to build scripts to create objects like as tables, Views, and so on. Hive too has a function that displays the CREATE TABLE statement along with the Table and SerDe properties.
Syntax:
SHOW CREATE TABLE <TableName>
Example:
hive> SHOW CREATE TABLE StatePop;
OK
CREATE TABLE `statepop`(
`city` string,
`state` string,
`pop` bigint)
ROW FORMAT SERDE
‘org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe’
WITH SERDEPROPERTIES (
‘field.delim’=’\t’,
‘serialization.format’=’\t’)
STORED AS INPUTFORMAT
‘org.apache.hadoop.mapred.TextInputFormat’
OUTPUTFORMAT
‘org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat’
LOCATION
‘hdfs://quickstart.cloudera:8020/user/hive/warehouse/statepop’
TBLPROPERTIES (
‘COLUMN_STATS_ACCURATE’=’true’,
‘numFiles’=’1’,
‘totalSize’=’8722’,
‘transient_lastDdlTime’=’1621634693’)
Time taken: 0.12 seconds, Fetched: 20 row(s)
The following is the actual syntax for the above-mentioned table:
CREATE TABLE StatePop(City String, State String, Pop BIGINT)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ‘\t’;
Hope you find this article helpful.
Please do subscribe to receive notifications on latest posts.
One comment