Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
3.1.3
-
None
-
None
-
bash-4.2$ cat /etc/os-release NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/"CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7" bash-4.2$ echo ${BASH_VERSION} 4.2.46(2)-release bash-4.2$ java -version openjdk version "1.8.0_322" OpenJDK Runtime Environment (build 1.8.0_322-b06) OpenJDK 64-Bit Server VM (build 25.322-b06, mixed mode) bash-4.2$ beeline --version Hive 3.1.3 Git git://MacBook-Pro.fios-router.home/Users/ngangam/commit/hive -r 4df4d75bf1e16fe0af75aad0b4179c34c07fc975 Compiled by ngangam on Sun Apr 3 16:58:16 EDT 2022 From source with checksum 5da234766db5dfbe3e92926c9bbab2af
bash-4.2$ cat /etc/os-release NAME= "CentOS Linux" VERSION= "7 (Core)" ID= "centos" ID_LIKE= "rhel fedora" VERSION_ID= "7" PRETTY_NAME= "CentOS Linux 7 (Core)" ANSI_COLOR= "0;31" CPE_NAME= "cpe:/o:centos:centos:7" HOME_URL= "https: //www.centos.org/" BUG_REPORT_URL= "https: //bugs.centos.org/" CENTOS_MANTISBT_PROJECT= "CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION= "7" REDHAT_SUPPORT_PRODUCT= "centos" REDHAT_SUPPORT_PRODUCT_VERSION= "7" bash-4.2$ echo ${BASH_VERSION} 4.2.46(2)-release bash-4.2$ java -version openjdk version "1.8.0_322" OpenJDK Runtime Environment (build 1.8.0_322-b06) OpenJDK 64-Bit Server VM (build 25.322-b06, mixed mode) bash-4.2$ beeline --version Hive 3.1.3 Git git: //MacBook-Pro.fios-router.home/Users/ngangam/commit/hive -r 4df4d75bf1e16fe0af75aad0b4179c34c07fc975 Compiled by ngangam on Sun Apr 3 16:58:16 EDT 2022 From source with checksum 5da234766db5dfbe3e92926c9bbab2af
Description
When beeline is used to run script files (-f /path/to/hql), it exits with 0 status code even when connection to HiveServer2 fails:
bash-4.2$ echo "select 1" > /tmp/query.hql bash-4.2$ beeline -u foo -f /tmp/query.hql scan complete in 3ms scan complete in 6ms No known driver to handle "foo" bash-4.2$ echo $? 0 bash-4.2$ beeline -u jdbc:hive2://bar.com:10000 -f /tmp/query.hql Connecting to jdbc:hive2://bar.com:10000 22/06/02 17:46:50 [main]: WARN jdbc.HiveConnection: Failed to connect to bar.com:10000 Could not open connection to the HS2 server. Please check the server URI and if the URI is correct, then ask the administrator to check the server status. Error: Could not open client transport with JDBC Uri: jdbc:hive2://bar.com:10000: java.net.ConnectException: Connection timed out (Connection timed out) (state=08S01,code=0) bash-4.2$ echo $? 0
When -e flag is used, the tool seems to report the correct exit status code:
bash-4.2$ beeline -u foo -e "select 1" scan complete in 4ms scan complete in 3ms No known driver to handle "foo" Cannot run commands specified using -e. No current connection bash-4.2$ echo $? 1
This bug looks to be similar to:
https://issues.apache.org/jira/browse/HIVE-6978
https://issues.apache.org/jira/browse/HIVE-9263
https://issues.apache.org/jira/browse/HIVE-12612