Monday

beeline 변수 사용하기 본문

빅데이터/Hive

beeline 변수 사용하기

뉴비2 2021. 2. 22. 21:26

report.sql이란 파일이 다음과 같이 저장되어 있을 때 beeline을 통해서 사용하는 법을 보여드리겠습니다.

# report.sql
SELECT * FROM accounting.current WHERE month= '${hivevar:month}'

or

# report.sql (변수 선언 포함)
SET hivevar:month = October;
SELECT * FROM accounting.current WHERE month= '${hivevar:month}'

사용법

 $ beeline -u jdbc:hive2://localhost:10000 --hivevar month="October" -f report.sql

 

Comments