aravi5 commented on a change in pull request #1626: DRILL-6855: Query from 
non-existent proxy user fails with "No default schema selected" when 
impersonation is enabled
URL: https://github.com/apache/drill/pull/1626#discussion_r255288516
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/calcite/jdbc/DynamicRootSchema.java
 ##########
 @@ -115,8 +116,25 @@ public void loadSchemaFactory(String schemaName, boolean 
caseSensitive) {
           schemaPlus.add(wrapper.getName(), wrapper);
         }
       }
-    } catch(ExecutionSetupException | IOException ex) {
+    } catch(ExecutionSetupException ex) {
       logger.warn("Failed to load schema for \"" + schemaName + "\"!", ex);
+    } catch (IOException iex) {
+      // We can't proceed further without a schema, throw a runtime exception.
+      UserException.Builder exceptBuilder =
+          UserException
+              .resourceError(iex)
+              .message("Failed to create schema tree.")
+              .addContext("IOException: ", iex.getMessage());
+
+      // Improve the error message for client side.
+      final String errorMsg = "Error getting user info for current user";
+      if (iex.getMessage().startsWith(errorMsg)) {
+        final String contextString = "[Hint: Username is absent in connection 
URL or doesn't " +
+                                         "exist on Drillbit node. Please 
specify a username in connection " +
+                                         "URL which is present on Drillbit 
node.]";
+        exceptBuilder.addContext(contextString);
+      }
+      throw exceptBuilder.build(logger);
 
 Review comment:
   I agree with your point that `ExecutionSetupException` should be handled 
similar to `IOException`. I did not make the changes since I did not fully 
implications and was trying to limit the impact. May be @arina-ielchiieva / 
@chunhui-shi could weigh in their thoughts here.
   
   I have added a utility that could provide hints, if any. This way we can 
have a single place for all hints.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to