kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lid...@apache.org
Subject kylin git commit: KYLIN-2396 remove unused code
Date Sat, 21 Jan 2017 12:30:02 GMT
Repository: kylin
Updated Branches:
  refs/heads/master 8331d8d0a -> c2229c9c7


KYLIN-2396 remove unused code


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/c2229c9c
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/c2229c9c
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/c2229c9c

Branch: refs/heads/master
Commit: c2229c9c7f83fe5a28e564c37ada5794a67ee3d8
Parents: 8331d8d
Author: lidongsjtu <lidong@apache.org>
Authored: Sat Jan 21 19:52:42 2017 +0800
Committer: lidongsjtu <lidong@apache.org>
Committed: Sat Jan 21 19:52:42 2017 +0800

----------------------------------------------------------------------
 .../measure/percentile/PercentileContUdf.java   | 37 --------------------
 .../kylin/rest/controller/BasicController.java  | 22 ++++++++++++
 .../rest/controller/DiagnosisController.java    | 19 ----------
 3 files changed, 22 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/c2229c9c/core-metadata/src/main/java/org/apache/kylin/measure/percentile/PercentileContUdf.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/measure/percentile/PercentileContUdf.java
b/core-metadata/src/main/java/org/apache/kylin/measure/percentile/PercentileContUdf.java
deleted file mode 100644
index 4ef6b75..0000000
--- a/core-metadata/src/main/java/org/apache/kylin/measure/percentile/PercentileContUdf.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.kylin.measure.percentile;
-
-public class PercentileContUdf {
-    public static double init() {
-        return 0;
-    }
-
-    public static double add(double accumulator, double v, double r) {
-        return 0;
-    }
-
-    public static double merge(double accumulator0, double accumulator1) {
-        return 0;
-    }
-
-    public static double result(long accumulator) {
-        return 0;
-    }
-}

http://git-wip-us.apache.org/repos/asf/kylin/blob/c2229c9c/server-base/src/main/java/org/apache/kylin/rest/controller/BasicController.java
----------------------------------------------------------------------
diff --git a/server-base/src/main/java/org/apache/kylin/rest/controller/BasicController.java
b/server-base/src/main/java/org/apache/kylin/rest/controller/BasicController.java
index f61492d..6b4c9fd 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/controller/BasicController.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/controller/BasicController.java
@@ -18,11 +18,20 @@
 
 package org.apache.kylin.rest.controller;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 
+import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.kylin.rest.exception.BadRequestException;
 import org.apache.kylin.rest.exception.ForbiddenException;
+import org.apache.kylin.rest.exception.InternalErrorException;
 import org.apache.kylin.rest.exception.NotFoundException;
 import org.apache.kylin.rest.response.ErrorResponse;
 import org.slf4j.Logger;
@@ -74,4 +83,17 @@ public class BasicController {
         }
     }
 
+    protected void setDownloadResponse(String downloadFile, final HttpServletResponse response)
{
+        File file = new File(downloadFile);
+        try (InputStream fileInputStream = new FileInputStream(file); OutputStream output
= response.getOutputStream();) {
+            response.reset();
+            response.setContentType("application/octet-stream");
+            response.setContentLength((int) (file.length()));
+            response.setHeader("Content-Disposition", "attachment; filename=\"" + file.getName()
+ "\"");
+            IOUtils.copyLarge(fileInputStream, output);
+            output.flush();
+        } catch (IOException e) {
+            throw new InternalErrorException("Failed to download file: " + e.getMessage(),
e);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/c2229c9c/server-base/src/main/java/org/apache/kylin/rest/controller/DiagnosisController.java
----------------------------------------------------------------------
diff --git a/server-base/src/main/java/org/apache/kylin/rest/controller/DiagnosisController.java
b/server-base/src/main/java/org/apache/kylin/rest/controller/DiagnosisController.java
index d16547e..f5e7c24 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/controller/DiagnosisController.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/controller/DiagnosisController.java
@@ -19,17 +19,12 @@
 
 package org.apache.kylin.rest.controller;
 
-import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
 import java.util.List;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.commons.io.IOUtils;
 import org.apache.kylin.metadata.badquery.BadQueryEntry;
 import org.apache.kylin.metadata.badquery.BadQueryHistory;
 import org.apache.kylin.rest.exception.InternalErrorException;
@@ -103,18 +98,4 @@ public class DiagnosisController extends BasicController {
 
         setDownloadResponse(filePath, response);
     }
-
-    private void setDownloadResponse(String downloadFile, final HttpServletResponse response)
{
-        File file = new File(downloadFile);
-        try (InputStream fileInputStream = new FileInputStream(file); OutputStream output
= response.getOutputStream();) {
-            response.reset();
-            response.setContentType("application/octet-stream");
-            response.setContentLength((int) (file.length()));
-            response.setHeader("Content-Disposition", "attachment; filename=\"" + file.getName()
+ "\"");
-            IOUtils.copyLarge(fileInputStream, output);
-            output.flush();
-        } catch (IOException e) {
-            throw new InternalErrorException("Failed to create download for diagnosis. "
+ e.getMessage(), e);
-        }
-    }
 }


Mime
View raw message