You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/01/07 14:56:59 UTC

[GitHub] [iceberg] waterlx commented on a change in pull request #1508: Use schema at the time of the snapshot when reading a snapshot.

waterlx commented on a change in pull request #1508:
URL: https://github.com/apache/iceberg/pull/1508#discussion_r553378743



##########
File path: spark3/src/main/java/org/apache/iceberg/spark/source/IcebergSource.java
##########
@@ -60,10 +61,13 @@ public SparkTable getTable(StructType schema, Transform[] partitioning, Map<Stri
     // Get Iceberg table from options
     Configuration conf = SparkSession.active().sessionState().newHadoopConf();
     Table icebergTable = getTableAndResolveHadoopConfiguration(options, conf);
+    CaseInsensitiveStringMap cIOptions = new CaseInsensitiveStringMap(options);
+    Long snapshotId = Spark3Util.propertyAsLong(cIOptions, "snapshot-id", null);
+    Long asOfTimestamp = Spark3Util.propertyAsLong(cIOptions, "as-of-timestamp", null);
 
     // Build Spark table based on Iceberg table, and return it
     // Eagerly refresh the table before reading to ensure views containing this table show up-to-date data
-    return new SparkTable(icebergTable, schema, true);
+    return new SparkTable(icebergTable, schema, snapshotId, asOfTimestamp, true);

Review comment:
       @wypoon @rdblue I am trying to apply this patch to the most recently master branch, and find that the changes to this IcebergSource for Spark3 could not be applied due to #1783. "SparkTable" is "loadTable" by TableCatalog and in SparkCatalog, SparkTable is constructed by "new SparkTable(icebergTable, !cacheEnabled)" with snapshotId and asOfTimestamp set as null internally. It seems that options given by IcebergSource#getTable() could be not passed here. Could you please share your thoughts on that? Thanks!




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org