在hue中操作hive

來源:互聯網
上載者:User
建立新表

建表語句如下:

CREATE TABLE IF NOT EXISTS user_collection_9(  user_id string ,  seller_id string ,  product_id string , time string)  ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' ; 
hue中向hive匯入資料

首先,在檔案瀏覽器中,將你建立表對應的文本導進來,如下圖所示:

使用如下動作陳述式將文本資料匯入到hive中。
hive中將選擇的幾張表資料匯入新表

由於我的三張表結構是一樣的,所以直接使用的是下面的動作陳述式。

CREATE TABLE user_port as SELECT * FROM user_collection_7 UNION ALL select * FROM user_collection_8 UNION all select * FROM user_collection_9
hive中的串連函數

在hive中,group_concat不能使用,使用concat_ws.

CREATE table user_collection_port as select ip as user_id,concat_ws(' ',collect_set(product_id)) as product FROM user_collection_taobao_allall GROUP BY ip having count(*)>2;

使用該函數操作的結果會把每個使用者對應的資料連線到一起了,中間使用空格隔開,如下圖所示:
hue中將hive中的資料匯出到本地

下表結構跟上圖一樣,所以兩列直接用了定位字元作為分隔字元,使用如下語句,你就會發現在“/user/qianyang/”目錄下,存在

insert overwrite  directory '/user/qianyang/' row format delimited fields terminated by '\t' select * from user_789collection;

可以線上瀏覽一些這個資料。
匯出到windows

按照下圖操作,便可將該表資料下載到本地。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.