You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by li...@apache.org on 2026/07/01 10:01:30 UTC
(iceberg-rust) branch main updated: refactor(encryption) use `StandardKeyMetadata` from `EncryptedOutputFile` in `ManifestWriterBuilder` (#2628)
This is an automated email from the ASF dual-hosted git repository.
blackmwk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-rust.git
The following commit(s) were added to refs/heads/main by this push:
new 713e20162 refactor(encryption) use `StandardKeyMetadata` from `EncryptedOutputFile` in `ManifestWriterBuilder` (#2628)
713e20162 is described below
commit 713e2016230c46624f0debba23363430fc3715c4
Author: Xander <za...@googlemail.com>
AuthorDate: Wed Jul 1 15:31:24 2026 +0530
refactor(encryption) use `StandardKeyMetadata` from `EncryptedOutputFile` in `ManifestWriterBuilder` (#2628)
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes #123` indicates that this PR will close issue #123.
-->
In https://github.com/apache/iceberg-rust/pull/2568 we introduced
`new_from_encrypted` but the api isn't very ergonomic because
`EncryptedOutputFile` has `StandardKeyMetadata` on it already so we
don't need to pass in `key_metadata` also.
working towards #2034
## What changes are included in this PR?
<!--
Provide a summary of the modifications in this PR. List the main changes
such as new features, bug fixes, refactoring, or any other updates.
-->
## Are these changes tested?
<!--
Specify what test covers (unit test, integration test, etc.).
If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->
---
crates/iceberg/public-api.txt | 2 +-
crates/iceberg/src/spec/manifest/writer.rs | 9 +++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/crates/iceberg/public-api.txt b/crates/iceberg/public-api.txt
index efab1d780..41d4d7691 100644
--- a/crates/iceberg/public-api.txt
+++ b/crates/iceberg/public-api.txt
@@ -2079,7 +2079,7 @@ pub fn iceberg::spec::ManifestWriterBuilder::build_v2_deletes(self) -> iceberg::
pub fn iceberg::spec::ManifestWriterBuilder::build_v3_data(self) -> iceberg::spec::ManifestWriter
pub fn iceberg::spec::ManifestWriterBuilder::build_v3_deletes(self) -> iceberg::spec::ManifestWriter
pub fn iceberg::spec::ManifestWriterBuilder::new(output: iceberg::io::OutputFile, snapshot_id: core::option::Option<i64>, schema: iceberg::spec::SchemaRef, partition_spec: iceberg::spec::PartitionSpec) -> Self
-pub fn iceberg::spec::ManifestWriterBuilder::new_from_encrypted(encrypted_output: iceberg::encryption::EncryptedOutputFile, snapshot_id: core::option::Option<i64>, key_metadata: core::option::Option<alloc::vec::Vec<u8>>, schema: iceberg::spec::SchemaRef, partition_spec: iceberg::spec::PartitionSpec) -> Self
+pub fn iceberg::spec::ManifestWriterBuilder::new_from_encrypted(encrypted_output: iceberg::encryption::EncryptedOutputFile, snapshot_id: core::option::Option<i64>, schema: iceberg::spec::SchemaRef, partition_spec: iceberg::spec::PartitionSpec) -> iceberg::Result<Self>
pub struct iceberg::spec::Map
impl iceberg::spec::Map
pub fn iceberg::spec::Map::get(&self, key: &iceberg::spec::Literal) -> core::option::Option<&core::option::Option<iceberg::spec::Literal>>
diff --git a/crates/iceberg/src/spec/manifest/writer.rs b/crates/iceberg/src/spec/manifest/writer.rs
index 9fa2cc1c7..661c90dc2 100644
--- a/crates/iceberg/src/spec/manifest/writer.rs
+++ b/crates/iceberg/src/spec/manifest/writer.rs
@@ -80,19 +80,19 @@ impl ManifestWriterBuilder {
pub fn new_from_encrypted(
encrypted_output: EncryptedOutputFile,
snapshot_id: Option<i64>,
- key_metadata: Option<Vec<u8>>,
schema: SchemaRef,
partition_spec: PartitionSpec,
- ) -> Self {
+ ) -> Result<Self> {
let location = encrypted_output.location().to_owned();
- Self {
+ let key_metadata = Some(encrypted_output.key_metadata().encode()?.to_vec());
+ Ok(Self {
writer_future: Box::pin(async move { encrypted_output.writer().await }),
location,
snapshot_id,
key_metadata,
schema,
partition_spec,
- }
+ })
}
/// Build a [`ManifestWriter`] for format version 1.
@@ -123,6 +123,7 @@ impl ManifestWriterBuilder {
.format_version(FormatVersion::V2)
.content(ManifestContentType::Data)
.build();
+
ManifestWriter::new(
self.writer_future,
self.location,