Repository: zeppelin
Updated Branches:
refs/heads/master 3505625c2 -> 549bce673
[ZEPPELIN-3014] NPE bug fix and Error message enhancement with Kylin Interpreter
### 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?
* https://issues.apache.org/jira/browse/ZEPPELIN-3014
### How should this be tested?
* Setup Travis CI as described on
https://zeppelin.apache.org/contribution/contributions.html#continuous-integration
* Use existing unit tests in kylin module.
### Screenshots (if appropriate)
before: NPE when result set is empty
![image](https://user-images.githubusercontent.com/18542573/32154048-f1b8ba58-bcfb-11e7-98cc-98cdf484f2d5.png)
after: no NPE when result set is empty, just an empty table
![image](https://user-images.githubusercontent.com/18542573/32154069-110215d0-bcfc-11e7-87e9-cc049001f1c7.png)
before: when query fails, only error code is returned, no error message
![image](https://user-images.githubusercontent.com/18542573/32154088-29651938-bcfc-11e7-9e66-cd2cfccba054.png)
after: when query fails, both error code and error message are displayed
to users
![image](https://user-images.githubusercontent.com/18542573/32154096-3d3ab01c-bcfc-11e7-8cf3-d710d96b8c5a.png)
### Questions:
* Does the licenses files need update? No.
* Is there breaking changes for older versions? No.
* Does this needs documentation? No.
Author: Liu
Closes #2645 from jinxliu/kylin-intp-new and squashes the following commits:
d5692bf [Liu] refactor
85b6424 [Liu] add test for empty result set
4596470 [Liu] ZEPPELIN-3014: NPE bug fix and Error message enhancement with
Kylin Interpreter
Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/549bce67
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/549bce67
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/549bce67
Branch: refs/heads/master
Commit: 549bce6738ffd7f460867d3f5ee00a9e2ec14125
Parents: 3505625
Author: Liu
Authored: Tue Dec 5 15:24:20 2017 +0800
Committer: Jeff Zhang
Committed: Wed Dec 13 18:54:06 2017 +0800
--
.../zeppelin/kylin/KylinErrorResponse.java | 63 +
.../apache/zeppelin/kylin/KylinInterpreter.java | 71
.../zeppelin/kylin/KylinInterpreterTest.java| 24 +++
3 files changed, 130 insertions(+), 28 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/549bce67/kylin/src/main/java/org/apache/zeppelin/kylin/KylinErrorResponse.java
--
diff --git
a/kylin/src/main/java/org/apache/zeppelin/kylin/KylinErrorResponse.java
b/kylin/src/main/java/org/apache/zeppelin/kylin/KylinErrorResponse.java
new file mode 100644
index 000..00439e8
--- /dev/null
+++ b/kylin/src/main/java/org/apache/zeppelin/kylin/KylinErrorResponse.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zeppelin.kylin;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonSyntaxException;
+import org.apache.zeppelin.common.JsonSerializable;
+
+/**
+ * class for Kylin Error Response.
+ */
+class KylinErrorResponse implements JsonSerializable {
+ private static final Gson gson = new Gson();
+
+ private String stacktrace;
+ private String exception;
+ private String url;
+ private String code;
+ private Object data;
+ private String msg;
+
+ public KylinErrorResponse(String stacktrace, String exception, String url,
+ String code, Object data, String msg) {
+this.stacktrace = stacktrace;
+this.exception = exception;
+this.url = url;
+this.code = code;
+this.data = data;
+this.msg = msg;
+ }
+
+ public String getException() {
+return exception;
+ }
+
+ public String toJson() {
+