ngsg commented on code in PR #4336:
URL: https://github.com/apache/hive/pull/4336#discussion_r1198564312
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/CustomPartitionVertex.java:
##########
@@ -533,83 +536,87 @@ private FileSplit
getFileSplitFromEvent(InputDataInformationEvent event) throws
private Multimap<Integer, InputSplit> getBucketSplitMapForPath(String
inputName,
Map<String, Set<FileSplit>> pathFileSplitsMap) {
+ boolean isSMBJoin = numInputsAffectingRootInputSpecUpdate != 1;
+ boolean isMainWork = (mainWorkName.isEmpty()) ||
(inputName.compareTo(mainWorkName) == 0);
+ Preconditions.checkState(
+ (isMainWork || (isSMBJoin && inputToBucketMap != null &&
inputToBucketMap.containsKey(inputName))),
+ "CustomPartitionVertex.inputToBucketMap is not defined for " +
inputName);
+ int inputBucketSize = isMainWork ? numBuckets :
inputToBucketMap.get(inputName);
- Multimap<Integer, InputSplit> bucketToInitialSplitMap =
- ArrayListMultimap.create();
+ Multimap<Integer, InputSplit> bucketToSplitMap =
ArrayListMultimap.create();
boolean fallback = false;
- Map<Integer, Integer> bucketIds = new HashMap<>();
for (Map.Entry<String, Set<FileSplit>> entry :
pathFileSplitsMap.entrySet()) {
// Extract the buckedID from pathFilesMap, this is more accurate method,
// however. it may not work in certain cases where buckets are named
// after files used while loading data. In such case, fallback to old
// potential inaccurate method.
// The accepted file names are such as 000000_0, 000001_0_copy_1.
- String bucketIdStr =
- Utilities.getBucketFileNameFromPathSubString(entry.getKey());
+ String bucketIdStr =
Utilities.getBucketFileNameFromPathSubString(entry.getKey());
int bucketId = Utilities.getBucketIdFromFile(bucketIdStr);
if (bucketId == -1) {
fallback = true;
- LOG.info("Fallback to using older sort based logic to assign " +
- "buckets to splits.");
- bucketIds.clear();
+ LOG.info("Fallback to using older sort based logic to assign buckets
to splits.");
+ bucketToSplitMap.clear();
break;
}
- // Make sure the bucketId is at max the numBuckets
- bucketId = bucketId % numBuckets;
- bucketIds.put(bucketId, bucketId);
+
+ // Utilities.getBucketIdFromFile() returns negative value only if it
fails to retrieve bucketID.
+ Preconditions.checkState(bucketId >= 0);
+
+ if (bucketId >= inputBucketSize) {
+ int newBucketId = bucketId % inputBucketSize;
+ LOG.info("The bucketID" + bucketId + " for file " + entry.getKey() + "
is not acceptable. " +
Review Comment:
OK, I fixed it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]