Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-26287

beeline exit status code is 0 when connection to server fails

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.1.3
    • None
    • Beeline
    • None

    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

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            solomin Pavel Solomin
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: