You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "szehon-ho (via GitHub)" <gi...@apache.org> on 2023/03/01 18:47:05 UTC
[GitHub] [iceberg] szehon-ho commented on issue #6978: Reading as of Snapshot ID fails on Metadata Tables after Schema Evolution
szehon-ho commented on issue #6978:
URL: https://github.com/apache/iceberg/issues/6978#issuecomment-1450682749
Interesting, this sounds like a serious bug.
But I tried to reproduce this in latest master, but following test passed for me (add to TestMetadataTables):
```
@Test
public void testFilesVersionAsOf() throws Exception {
// Create table and insert data
sql(
"CREATE TABLE %s (id bigint, data string) "
+ "USING iceberg "
+ "PARTITIONED BY (data) "
+ "TBLPROPERTIES"
+ "('format-version'='2', 'write.delete.mode'='merge-on-read')",
tableName);
List<SimpleRecord> recordsA =
Lists.newArrayList(new SimpleRecord(1, "a"), new SimpleRecord(2, "a"));
spark
.createDataset(recordsA, Encoders.bean(SimpleRecord.class))
.coalesce(1)
.writeTo(tableName)
.append();
Table table = Spark3Util.loadIcebergTable(spark, tableName);
Long currentSnapshotId = table.currentSnapshot().snapshotId();
List<SimpleRecord> recordsB =
Lists.newArrayList(new SimpleRecord(1, "b"), new SimpleRecord(2, "b"));
spark
.createDataset(recordsB, Encoders.bean(SimpleRecord.class))
.coalesce(1)
.writeTo(tableName)
.append();
List<Object[]> res1 = sql("SELECT * from %s.files VERSION AS OF %s", tableName, currentSnapshotId);
Dataset<Row> iceberg = spark.read().format("iceberg").option("snapshot-id", currentSnapshotId).load(tableName + ".files");
List<Row> res2 = iceberg.collectAsList();
}
```
Not sure what I'm missing here
--
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: issues-unsubscribe@iceberg.apache.org
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