我尝试将命令从hive cli迁移到直线:
$ hive -e "USE my_db;ALTER TABLE apache_log ADD PARTITION(year = 2015, month = 3) LOCATION 'hdfs://DB//user/my_db/prod/apache_log/2015/03';"
这有效。
但是当它直线行动时,它并不喜欢"使用my_db;"部分:
$ beeline -u jdbc:hive2://my_server.com -n my_user -p my_password -e "USE my_db;ALTER TABLE apache_log ADD PARTITION(year = 2015, month = 3) LOCATION 'hdfs://DB/user/my_user/prod/apache_log/2015/03';"
Error: Error while compiling statement: FAILED: ParseException line 1:9 missing EOF at ';' near 'my_db' (state=42000,code=40000)
Beeline version 0.12.0-cdh5.1.3 by Apache Hive
根据错误信息(期待EOF),在我看来直线不会接受像hive cli那样的多语句吗?
答案 0 :(得分:0)
我已将其作为Hive错误提出并被接受为提供的错误和补丁:https://issues.apache.org/jira/browse/HIVE-9877
答案 1 :(得分:0)
通过这样做可以做到这一点:
(我在不止一行上写了它以使其更具可读性)
beeline
-u jdbc:hive2://my_server.com
-n my_user -p my_password
-e "USE my_db;"
-e "ALTER TABLE apache_log ADD PARTITION(year = 2015, month = 3) LOCATION 'hdfs://DB/user/my_user/prod/apache_log/2015/03';"
-e "--other nice queries..."