hive建表

hive分内部表和外部表

  

create table xxx(
        logtime string ,
        traceid string ,
        param string ,
        result string ,
        runtime string
        ) partitioned by (
        logday string 
) row format delimited fields terminated by '\t'
collection items terminated by ','
lines terminated by '\n'
stored as textfile 
location '/xxxxxxxx/xxxx';
CREATE EXTERNAL TABLE page_view(
     viewTime INT, 
     userid BIGINT,
     page_url STRING, 
     referrer_url STRING,
     ip STRING COMMENT 'IP Address of the User',
     country STRING COMMENT 'country of origination')
 COMMENT 'This is the staging page view table'
 ROW FORMAT DELIMITED FIELDS TERMINATED BY '\054'
 STORED AS TEXTFILE
 LOCATION '/user/hadoop/warehouse/page_view';

相关推荐