timothyw553 commented on code in PR #19019:
URL: https://github.com/apache/iceberg/pull/19019#discussion_r4727242220


##########
core/src/main/java/org/apache/iceberg/MetadataColumns.java:
##########
@@ -114,7 +120,8 @@ private MetadataColumns() {}
           IS_DELETED.name(), IS_DELETED,
           SPEC_ID.name(), SPEC_ID,
           ROW_ID.name(), ROW_ID,
-          LAST_UPDATED_SEQUENCE_NUMBER.name(), LAST_UPDATED_SEQUENCE_NUMBER);
+          LAST_UPDATED_SEQUENCE_NUMBER.name(), LAST_UPDATED_SEQUENCE_NUMBER,
+          LAST_UPDATED_TIMESTAMP.name(), LAST_UPDATED_TIMESTAMP);

Review Comment:
   adding this to `META_COLUMNS` reserves `_last_updated_timestamp` before 
readers expose it, so existing tables with a user column of that name break on 
`SELECT *` or selecting it in Spark. should we defer the `META_COLUMNS` entry 
until readers support it and add a Spark regression test for that case?
   
   ```diff
   -          LAST_UPDATED_SEQUENCE_NUMBER.name(), LAST_UPDATED_SEQUENCE_NUMBER,
   -          LAST_UPDATED_TIMESTAMP.name(), LAST_UPDATED_TIMESTAMP);
   +          LAST_UPDATED_SEQUENCE_NUMBER.name(), 
LAST_UPDATED_SEQUENCE_NUMBER);
   ```



##########
core/src/main/java/org/apache/iceberg/TrackingStruct.java:
##########
@@ -39,6 +39,7 @@ class TrackingStruct extends SupportsIndexProjection 
implements Tracking, Serial
           Tracking.FIRST_ROW_ID,
           Tracking.DELETED_POSITIONS,
           Tracking.REPLACED_POSITIONS,
+          Tracking.SNAPSHOT_TIMESTAMP,

Review Comment:
   we add `Tracking.SNAPSHOT_TIMESTAMP` to `BASE_TYPE` here, but omit it from 
`SCAN_TYPE` below so scan-planning reads drop timestamps already stored in 
manifests and return `null`. should we add it to `SCAN_TYPE` now and test that 
full and scan-planning reads match for both avro and parquet?
   
   ```diff
              Tracking.FILE_SEQUENCE_NUMBER,
              Tracking.FIRST_ROW_ID,
   +          Tracking.SNAPSHOT_TIMESTAMP,
              MetadataColumns.FILE_PATH,
   ```



##########
core/src/main/java/org/apache/iceberg/TrackingBuilder.java:
##########
@@ -116,6 +118,7 @@ private TrackingBuilder(Tracking source, long 
newSnapshotId) {
     this.modifiedSnapshotId = source.modifiedSnapshotId();
     this.deletedPositions = null;
     this.replacedPositions = null;
+    this.snapshotTimestampMicros = source.snapshotTimestampMicros();

Review Comment:
   direct builder tests check that `columnFilesUpdated()` resets 
`snapshotTimestampMicros`, but don't verify that `dvUpdated()`, 
`deletedPositions()`, and `replacedPositions()` preserve it. could we assert 
`modified.snapshotTimestampMicros()` equals 
`SOURCE_TRACKING_EXISTING.snapshotTimestampMicros()` in those transition tests?



##########
api/src/main/java/org/apache/iceberg/ContentFile.java:
##########
@@ -183,6 +183,19 @@ default Long fileSequenceNumber() {
     return null;
   }
 
+  /**
+   * Returns the microsecond timestamp of the snapshot that added or changed 
this file.

Review Comment:
   `changed this file` reads like any update changes the timestamp, while DV 
and deleted/replaced position updates preserve it and only column file updates 
reset it. nit: should we clarify the javadoc?
   
   ```diff
   -   * Returns the microsecond timestamp of the snapshot that added or 
changed this file.
   +   * Returns the microsecond timestamp of the snapshot that added or last 
modified the file's data.
   +   *
   +   * <p>Updates to deletion vectors preserve this timestamp.
   ```



##########
core/src/main/java/org/apache/iceberg/RootManifestFile.java:
##########
@@ -42,6 +43,7 @@ static RootManifestFile from(Snapshot snapshot, String 
tableLocation, FileIO io)
         io.newInputFile(location).getLength(),
         snapshot.snapshotId(),
         snapshot.sequenceNumber(),
+        TimeUnit.MILLISECONDS.toMicros(snapshot.timestampMillis()),

Review Comment:
   none of the tests verify this millis-to-micros conversion, so returning raw 
millis or `0` would still pass. could we mock `snapshot.timestampMillis()` in 
`TestRootManifestFile#fromResolvesRelativeRootLocation` and assert 
`root.snapshotTimestampMicros()` equals `SNAPSHOT_TIMESTAMP_MICROS`?



-- 
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]

Reply via email to