-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[ZEPPELIN-3014] NPE bug fix and Error message enhancement with Kylin Interpreter #2634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
merge recent changes
|
@jinxliu |
|
can you update the PR title, description and see https://zeppelin.apache.org/contribution/contributions.html |
kylin/pom.xml
Outdated
| </dependency> | ||
| <dependency> | ||
| <groupId>org.json</groupId> | ||
| <artifactId>json</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a new dependency? if so, it should be added to the LICENSE file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zeppelin-interpreter has dependecy Gson
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gson yes, and this is org.json? I didn't see it in the LICENSE file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i mean need to use Gson instead of org.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much @tinkoff-dwh and @felixcheung for your comments. I was aware that zeppelin already has the dependency of gson, so is it mandatory to use gson instead of json?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not necessarily. each interpreter can use its own set of things. but new binary dependencies we need to list in LICENSE file for the release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@felixcheung I have replaced json with gson and I will push the code soon.
| StringBuilder errorMessage = new StringBuilder("Failed : HTTP error code " + code); | ||
| logger.error("failed to execute query: " + result); | ||
| try { | ||
| JSONObject content = new JSONObject(result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if result is an empty string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If result is empty string, depending on the response code:
if the code is 200, an empty table will be rendered;
if the code is not 200, there will be error message, with status code, but no detailed error message, e.g. "Failed : HTTP error code 500. Error message: "
| errorMessage.append(". Error message: Unauthorized. This request requires " | ||
| + "HTTP authentication. Please make sure your have set your credentials correctly."); | ||
| } else { | ||
| errorMessage.append(". Error message: " + result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previously we were formatting the output (see L186) before setting it to InterpreterResult - do we still need to do that here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@felixcheung yes we still need to do that. The code here is to parse the result and get detailed error message from kylin when query fails. The formatting result will be called when the response code is 200 and query successes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, to clarify I was referring to
String output;
- logger.info("Output from Server .... \n");
- while ((output = br.readLine()) != null) {
- logger.info(output);
- sb.append(output).append('\n');
}
- InterpreterResult rett = new InterpreterResult(InterpreterResult.Code.SUCCESS,
- formatResult(sb.toString()));
does it still need to read the result line by line like this from before, before passing to formatResult()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@felixcheung no we do not need to do that. I replace the line by line processing with the following statement: result = IOUtils.toString(response.getEntity().getContent(), "UTF-8")
keep up to date with apache master branch
|
@felixcheung is there something wrong with travis-ci? |
|
seems like travis problem. please try to kick it off again by close-reopen this PR |
|
I have tried several times since yesterday, hope this time it works. |
|
@felixcheung it still does not work. |
|
@jinxliu Could you rebase and try again ? |
|
@jinxliu Actually you don't need to create another PR, for the next time you just need to rebase and force push |
What is this PR for?
A few sentences describing the overall goals of the pull request's commits.
First time? Check out the contributing guide - https://zeppelin.apache.org/contribution/contributions.html
What type of PR is it?
Bug Fix
Todos
What is the Jira issue?
How should this be tested?
Screenshots (if appropriate)
before: NPE when result set is empty
after: no NPE when result set is empty, just an empty table
before: when query fails, only error code is returned, no error message
after: when query fails, both error code and error message are displayed to users
Questions: