1.创建普通表
hive> CREATE TABLE test_table(name STRING,userid INT,ip STRING COMMENT 'ip address of the user')COMMENT 'this is the test table';
OK
test_table
Time taken: 0.492 seconds, Fetched: 1 row(s)
hive> describe test_table;
OKname string
userid int
ip string ip address of the user
Time taken: 0.457 seconds, Fetched: 3 row(s)
hive> describe extended test_table;
name string
userid int
ip string ip address of the user
Detailed Table Information Table(tableName:test_table, dbName:default, owner:caiyong, createTime:1425990662, lastAccessTime:0, retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:name, type:string, comment:null), FieldSchema(name:userid, type:int, comment:null), FieldSchema(name:ip, type:string, comment:ip address of the user)], location:hdfs://127.0.0.1:8020/user/hive/warehouse/test_table, inputFormat:org.apache.hadoop.mapred.TextInputFormat, outputFormat:org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat, compressed:false, numBuckets:-1, serdeInfo:SerDeInfo(name:null, serializationLib:org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, parameters:{serialization.format=1}), bucketCols:[], sortCols:[], parameters:{}, skewedInfo:SkewedInfo(skewedColNames:[], skewedColValues:[], skewedColValueLocationMaps:{}), storedAsSubDirectories:false), part

本文介绍了如何使用Hive创建不同类型的数据表,包括普通表、添加了表分区的表、聚类存储的表以及指定存储路径的外部表。通过示例展示了创建过程,如创建带有字段注释的普通表。
最低0.47元/天 解锁文章
2270

被折叠的 条评论
为什么被折叠?



