Skip to content

Conversation

@jinxliu
Copy link
Contributor

@jinxliu jinxliu commented Oct 27, 2017

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

  • - Task

What is the Jira issue?

How should this be tested?

Screenshots (if appropriate)

before: NPE when result set is empty

image

after: no NPE when result set is empty, just an empty table

image

before: when query fails, only error code is returned, no error message

image

after: when query fails, both error code and error message are displayed to users

image

Questions:

  • Does the licenses files need update? No.
  • Is there breaking changes for older versions? No.
  • Does this needs documentation? No.

@jinxliu
Copy link
Contributor Author

jinxliu commented Oct 27, 2017

This PR has two commits, ec68d12 is to enhance the error message parse and display, the second commit is d20872c for NPE bug fix when returned dataset is empty.

@jinxliu jinxliu changed the title Kylin intp NPE bug fix and Error message enhancement with Kylin Interpreter Oct 27, 2017
@tinkoff-dwh
Copy link
Contributor

@jinxliu
read https://zeppelin.apache.org/contribution/contributions.html (Creating a Pull Request)

@felixcheung
Copy link
Member

felixcheung commented Oct 27, 2017

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>
Copy link
Member

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

Copy link
Contributor

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

Copy link
Member

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

Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Member

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.

Copy link
Contributor Author

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);
Copy link
Member

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?

Copy link
Contributor Author

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);
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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()?

Copy link
Contributor Author

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")

@jinxliu jinxliu changed the title NPE bug fix and Error message enhancement with Kylin Interpreter [ZEPPELIN-3014] NPE bug fix and Error message enhancement with Kylin Interpreter Oct 30, 2017
@jinxliu
Copy link
Contributor Author

jinxliu commented Nov 1, 2017

@felixcheung is there something wrong with travis-ci?

@felixcheung
Copy link
Member

seems like travis problem. please try to kick it off again by close-reopen this PR

@jinxliu
Copy link
Contributor Author

jinxliu commented Nov 1, 2017

I have tried several times since yesterday, hope this time it works.

@jinxliu jinxliu closed this Nov 1, 2017
@jinxliu jinxliu reopened this Nov 1, 2017
@jinxliu
Copy link
Contributor Author

jinxliu commented Nov 1, 2017

@felixcheung it still does not work.

@zjffdu
Copy link
Contributor

zjffdu commented Nov 1, 2017

@jinxliu Could you rebase and try again ?

@jinxliu
Copy link
Contributor Author

jinxliu commented Nov 2, 2017

@zjffdu sure I will close this PR and have created another PR #2645. Please review.

@jinxliu jinxliu closed this Nov 2, 2017
@zjffdu
Copy link
Contributor

zjffdu commented Nov 2, 2017

@jinxliu Actually you don't need to create another PR, for the next time you just need to rebase and force push

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants