Browse Source

AMBARI-13988. Hive View : Upload Table Tab : if selected datatabase is default then data does not show in table. (Nitiraj Rathore via yusaku)

Yusaku Sako 10 years ago
parent
commit
0ada28abc9

+ 3 - 2
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";