rdblue commented on code in PR #16936:
URL: https://github.com/apache/iceberg/pull/16936#discussion_r4200309809
##########
core/src/test/java/org/apache/iceberg/TestTrackedFileAdapters.java:
##########
@@ -671,6 +729,399 @@ void unknownSpecIdThrows() {
.hasMessageContaining("Cannot find partition spec for spec ID");
}
+ @Test
+ void dataTrackedFileAdapterHasNoTracking() {
+ TrackedFile result =
TrackedFileAdapters.forDataFile(TABLE_SCHEMA).wrap(DATA_FILE);
+
+ assertThat(result.tracking()).isNull();
+ assertWrappedDataFileMatchesFileFields(result, DATA_FILE);
+ assertThatThrownBy(result::formatVersion)
+ .isInstanceOf(IllegalStateException.class)
+ .hasMessage("Format version is assigned at write time");
+ }
+
+ @Test
+ void dataTrackedFileAdapterFromAddedManifestEntry() {
+ TrackedFile result =
TrackedFileAdapters.forDataFile(TABLE_SCHEMA).wrap(addedEntry(DATA_FILE));
+
+ assertThat(result.tracking().status()).isEqualTo(EntryStatus.ADDED);
+ assertThat(result.tracking().snapshotId()).isEqualTo(SNAPSHOT_ID);
+ assertThat(result.tracking().dataSequenceNumber()).isNull();
Review Comment:
Why are the sequence numbers null? Are they not mapped properly or are they
set to null in `Tracking`? If it is that they are null in tracking, I think
this should pass real values because they should be non-null when converting
from a manifest entry.
##########
core/src/test/java/org/apache/iceberg/TestTrackedFileAdapters.java:
##########
@@ -671,6 +729,399 @@ void unknownSpecIdThrows() {
.hasMessageContaining("Cannot find partition spec for spec ID");
}
+ @Test
+ void dataTrackedFileAdapterHasNoTracking() {
+ TrackedFile result =
TrackedFileAdapters.forDataFile(TABLE_SCHEMA).wrap(DATA_FILE);
+
+ assertThat(result.tracking()).isNull();
+ assertWrappedDataFileMatchesFileFields(result, DATA_FILE);
+ assertThatThrownBy(result::formatVersion)
+ .isInstanceOf(IllegalStateException.class)
+ .hasMessage("Format version is assigned at write time");
+ }
+
+ @Test
+ void dataTrackedFileAdapterFromAddedManifestEntry() {
+ TrackedFile result =
TrackedFileAdapters.forDataFile(TABLE_SCHEMA).wrap(addedEntry(DATA_FILE));
+
+ assertThat(result.tracking().status()).isEqualTo(EntryStatus.ADDED);
+ assertThat(result.tracking().snapshotId()).isEqualTo(SNAPSHOT_ID);
+ assertThat(result.tracking().dataSequenceNumber()).isNull();
+ assertThat(result.tracking().fileSequenceNumber()).isNull();
+ assertThat(result.tracking().firstRowId()).isNull();
Review Comment:
Should be tested
--
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]