第一种常用新建原始表:
create [EXTERNAL] table vv_stat_fact
(
userid string,
stat_date string,
tryvv int,
sucvv int,
ptime float
)
PARTITIONED BY ( 非必选;创建分区表
dt string)
clustered by (userid) into 3000 buckets // 非必选;分桶子
ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘\t’ // 必选;指定列之间的分隔符
STORED AS rcfile // 非必选;指定文件的读取格式,默认textfile格式
location ‘/testdata/’; //非必选;指定文件在hdfs上的存储路径,如果已经有文件,会自动加载 ,默认在hive的warehouse下
建表1,全部使用默认配置。
CREATE TABLE emp2
(
id
string,
name
string,
job
string,
mgr
string,
hiredate
date,
sal
double,
comm
double,
deptid
string)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘,’ ;
如果不指定存储路径,默认在hdfs上/user/hive/warehouse/shujia/emp2`
h