nastra commented on code in PR #11624:
URL: https://github.com/apache/iceberg/pull/11624#discussion_r1853642520
##########
spark/v3.5/spark/src/test/java/org/apache/iceberg/spark/source/TestIcebergSourceTablesBase.java:
##########
@@ -2210,6 +2210,52 @@ private void testWithFilter(String filterExpr,
TableIdentifier tableIdentifier)
assertThat(actual).as("Rows must
match").containsExactlyInAnyOrderElementsOf(expected);
}
+ @Test
+ public void testSessionConfigSupport() {
+ PartitionSpec spec =
PartitionSpec.builderFor(SCHEMA).identity("id").build();
+ TableIdentifier tableIdentifier = TableIdentifier.of("db",
"session_config_table");
+ Table table = createTable(tableIdentifier, SCHEMA, spec);
+
+ List<SimpleRecord> initialRecords =
+ Lists.newArrayList(
+ new SimpleRecord(1, "a"), new SimpleRecord(2, "b"), new
SimpleRecord(3, "c"));
+
+ Dataset<Row> df = spark.createDataFrame(initialRecords,
SimpleRecord.class);
+
+ df.select("id", "data")
+ .write()
+ .format("iceberg")
+ .mode(SaveMode.Append)
+ .save(loadLocation(tableIdentifier));
+
+ long s1 = table.currentSnapshot().snapshotId();
+
+ withSQLConf(
+ // set write option through session configuration
+ ImmutableMap.of("spark.datasource.iceberg.snapshot-property.foo",
"bar"),
+ () -> {
+ df.select("id", "data")
+ .write()
+ .format("iceberg")
+ .mode(SaveMode.Append)
+ .save(loadLocation(tableIdentifier));
+ });
+
+ table.refresh();
+ assertThat(table.currentSnapshot().summary().get("foo")).isEqualTo("bar");
Review Comment:
```suggestion
assertThat(table.currentSnapshot().summary()).containsEntry("foo",
"bar");
```
--
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]