anoopj commented on code in PR #18699:
URL: https://github.com/apache/iceberg/pull/18699#discussion_r4428389076
##########
core/src/main/java/org/apache/iceberg/MergingSnapshotProducer.java:
##########
@@ -362,22 +333,12 @@ private ManifestFile copyManifest(ManifestFile manifest) {
*/
protected void validateAddedDataFiles(
TableMetadata base, Long startingSnapshotId, PartitionSet partitionSet,
Snapshot parent) {
- CloseableIterable<ManifestEntry<DataFile>> conflictEntries =
- addedDataFiles(base, startingSnapshotId, null, partitionSet, parent);
-
- try (CloseableIterator<ManifestEntry<DataFile>> conflicts =
conflictEntries.iterator()) {
- if (conflicts.hasNext()) {
- throw new ValidationException(
- "Found conflicting files that can contain records matching
partitions %s: %s",
- partitionSet,
- Iterators.toString(
- Iterators.transform(conflicts, entry ->
entry.file().location().toString())));
- }
-
- } catch (IOException e) {
- throw new UncheckedIOException(
- String.format("Failed to validate no appends matching %s",
partitionSet), e);
- }
+ SnapshotValidator.newValidator()
+ .io(ops().io())
+ .startingSnapshotId(startingSnapshotId)
+ .caseSensitive(caseSensitive)
+ .forWindow(base, parent)
+ .validateAddedDataFiles(partitionSet);
Review Comment:
Yes, they are alternatives, so allowing both can be a footgun. I am planning
to remove the use of the `PartitionSet` though because we can derive it from
the files. The only consumer of this API is `ReplacePartition`, so this is
doable.
For this PR, I can make a change such that these are mutually exclusive.
Please let me know.
--
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]