SET TODAY = to_date(from_unixtime(unix_timestamp()));
하이브에서는 사용할 수 없습니다. 당신이 할 수있는 것은 당신이
set TODAY=2013-11-05;
파일 fileName.sql 필요가 다른 따라 쿼리를 실행하기 전에로드 할 볼 파일 fileName.sql에서 지금
select concat ('set TODAY=',to_date(from_unixtime(unix_timestamp())),'\;') from testTableName limit 1 >>/path/to/HQL/file/fileName.sql
입니다. 이에 의해 할 수있는 :
hive -f hiveQueries.sql
당신은 같은 것을 포함해야 hiveQueries.sql 파일 :이 도움이
use testDB;
source /path/to/HQL/file/fileName.sql;
select * from testTable where someColumn=${hiveconf:TODAY};
희망을 .. :)
을 예, 그것은 좋은 것입니다 HQL이 몇 가지 제어 기능을 추가했지만 현재는 쉘에서 전달할 수 있습니다. 예를 들어'hive --hiveconf TODAY = $ (date + "% Y- % m- % d")' – libjack