diff --git ql/src/java/org/apache/hadoop/hive/ql/optimizer/metainfo/annotation/OpTraitsRulesProcFactory.java ql/src/java/org/apache/hadoop/hive/ql/optimizer/metainfo/annotation/OpTraitsRulesProcFactory.java index 7149f5c..0f8b920 100644 --- ql/src/java/org/apache/hadoop/hive/ql/optimizer/metainfo/annotation/OpTraitsRulesProcFactory.java +++ ql/src/java/org/apache/hadoop/hive/ql/optimizer/metainfo/annotation/OpTraitsRulesProcFactory.java @@ -143,17 +143,18 @@ public boolean checkBucketedTable(Table tbl, ParseContext pGraphContext, } } } else { - + int numBuckets = tbl.getNumBuckets(); + if (numBuckets > 0) { List 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; } } + } return true; }