Repository: ambari Updated Branches: refs/heads/trunk 89c6f2628 -> 0ada28abc
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/0ada28ab Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0ada28ab Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0ada28ab Branch: refs/heads/trunk Commit: 0ada28abc97e1b54833b98340a43e09c948a7e25 Parents: 89c6f26 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:13 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/0ada28ab/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";
