Repository: ambari Updated Branches: refs/heads/branch-2.1 5fb8fa27e -> 5eb56d822
AMBARI-13988. Hive View : Upload Table Tab : if selected datatabase is default then data does not show in table. (Nitiraj Rathore via yusaku) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5eb56d82 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5eb56d82 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5eb56d82 Branch: refs/heads/branch-2.1 Commit: 5eb56d822d713fd5ca4676a9e775e176fd78ca08 Parents: 5fb8fa2 Author: Yusaku Sako <[email protected]> Authored: Mon Nov 30 15:56:13 2015 -0800 Committer: Yusaku Sako <[email protected]> Committed: Mon Nov 30 15:56:49 2015 -0800 ---------------------------------------------------------------------- .../ambari/view/hive/resources/uploads/UploadService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/5eb56d82/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/uploads/UploadService.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/uploads/UploadService.java b/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/uploads/UploadService.java index 2098a5f..8b5b851 100644 --- a/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/uploads/UploadService.java +++ b/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/uploads/UploadService.java @@ -64,6 +64,7 @@ public class UploadService extends BaseService { final private String HIVE_META_STORE_LOCATION_KEY = "hive.metastore.warehouse.dir"; final private String HIVE_SITE = "hive-site"; + final private String HIVE_DEFAULT_DB = "default"; @POST @Path("/preview") @@ -173,7 +174,8 @@ public class UploadService extends BaseService { createdJobController.submit(); getResourceManager().saveIfModified(createdJobController); - String filePath = databaseName + ".db/" + tableName + "/" + tableName + ".csv"; + String filePath = (databaseName == null || databaseName.equals(HIVE_DEFAULT_DB)) ? "" : databaseName + ".db/"; + filePath += tableName + "/" + tableName + ".csv"; JSONObject jobObject = new JSONObject(); jobObject.put("jobId", job.getId()); @@ -236,7 +238,6 @@ public class UploadService extends BaseService { br.readLine(); // TODO : remove the header line. Wrong if first record is beyond first endline } - String basePath = getHiveMetaStoreLocation(); if (null == basePath) basePath = "/apps/hive/warehouse";
