HIVEのテーブル定義の確認

LanguageManual DDL - Apache Hive - Apache Software Foundation

テーブル定義の確認方法

HIVEで作成したテーブルのファイルフォーマットや構成を確認したい場合

hive > desc [ extended / formatted ] テーブル名

extendedで詳細説明表示
formattedで見やすいよう整形してくれる

> CREATE TABLE test_table(col1 string, col2 string, col3 string)
> ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n';
OK

> desc formatted test_table;

# col_name              data_type               comment

col1                    string                  None
col2                    string                  None
col3                    string                  None

# Detailed Table Information
Database:               mra
Owner:                  hadoop
CreateTime:             Thu Nov 11 00:00:00 UTC 2013
LastAccessTime:         UNKNOWN
Protect Mode:           None
Retention:              0
Location:               hdfs://hoge/foo/bar/test_table
Table Type:             MANAGED_TABLE
Table Parameters:
        transient_lastDdlTime   1234567890

# Storage Information
SerDe Library:          org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
InputFormat:            org.apache.hadoop.mapred.TextInputFormat
OutputFormat:           org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
Compressed:             No
Num Buckets:            -1
Bucket Columns:         []
Sort Columns:           []
Storage Desc Params:
        field.delim             \t
        line.delim              \n
        serialization.format    \t