Author: hashutosh
Date: Wed Sep 17 23:21:34 2014
New Revision: 1625851
URL: http://svn.apache.org/r1625851
Log:
HIVE-8161 : [CBO] Partition pruner doesnt handle unpartitioned table in
non-strict mode correctly (Ashutosh Chauhan via John Pullokkkaran)
Modified:
hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ppr/PartitionPruner.java
Modified:
hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ppr/PartitionPruner.java
URL:
http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ppr/PartitionPruner.java?rev=1625851&r1=1625850&r2=1625851&view=diff
==============================================================================
---
hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ppr/PartitionPruner.java
(original)
+++
hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ppr/PartitionPruner.java
Wed Sep 17 23:21:34 2014
@@ -165,6 +165,13 @@ public class PartitionPruner implements
LOG.trace("tabname = " + tab.getTableName());
LOG.trace("prune Expression = " + prunerExpr == null ? "" : prunerExpr);
+ String key = tab.getDbName() + "." + tab.getTableName() + ";";
+
+ if (!tab.isPartitioned()) {
+ // If the table is not partitioned, return empty list.
+ return getAllPartsFromCacheOrServer(tab, key, false,
prunedPartitionsMap);
+ }
+
if ("strict".equalsIgnoreCase(HiveConf.getVar(conf,
HiveConf.ConfVars.HIVEMAPREDMODE))
&& !hasColumnExpr(prunerExpr)) {
// If the "strict" mode is on, we have to provide partition pruner for
each table.
@@ -172,11 +179,8 @@ public class PartitionPruner implements
.getMsg("for Alias \"" + alias + "\" Table \"" + tab.getTableName()
+ "\""));
}
- String key = tab.getDbName() + "." + tab.getTableName() + ";";
-
- if (!tab.isPartitioned() || prunerExpr == null) {
- // If the table is not partitioned, return everything.
- // Or, Non-strict mode, and there is no predicates at all - get
everything.
+ if (prunerExpr == null) {
+ // In non-strict mode and there is no predicates at all - get everything.
return getAllPartsFromCacheOrServer(tab, key, false,
prunedPartitionsMap);
}