hive 使用相關問題

2021-06-18 20:14:01 字數 528 閱讀 4439

hive中字串轉換成整數  可以用round(***) 或者cast(xx as bigint)

上面兩種方法都可以!

linux 可以fc在命令列下編輯較長的命令列

hive 呼叫python指令碼

test.py根據路徑檔名獲得檔名(比如/dir1/dir2/dir3/dir4/***x.txt  得到 ***x.txt) 

#!/user/bin/python

import sys

for line in sys.stdin:

print "%s"%(line.split("/")[-1].replace(" ","").replace("\n","").repalce("\r",""))

在hql是

add file test.py; select transform(path) using 'python test.py' as (path_1 string ) from tb1;

collet_set()可以用在group by的時候來聚合對應的字串

Hive相關概念

hive 基於hadoop之上的乙個離線資料倉儲,使用hdfs作為底層儲存,可以將結構化的資料檔案對映為一張資料庫表,並提供簡單的sql查詢功能,可以將sql語句轉換為mapreduce任務進行執行。hive主要分為以下幾個部分 1.使用者介面 使用者介面主要有三個 cli,client 和 web...

hive相關知識

hivesql的相關知識 1.union 和 union all的區別 兩個都能進行全連線,但是表字段名稱需要相同。不同的是union連線後的結果去重,union all的結果不去重 2.rank over 和row number over 的區別 rank over 的結果對存在的並列現象會全部顯...

yum 使用相關問題

yum使用相關問題 loaded plugins fastestmirror loading mirror speeds from cached hostfile error cannot retrieve metalink for repository epel.please verify its...