學習hive知識點

2022-07-17 16:54:15 字數 1092 閱讀 7727

1、建立檢視:

hive> create view valid_records as select * from records2 where temperature !=9999;

2、檢視檢視詳細資訊:

hive> describe extended valid_records;

3、從表中匯出資料:

hadoop fs -cp source_path target_path

或者:使用者可以使用 insert……directory……

insert overwrite local directory '/tmp/目錄' 這裡指定的路徑也可以是全url路徑

4、hive中使用正規表示式

(1) hive> select 'price.*' from table_name;

選出所有列名以price作為字首的列

(2) 用like或者rlike

5、聚合函式

可以通過設定屬性hive.map.aggr值為true來提高聚合的效能:

hive>hive.map.aggr=true;

6、什麼情況下hive可以避免進行mapreduce?

在本地模式的時候可以避免觸發乙個mr的job,此外,如果屬性hive.execmode.local.auto的值為true的話,hive還戶嘗試本地模式進行其他的操作。

set hive.execmode.local.auto=true;

說明:最好將 set hive.execmode.local.auto=true;這個設定增加到你的$home/.hiverc配置檔案中去。

7、join語句

hive支援通常的sql join語句,但是只支援等值連線。hive也不支援在on子句中用謂詞or

8、union all

將兩個表或者多個表進行合併,每乙個union all子查詢都必須具有相同的列,而且對應每個欄位的每個型別都必須一致。

hive知識點詳解

hive支援的常用資料型別和檔案格式 hive是一種構建在hadoop上的資料倉儲,hive把sql查詢轉換為一系列在hadoop集群中執行的mapreduce作業,是mapreduce更高層次的抽象,不用編寫具體的mapreduce方法。hive將資料組織為表,這就使得hdfs上的資料有了結構,元...

Hive知識點總結(一)

眾所周知實際開發過程中,hive主要是通過其豐富的內建函式,便捷的類sql來處理經過mapreduce清洗後的資料,下面我們進行hive的知識點總結。1 hive使用方式 方式1 學習時使用的最基本的簡單查詢 bin hive 啟動hive hive select from t test 進行簡單使...

hive常用知識點彙總

1.desc extended formated tablename 描述表結構,如 desc extended im desc formatted im 2.bin hive e f e 不進入hive命令列執行sql語句,如 bin hive e select from im database ...