创建ORC格式的外部表
CREATE EXTERNAL TABLE `dmp.tbl1`(
`ifa` string,
`bundles` array<string>,
`countrys` array<string>)
ROW FORMAT SERDE
'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
STORED AS INPUTFORMAT --存储格式
'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
OUTPUTFORMAT --输出格式
'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'
LOCATION --内容S3上所在位置
's3://www.taobao.com/hive_dataware/dmp/tb1'
创建Text格式的外部表
CREATE EXTERNAL TABLE `t_tbl2`(
`uid` string,
`cnt` bigint)
PARTITIONED BY (
`audience_id` string,
`type` string,
`event` string,
`day` string)
ROW FORMAT SERDE
'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
STORED AS INPUTFORMAT
'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION
's3://www.taobao.com/hive_dataware/dmp/t_tbl2'
查看某个表的建表语句的命令如下
show create table dep.tbl_1 --查看dep库下面,tbl_1表的建表语句