38.hive建表

0.
 sudo -u hive hive --auxpath /usr/lib/hive/lib/neop-hive.jar:/usr/lib/hive/lib/fastjson.jar:/usr/lib/hive/lib/neop-hadoop-lzo.jar -e "MSCK REPAIR TABLE dbname.tbname"

  

 
1.
CREATE EXTERNAL TABLE `dbname.tbname`(
  `role` string COMMENT '')
ROW FORMAT SERDE 
  'org.apache.hadoop.hive.serde2.RegexSerDe' 
WITH SERDEPROPERTIES ( 
  'columns.comments'='1', 
  'input.regex'='^(.*?)$') 
STORED AS INPUTFORMAT 
  'org.apache.hadoop.mapred.TextInputFormat' 
OUTPUTFORMAT 
  'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION
  'hdfs://neophdfs/home/workspace/gxx/data/path'
TBLPROPERTIES (
  'COLUMN_STATS_ACCURATE'='false', 
  'numFiles'='0', 
  'numRows'='-1', 
  'rawDataSize'='-1', 
  'totalSize'='0', 
  'transient_lastDdlTime'='1513777490')
2. 
CREATE EXTERNAL TABLE `dbname.tbname`(
    `role_id` string,
    `server` string,
    `totalcount` int,
    `frequdid` string,
    `freqcount` int,
    `freqarea` string,
    `areacount` int)
STORED AS ORC
LOCATION 
  '/home/workspace/gxx/data/path'
TBLPROPERTIES 
  ('orc.compress"="SNAPPY' )
  
 sudo -u hive hive --auxpath /usr/lib/hive/lib/neop-hive.jar:/usr/lib/hive/lib/fastjson.jar:/usr/lib/hive/lib/neop-hadoop-lzo.jar -e "MSCK REPAIR TABLE dbname.tbname"
 
 
 CREATE EXTERNAL TABLE `dbname.tbname`(
    `role_id` string,
    `server` string,
    `totalcount` int,
    `frequdid` string,
    `freqcount` int,
    `freqarea` string,
    `areacount` int)
STORED AS ORC
TBLPROPERTIES 
  ('orc.compress"="SNAPPY' )
  
  
  
  
CREATE EXTERNAL TABLE `dbname.tbname`(
  `role_id` string, 
  `server` string, 
  `totalcount` int, 
  `frequdid` string, 
  `freqcount` int, 
  `freqarea` string, 
  `areacount` int)
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
  'hdfs://neophdfs/home/workspace/data/path'
TBLPROPERTIES (
  'COLUMN_STATS_ACCURATE'='false', 
  'numFiles'='10000', 
  'numRows'='-1', 
  'orc.compress"="SNAPPY'='', 
  'rawDataSize'='-1', 
  'totalSize'='840630465', 
  'transient_lastDdlTime'='1514978701')

  

posted @ 2018-01-14 23:17  桃源仙居  阅读(148)  评论(0)    收藏  举报