分享

Hadoop Hive sql语法详解1-认识hive及DDL操作

ainubis 发表于 2015-3-29 13:15:28
好东西,多xie楼主分享
回复

使用道具 举报

mvs2008 发表于 2015-7-2 15:00:24
本帖最后由 mvs2008 于 2015-7-2 15:01 编辑

阿飞大神,是否可以解释下:
建分区表:
1.
CREATE TABLE par_table(viewTime INT, userid BIGINT,
      page_url STRING, referrer_url STRING,
      ip STRING COMMENT 'IP Address of the User')
COMMENT 'This is the page view table'
PARTITIONED BY(date STRING, pos STRING)
ROW FORMAT DELIMITED ‘\t’
   FIELDS TERMINATED BY '\n'
STORED AS SEQUENCEFILE;

2.
CREATE TABLE par_table(viewTime INT, userid BIGINT,
      page_url STRING, referrer_url STRING,
      ip STRING COMMENT 'IP Address of the User')
COMMENT 'This is the page view table'
PARTITIONED BY(date STRING, pos STRING);


建Bucket表

CREATE TABLE par_table(viewTime INT, userid BIGINT,
      page_url STRING, referrer_url STRING,
      ip STRING COMMENT 'IP Address of the User')
COMMENT 'This is the page view table'
PARTITIONED BY(date STRING, pos STRING)
CLUSTERED BY(userid) SORTED BY(viewTime) INTO 32 BUCKETS
ROW FORMAT DELIMITED ‘\t’
   FIELDS TERMINATED BY '\n'
STORED AS SEQUENCEFILE;
也可以写成这样吗?
CREATE TABLE par_table(viewTime INT, userid BIGINT,
      page_url STRING, referrer_url STRING,
      ip STRING COMMENT 'IP Address of the User')
COMMENT 'This is the page view table'
PARTITIONED BY(date STRING, pos STRING)
CLUSTERED BY(userid) SORTED BY(viewTime) INTO 32 BUCKETS;





解释下:
ROW FORMAT DELIMITED ‘\t’
   FIELDS TERMINATED BY '\n'
STORED AS SEQUENCEFILE;
@阿飞


回复

使用道具 举报

ableq 发表于 2015-11-3 17:00:43
create table par_table(viewtime int, userid bigint,
     page_url string, referrer_url string,
     ip string comment 'ip address of the user')
comment 'this is the page view table'
partitioned by(data_date string,pos string)
row format delimited
fields terminated by '\t'
lines terminated by '\n'
stored as sequencefile;

有个疑问?
我只安装了hadoop2.7.1、hive 1.2.1,没有安装hbase,那么我使用hive新建这些个表存放在哪里呢?好像没见到什么数据库?
回复

使用道具 举报

nextuser 发表于 2017-5-4 14:23:34
mvs2008 发表于 2015-7-2 15:00
阿飞大神,是否可以解释下:
建分区表:
1.

ROW FORMAT DELIMITED ‘\t’应该是行分隔符
   FIELDS TERMINATED BY '\n'应该是字段名分隔符
STORED AS SEQUENCEFILE;这是存储格式SEQUENCEFILE

回复

使用道具 举报

12
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条