xiangfu0 commented on code in PR #19947:
URL: https://github.com/apache/pinot/pull/19947#discussion_r4343863183
##########
pinot-plugins/pinot-batch-ingestion/pinot-batch-ingestion-hadoop/src/main/java/org/apache/pinot/plugin/ingestion/batch/hadoop/HadoopSegmentTarPushJobRunner.java:
##########
@@ -80,17 +79,12 @@ public void run() {
throw new RuntimeException("Unable to list all files under outputDirURI
- '" + outputDirURI + "'");
}
- List<String> segmentsToPush = new ArrayList<>();
- for (String file : files) {
- if (file.endsWith(Constants.TAR_GZ_FILE_EXT)) {
- segmentsToPush.add(file);
- }
+ List<String> segmentsToPush = new ArrayList<>(
+ SegmentPushUtils.getSegmentUriToTarPathMap(outputDirURI,
_spec.getPushJobSpec(), files).values());
Review Comment:
MINOR / back-compat: routing the Hadoop runners through
`getSegmentUriToTarPathMap` now makes them honor `pushFileNamePattern` (and
skip `.metadata.tar.gz`), whereas the old inline loop pushed every `.tar.gz`
regardless of the pattern. That's a reasonable consistency fix with the Spark
runners, but it's a behavior change beyond the duplicate-rejection one in the
PR description. Worth a line in the back-compat note so Hadoop users who set a
pattern aren't surprised by a changed segment set.
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/SegmentPushUtils.java:
##########
@@ -684,17 +702,20 @@ public static Map<String, String>
getSegmentUriToTarPathMap(URI outputDirURI, Pu
}
}
- URI uri = URI.create(file);
+ URI uri = outputDirURI != null &&
"file".equals(outputDirURI.getScheme()) && new File(file).isAbsolute()
+ ? new File(file).toURI() : URI.create(file);
if (uri.getPath().endsWith(Constants.METADATA_TAR_GZ_FILE_EXT)) {
// Skip segment metadata tar gz files
continue;
}
if (uri.getPath().endsWith(Constants.TAR_GZ_FILE_EXT)) {
+ segmentPaths.add(file);
URI updatedURI = SegmentPushUtils.generateSegmentTarURI(outputDirURI,
uri, pushSpec.getSegmentUriPrefix(),
pushSpec.getSegmentUriSuffix());
segmentUriToTarPathMap.put(updatedURI.toString(), file);
}
}
+ validateUniqueSegmentNames(segmentPaths);
Review Comment:
MINOR: `validateUniqueSegmentNames` -> `getSegmentName` also runs
`validatePartialOrFullSegmentName` on every selected file, so
`getSegmentUriToTarPathMap` now rejects a `.tar.gz` whose name contains one of
the illegal chars (`\ / : * ? " < > |`) where it previously went through.
Almost certainly fine (such names are already problematic), just flagging the
newly-enforced constraint on this path.
--
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]