Hive 05_hive变量、动态分区
hive 參數、變量
 ?? ?--hive當中的參數、變量,都是以命名空間開頭
 ?? ?--通過${}方式進行引用,其中system、env下的變量必須以前綴開頭
 hive 參數設置方式
?? ?--1、修改配置文件 ${HIVE_HOME}/conf/hive-site.xml
 ?? ?--2、啟動hive cli時,通過--hiveconf key=value的方式進行設置
 ?? ?--例:hive --hiveconf hive.cli.print.header=true
 ?? ?--3、進入cli之后,通過使用set命令設置
 ?? ?
 hive set命令
 ?? ?--在hive CLI控制臺可以通過set對hive中的參數進行查詢、設置
 ?? ?--set設置:
 ?? ??? ?--set hive.cli.print.header=true;
 ?? ?--set查看
 ?? ??? ?--set hive.cli.print.header
 ?? ?--hive參數初始化配置
 ?? ??? ?--當前用戶家目錄下的.hiverc文件
 ?? ??? ?--如: ? ~/.hiverc
 ?? ??? ?--如果沒有,可直接創建該文件,將需要設置的參數寫到該文件中,hive啟動運行時,會加載改文件中的配置。
 ?? ?--hive歷史操作命令集
 ?? ??? ?--~/.hivehistory
 ?? ??? ?
 hive 動態分區
 ?? ?--開啟支持動態分區
 ?? ??? ?--set hive.exec.dynamic.partition=true;
 ?? ??? ??? ?--默認:true
 ?? ??? ?--set hive.exec.dynamic.partition.mode=nostrict;
 ?? ??? ??? ?--默認:strict(至少有一個分區列是靜態分區)
 ?? ??? ?--相關參數
 ?? ??? ??? ?--set hive.exec.max.dynamic.partitions.pernode;
 ?? ??? ??? ??? ?--每一個執行mr節點上,允許創建的動態分區的最大數量(100)
 ?? ??? ??? ?--set hive.exec.max.dynamic.partitions;
 ?? ??? ??? ??? ?--所有執行mr節點上,允許創建的所有動態分區的最大數量(1000)
 ?? ??? ??? ?--set hive.exec.max.created.files;
 ?? ??? ??? ??? ?--所有的mr job允許創建的文件的最大數量(100000)
 ?? ??? ??? ??? ?
 加載數據
 from psn21
 insert overwrite table psn22 partition(age, sex) ?
 select id, name, age, sex, likes, address distribute by age, sex
總結
以上是生活随笔為你收集整理的Hive 05_hive变量、动态分区的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: Hive 03_DML、SerDe、Be
- 下一篇: 小便利——免密钥简单写法
