hive 基礎操作記錄(非教程)

-- 進入查詢環境
hive;

-- 進入數據庫
use foxdpi01;

hive> use foxdpi01;
OK
Time taken: 2.128 seconds

-- 查看錶結構
describe origin_sample_base ;
-- 常看詳細信息;
describe formatted origin_sample_base;

-- 查看數據
select *  from  origin_sample_base limit 10;

--創建表,按照 |  分割字段
CREATE TABLE `url_mapping`(
  `code_host_1` string, 
  `code_host_2` string )
ROW FORMAT SERDE 
  'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' 
WITH SERDEPROPERTIES ( 
  'escape.delim'='\\\\', 
  'field.delim'='|', 
  'serialization.null.format'='') 
STORED AS INPUTFORMAT 
  'org.apache.hadoop.mapred.TextInputFormat' 
OUTPUTFORMAT 
  'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat';

-- load_data 
load data local inpath '/data/uc/url_mappingtxt' into table url_mappinp;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章