Repository navigation
feat(transaction): record the Iceberg-Rust writer version information in snapshot summaries #3363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a312562
bc2db59
0742543
a7dc0ce
78a92e8
ba05028
3105575
dc2086e
42578ee
5b9c042
0679bba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,7 @@ const TOTAL_RECORDS: &str = "total-records"; | |
| const TOTAL_FILE_SIZE: &str = "total-files-size"; | ||
| const CHANGED_PARTITION_COUNT_PROP: &str = "changed-partition-count"; | ||
| const CHANGED_PARTITION_PREFIX: &str = "partitions."; | ||
| const ICEBERG_VERSION_PROP: &str = "iceberg-version"; | ||
|
|
||
| /// `SnapshotSummaryCollector` collects and aggregates snapshot update metrics. | ||
| /// It gathers metrics about added or removed data files and manifests, and tracks | ||
|
|
@@ -330,6 +331,14 @@ where T: PartialOrd + Default + ToString { | |
| } | ||
| } | ||
|
|
||
| pub(crate) fn set_iceberg_version(properties: &mut HashMap<String, String>) { | ||
| let version = env!("CARGO_PKG_VERSION"); | ||
| properties.insert( | ||
| ICEBERG_VERSION_PROP.to_string(), | ||
| format!("Apache Iceberg Rust {version}"), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small parity thing: Java and Go seed this as |
||
| ); | ||
| } | ||
|
Comment on lines
+334
to
+340
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Optional since this is not in the hot path, but since |
||
|
|
||
| pub(crate) fn update_snapshot_summaries( | ||
| summary: Summary, | ||
| previous_summary: Option<&Summary>, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,12 +28,11 @@ use crate::spec::{ | |
| DataFile, DataFileFormat, FormatVersion, MAIN_BRANCH, ManifestContentType, ManifestEntry, | ||
| ManifestFile, ManifestListWriter, ManifestWriter, ManifestWriterBuilder, Operation, Snapshot, | ||
| SnapshotReference, SnapshotRetention, SnapshotSummaryCollector, Struct, StructType, Summary, | ||
| TableProperties, update_snapshot_summaries, | ||
| TableProperties, set_iceberg_version, update_snapshot_summaries, | ||
| }; | ||
| use crate::table::Table; | ||
| use crate::transaction::ActionCommit; | ||
| use crate::{Error, ErrorKind, TableRequirement, TableUpdate}; | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume the removal of this line was unintentional? I thin it will glue the doc comment to the import block. I think |
||
| /// A trait that defines how different table operations produce new snapshots. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like the blank line between the |
||
| /// | ||
| /// `SnapshotProduceOperation` is used by [`SnapshotProducer`] to customize snapshot creation | ||
|
|
@@ -411,11 +410,13 @@ impl<'a> SnapshotProducer<'a> { | |
| additional_properties, | ||
| }; | ||
|
|
||
| update_snapshot_summaries( | ||
| let mut summary = update_snapshot_summaries( | ||
| summary, | ||
| previous_snapshot.map(|s| s.summary()), | ||
| snapshot_produce_operation.operation() == Operation::Overwrite, | ||
| ) | ||
| )?; | ||
| set_iceberg_version(&mut summary.additional_properties); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mbutrovich Moved this into snapshot_summary so we don't have to have public constants |
||
| Ok(summary) | ||
| } | ||
|
|
||
| fn generate_manifest_list_file_path(&self, attempt: i64) -> Result<String> { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This always overwrites a caller-supplied
iceberg-version, which is the right precedence — Java and Go both apply environment context after user snapshot properties, so the library value wins. Worth a one-line///here saying it always overwrites, since silently dropping a caller's value is otherwise a little surprising.