flyrain commented on code in PR #7743:
URL: https://github.com/apache/iceberg/pull/7743#discussion_r1223688581


##########
docs/spark-configuration.md:
##########
@@ -194,3 +194,17 @@ df.write
 | check-ordering       | true        | Checks if input schema and table schema 
are same  |
 | isolation-level | null | Desired isolation level for Dataframe overwrite 
operations.  `null` => no checks (for idempotent writes), `serializable` => 
check for concurrent inserts or deletes in destination partitions, `snapshot` 
=> checks for concurrent deletes in destination partitions. |
 | validate-from-snapshot-id | null | If isolation level is set, id of base 
snapshot from which to check concurrent write conflicts into a table. Should be 
the snapshot before any reads from the table. Can be obtained via [Table 
API](../../api#table-metadata) or [Snapshots 
table](../spark-queries#snapshots). If null, the table's oldest known snapshot 
is used. |
+
+specifically, if you run SQL statements, you could use 
`org.apache.iceberg.spark.CommitMetadata` to add entries with custom-keys and 
corresponding values in the snapshot summary

Review Comment:
   Minor suggestion:
   `CommitMetadata` provides an interface to add custom metadata to a snapshot 
summary during a SQL execution, which can be beneficial for purposes such as 
auditing or change tracking. Here is an example:



##########
docs/spark-configuration.md:
##########
@@ -194,3 +194,17 @@ df.write
 | check-ordering       | true        | Checks if input schema and table schema 
are same  |
 | isolation-level | null | Desired isolation level for Dataframe overwrite 
operations.  `null` => no checks (for idempotent writes), `serializable` => 
check for concurrent inserts or deletes in destination partitions, `snapshot` 
=> checks for concurrent deletes in destination partitions. |
 | validate-from-snapshot-id | null | If isolation level is set, id of base 
snapshot from which to check concurrent write conflicts into a table. Should be 
the snapshot before any reads from the table. Can be obtained via [Table 
API](../../api#table-metadata) or [Snapshots 
table](../spark-queries#snapshots). If null, the table's oldest known snapshot 
is used. |
+
+specifically, if you run SQL statements, you could use 
`org.apache.iceberg.spark.CommitMetadata` to add entries with custom-keys and 
corresponding values in the snapshot summary
+
+```java
+import org.apache.iceberg.spark.CommitMetadata;
+Map<String, String> properties = Maps.newHashMap();
+properties.put("property_key", "property_value");
+CommitMetadata.withCommitProperties(properties,
+        () -> {
+        spark.sql("DELETE FROM " + tableName + " where id = 1");
+        return 0;

Review Comment:
   Indentation?



##########
docs/spark-configuration.md:
##########
@@ -194,3 +194,17 @@ df.write
 | check-ordering       | true        | Checks if input schema and table schema 
are same  |
 | isolation-level | null | Desired isolation level for Dataframe overwrite 
operations.  `null` => no checks (for idempotent writes), `serializable` => 
check for concurrent inserts or deletes in destination partitions, `snapshot` 
=> checks for concurrent deletes in destination partitions. |
 | validate-from-snapshot-id | null | If isolation level is set, id of base 
snapshot from which to check concurrent write conflicts into a table. Should be 
the snapshot before any reads from the table. Can be obtained via [Table 
API](../../api#table-metadata) or [Snapshots 
table](../spark-queries#snapshots). If null, the table's oldest known snapshot 
is used. |
+
+specifically, if you run SQL statements, you could use 
`org.apache.iceberg.spark.CommitMetadata` to add entries with custom-keys and 
corresponding values in the snapshot summary
+
+```java
+import org.apache.iceberg.spark.CommitMetadata;

Review Comment:
   Style suggestion: add an empty line



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