You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by sp...@apache.org on 2016/05/26 15:40:42 UTC

[20/66] [abbrv] hive git commit: HIVE-13799 : Optimize TableScanRule::checkBucketedTable (Rajesh Balamohan via Gopal V)

HIVE-13799 :  Optimize TableScanRule::checkBucketedTable (Rajesh Balamohan via Gopal V)

Signed-off-by: Ashutosh Chauhan <ha...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/8a679589
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/8a679589
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/8a679589

Branch: refs/heads/java8
Commit: 8a6795895f9c8cdeb729089873404d30f2b7e4b2
Parents: c229f99
Author: Rajesh Balamohan <rbalamohan at apache dot org>
Authored: Thu May 19 19:32:00 2016 -0800
Committer: Ashutosh Chauhan <ha...@apache.org>
Committed: Tue May 24 08:45:52 2016 -0700

----------------------------------------------------------------------
 .../metainfo/annotation/OpTraitsRulesProcFactory.java  | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/8a679589/ql/src/java/org/apache/hadoop/hive/ql/optimizer/metainfo/annotation/OpTraitsRulesProcFactory.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/metainfo/annotation/OpTraitsRulesProcFactory.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/metainfo/annotation/OpTraitsRulesProcFactory.java
index 7149f5c..1e89016 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/metainfo/annotation/OpTraitsRulesProcFactory.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/metainfo/annotation/OpTraitsRulesProcFactory.java
@@ -125,6 +125,11 @@ public class OpTraitsRulesProcFactory {
     public boolean checkBucketedTable(Table tbl, ParseContext pGraphContext,
         PrunedPartitionList prunedParts) throws SemanticException {
 
+      final int numBuckets = tbl.getNumBuckets();
+      if (numBuckets <= 0) {
+        return false;
+      }
+
       if (tbl.isPartitioned()) {
         List<Partition> partitions = prunedParts.getNotDeniedPartns();
         // construct a mapping of (Partition->bucket file names) and (Partition -> bucket number)
@@ -135,9 +140,7 @@ public class OpTraitsRulesProcFactory {
                     pGraphContext);
             // The number of files for the table should be same as number of
             // buckets.
-            int bucketCount = p.getBucketCount();
-
-            if (fileNames.size() != 0 && fileNames.size() != bucketCount) {
+            if (fileNames.size() != 0 && fileNames.size() != numBuckets) {
               return false;
             }
           }
@@ -147,10 +150,8 @@ public class OpTraitsRulesProcFactory {
         List<String> fileNames =
             AbstractBucketJoinProc.getBucketFilePathsOfPartition(tbl.getDataLocation(),
                 pGraphContext);
-        Integer num = new Integer(tbl.getNumBuckets());
-
         // The number of files for the table should be same as number of buckets.
-        if (fileNames.size() != 0 && fileNames.size() != num) {
+        if (fileNames.size() != 0 && fileNames.size() != numBuckets) {
           return false;
         }
       }