diff --git beeline/src/java/org/apache/hive/beeline/BeeLine.java beeline/src/java/org/apache/hive/beeline/BeeLine.java index 5322ca6..79922d2 100644 --- beeline/src/java/org/apache/hive/beeline/BeeLine.java +++ beeline/src/java/org/apache/hive/beeline/BeeLine.java @@ -1778,7 +1778,25 @@ void handleSQLException(SQLException e) { } if (e.getCause() instanceof TTransportException) { - error(loc("hs2-unavailable")); + switch (((TTransportException)e.getCause()).getType()) { + case TTransportException.ALREADY_OPEN: + error(loc("hs2-connection-already-open")); + break; + case TTransportException.END_OF_FILE: + error(loc("hs2-unexpected-end-of-file")); + break; + case TTransportException.NOT_OPEN: + error(loc("hs2-could-not-open-connection")); + break; + case TTransportException.TIMED_OUT: + error(loc("hs2-connection-timed-out")); + break; + case TTransportException.UNKNOWN: + error(loc("hs2-unknown-connection-problem")); + break; + default: + error(loc("hs2-unexpected-error")); + } } error(loc(e instanceof SQLWarning ? "Warning" : "Error", diff --git beeline/src/main/resources/BeeLine.properties beeline/src/main/resources/BeeLine.properties index 13321d2..9172ca5 100644 --- beeline/src/main/resources/BeeLine.properties +++ beeline/src/main/resources/BeeLine.properties @@ -142,7 +142,16 @@ active-connections: 0#No active connections|1#{0} active connection:|1<{0} activ time-ms: ({0,number,#.###} seconds) -hs2-unavailable: HS2 may be unavailable, check server status +hs2-connection-already-open: Socket already connected. +hs2-unexpected-end-of-file: Unexpected end of file when reading from HS2 server. The root \ +cause might be too high concurrent number of connections. Please check the number of active \ +connections, and adjust hive.server2.thrift.max.worker.threads is applicable. +hs2-could-not-open-connection: Could not open connection to the HS2 server. Please check the \ +server URI, and server status. +hs2-connection-timed-out: Connection timeout when connecting to HS2 server. +hs2-unknown-connection-problem: Unknown HS2 problem when connecting to thrift server. +hs2-unexpected-error: Unexpected HS2 error when connecting to the thrift server. + cmd-usage: Usage: java org.apache.hive.cli.beeline.BeeLine \n \ \ -u the JDBC URL to connect to\n \