forked from lijufeng2016/HDP-hive3.1.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HIVE-21482-part-1.patch
29 lines (28 loc) · 1.7 KB
/
HIVE-21482-part-1.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
index a7a9d38669..7b706fc586 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
@@ -4856,8 +4856,11 @@ private int createTableLike(Hive db, CreateTableLikeDesc crtTbl) throws Exceptio
if (crtTbl.isExternal()) {
tbl.setProperty("EXTERNAL", "TRUE");
tbl.setTableType(TableType.EXTERNAL_TABLE);
- // partition discovery is on by default
- tbl.setProperty(PartitionManagementTask.DISCOVER_PARTITIONS_TBLPROPERTY, "true");
+ // if the partition discovery tablproperty is already defined don't change it
+ if (tbl.isPartitioned() && tbl.getProperty(PartitionManagementTask.DISCOVER_PARTITIONS_TBLPROPERTY) == null) {
+ // partition discovery is on by default if it already doesn't exist
+ tbl.setProperty(PartitionManagementTask.DISCOVER_PARTITIONS_TBLPROPERTY, "true");
+ }
}
tbl.setFields(oldtbl.getCols());
@@ -4956,7 +4959,9 @@ private int createTableLike(Hive db, CreateTableLikeDesc crtTbl) throws Exceptio
tbl.setProperty("EXTERNAL", "TRUE");
tbl.setTableType(TableType.EXTERNAL_TABLE);
// partition discovery is on by default
- tbl.setProperty(PartitionManagementTask.DISCOVER_PARTITIONS_TBLPROPERTY, "true");
+ if (tbl.isPartitioned() && tbl.getProperty(PartitionManagementTask.DISCOVER_PARTITIONS_TBLPROPERTY) == null) {
+ tbl.setProperty(PartitionManagementTask.DISCOVER_PARTITIONS_TBLPROPERTY, "true");
+ }
} else {
tbl.getParameters().remove("EXTERNAL");
}