Abacn commented on code in PR #37265:
URL: https://github.com/apache/beam/pull/37265#discussion_r3138630075
##########
sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileBasedSource.java:
##########
@@ -318,35 +317,10 @@ public final List<? extends FileBasedSource<T>> split(
}
}
- /**
- * Report source Lineage. Due to the size limit of Beam metrics, report full
file name or only dir
- * depend on the number of files.
- *
- * <p>- Number of files<=100, report full file paths;
- *
- * <p>- Number of directory<=100, report directory names (one level up);
- *
- * <p>- Otherwise, report top level only.
- */
private static void reportSourceLineage(List<Metadata> expandedFiles) {
- if (expandedFiles.size() <= 100) {
- for (Metadata metadata : expandedFiles) {
- FileSystems.reportSourceLineage(metadata.resourceId());
- }
- } else {
- HashSet<ResourceId> uniqueDirs = new HashSet<>();
- for (Metadata metadata : expandedFiles) {
- ResourceId dir = metadata.resourceId().getCurrentDirectory();
- uniqueDirs.add(dir);
- if (uniqueDirs.size() > 100) {
- FileSystems.reportSourceLineage(dir, LineageLevel.TOP_LEVEL);
- return;
- }
- }
- for (ResourceId uniqueDir : uniqueDirs) {
- FileSystems.reportSourceLineage(uniqueDir);
- }
- }
+ List<ResourceId> resourceIds =
Review Comment:
A generic guide is specific component change ( HadoopIO/HadoopFormat) should
have minimum touch on core (FileSystems) code.
It sounds weird because in current approach HadoopFormat lineage report uses
internal method belongs to FileBasedSource. Moving it to FileSystems public API
further diverge the encapsulations.
Another approach is to implement HadoopFormat's reportLineage with existing
FileSystems.reportSourceLineage or it's own methods
--
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]