You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2014/08/10 04:05:26 UTC
svn commit: r1617043 -
/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
Author: hashutosh
Date: Sun Aug 10 02:05:25 2014
New Revision: 1617043
URL: http://svn.apache.org/r1617043
Log:
HIVE-7618 : TestDDLWithRemoteMetastoreSecondNamenode unit test failure (Jason Dere via Sushanth Sowmyan)
Modified:
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java?rev=1617043&r1=1617042&r2=1617043&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java Sun Aug 10 02:05:25 2014
@@ -1852,7 +1852,7 @@ public class DDLTask extends Task<DDLWor
final String ROW_FORMAT = "row_format";
final String TBL_LOCATION = "tbl_location";
final String TBL_PROPERTIES = "tbl_properties";
- boolean isHbaseTable = false;
+ boolean needsLocation = true;
StringBuilder createTab_str = new StringBuilder();
String tableName = showCreateTbl.getTableName();
@@ -1864,9 +1864,7 @@ public class DDLTask extends Task<DDLWor
FileSystem fs = resFile.getFileSystem(conf);
outStream = fs.create(resFile);
- if (tbl.getStorageHandler() != null) {
- isHbaseTable = tbl.getStorageHandler().toString().equals("org.apache.hadoop.hive.hbase.HBaseStorageHandler");
- }
+ needsLocation = doesTableNeedLocation(tbl);
if (tbl.isView()) {
String createTab_stmt = "CREATE VIEW `" + tableName + "` AS " + tbl.getViewExpandedText();
@@ -1883,7 +1881,7 @@ public class DDLTask extends Task<DDLWor
createTab_str.append("<" + LIST_PARTITIONS + ">\n");
createTab_str.append("<" + SORT_BUCKET + ">\n");
createTab_str.append("<" + ROW_FORMAT + ">\n");
- if (!isHbaseTable) {
+ if (needsLocation) {
createTab_str.append("LOCATION\n");
createTab_str.append("<" + TBL_LOCATION + ">\n");
}
@@ -2065,7 +2063,7 @@ public class DDLTask extends Task<DDLWor
createTab_stmt.add(SORT_BUCKET, tbl_sort_bucket);
createTab_stmt.add(ROW_FORMAT, tbl_row_format);
// Table location should not be printed with hbase backed tables
- if (!isHbaseTable) {
+ if (needsLocation) {
createTab_stmt.add(TBL_LOCATION, tbl_location);
}
createTab_stmt.add(TBL_PROPERTIES, tbl_properties);
@@ -3933,7 +3931,7 @@ public class DDLTask extends Task<DDLWor
tbl.getTTable().getSd().setOutputFormat(tbl.getOutputFormatClass().getName());
}
- if (!Utilities.isDefaultNameNode(conf) && tbl.getTTable().getSd().isSetLocation()) {
+ if (!Utilities.isDefaultNameNode(conf) && doesTableNeedLocation(tbl)) {
// If location is specified - ensure that it is a full qualified name
makeLocationQualified(tbl.getDbName(), tbl.getTTable().getSd(), tbl.getTableName());
}
@@ -4341,4 +4339,15 @@ public class DDLTask extends Task<DDLWor
database.getName().toLowerCase() + ".db")));
}
}
+
+ private static boolean doesTableNeedLocation(Table tbl) {
+ // If we are ok with breaking compatibility of existing 3rd party StorageHandlers,
+ // this method could be moved to the HiveStorageHandler interface.
+ boolean retval = true;
+ if (tbl.getStorageHandler() != null) {
+ retval = !tbl.getStorageHandler().toString().equals(
+ "org.apache.hadoop.hive.hbase.HBaseStorageHandler");
+ }
+ return retval;
+ }
}