sercanCyberVision opened a new pull request, #5465:
URL: https://github.com/apache/hive/pull/5465

   **MOTIVATION**
   When the HMS client fails to connect to the server due to a 
`TTransportException`, there is no issue with error reporting.
   
   However, when the failure is caused by an `IOException`, the exception 
object, which is used for reporting purposes, remains null. As a result, it 
does not properly capture the root cause, and end-users encounter an unrelated 
NPE, masking the actual issue.
   ```
   Exception in thread "main" java.lang.AssertionError: Unable to connect to 
HMS!
        at TestHMS.main(TestHMS.java:20)
   Caused by: java.lang.NullPointerException
        at 
org.apache.hadoop.util.StringUtils.stringifyException(StringUtils.java:90)
        at 
org.apache.hadoop.hive.metastore.HiveMetaStoreClient.open(HiveMetaStoreClient.java:613)
        at 
org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:233)
        at 
org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:145)
        at TestHMS.main(TestHMS.java:13)
   ```
   
   **SOLUTION**
   I have added an `IOException` object to capture the corresponding exception 
during connection attempts. If the `IOException` is not null, it will now be 
output, providing clearer information about the failure.
   
   **CHECKS**
   After applying the patch, instead of an NPE, I now receive a proper error 
message:
   ```
   Exception in thread "main" java.lang.AssertionError: Unable to connect to 
HMS!
        at TestHMS.main(TestHMS.java:20)
   Caused by: MetaException(message:Could not connect to meta store using any 
of the URIs provided. Most recent failure: 
   javax.security.auth.login.LoginException: Unable to obtain MapR credentials)
        at 
org.apache.hadoop.hive.metastore.HiveMetaStoreClient.open(HiveMetaStoreClient.java:618)
        at 
org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:233)
        at 
org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:145)
        at TestHMS.main(TestHMS.java:13)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to