From da189b60ed81492e8fea95a0be5061599ff69507 Mon Sep 17 00:00:00 2001 From: Xander Date: Fri, 12 Jun 2026 16:19:08 +0100 Subject: [PATCH 1/3] fix writer --- crates/iceberg/public-api.txt | 2 +- crates/iceberg/src/spec/manifest/writer.rs | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/crates/iceberg/public-api.txt b/crates/iceberg/public-api.txt index eb2d4f932b..19b5592590 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, key_metadata: core::option::Option>, 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, key_metadata: core::option::Option>, 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, schema: iceberg::spec::SchemaRef, partition_spec: iceberg::spec::PartitionSpec) -> iceberg::Result 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> diff --git a/crates/iceberg/src/spec/manifest/writer.rs b/crates/iceberg/src/spec/manifest/writer.rs index 88da1a396c..2cfb050a1f 100644 --- a/crates/iceberg/src/spec/manifest/writer.rs +++ b/crates/iceberg/src/spec/manifest/writer.rs @@ -20,6 +20,7 @@ use std::future::Future; use std::pin::Pin; use apache_avro::{Writer as AvroWriter, to_value}; +use base64::encode; use bytes::Bytes; use itertools::Itertools; use serde_json::to_vec; @@ -28,7 +29,7 @@ use super::{ Datum, FormatVersion, ManifestContentType, PartitionSpec, PrimitiveType, UNASSIGNED_SEQUENCE_NUMBER, }; -use crate::encryption::EncryptedOutputFile; +use crate::encryption::{EncryptedOutputFile, StandardKeyMetadata}; use crate::error::Result; use crate::io::{FileWrite, OutputFile}; use crate::spec::manifest::_serde::{ManifestEntryV1, ManifestEntryV2}; @@ -81,19 +82,20 @@ impl ManifestWriterBuilder { pub fn new_from_encrypted( encrypted_output: EncryptedOutputFile, snapshot_id: Option, - key_metadata: Option>, schema: SchemaRef, partition_spec: PartitionSpec, - ) -> Self { + ) -> Result { 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. @@ -124,6 +126,7 @@ impl ManifestWriterBuilder { .format_version(FormatVersion::V2) .content(ManifestContentType::Data) .build(); + ManifestWriter::new( self.writer_future, self.location, From 053dcc8a0268e739be456599f59cbcf3e27d8846 Mon Sep 17 00:00:00 2001 From: Xander Date: Sun, 14 Jun 2026 21:53:28 +0000 Subject: [PATCH 2/3] Run cargo fmt --- crates/iceberg/src/spec/manifest/writer.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/iceberg/src/spec/manifest/writer.rs b/crates/iceberg/src/spec/manifest/writer.rs index 2cfb050a1f..09d4f04491 100644 --- a/crates/iceberg/src/spec/manifest/writer.rs +++ b/crates/iceberg/src/spec/manifest/writer.rs @@ -86,8 +86,7 @@ impl ManifestWriterBuilder { partition_spec: PartitionSpec, ) -> Result { let location = encrypted_output.location().to_owned(); - let key_metadata = Some(encrypted_output.key_metadata().encode()? - .to_vec()); + let key_metadata = Some(encrypted_output.key_metadata().encode()?.to_vec()); Ok(Self { writer_future: Box::pin(async move { encrypted_output.writer().await }), location, From 1e6882d5455e8720c38c373c477ea4bfc99e7017 Mon Sep 17 00:00:00 2001 From: Xander Date: Sun, 14 Jun 2026 22:11:30 +0000 Subject: [PATCH 3/3] fix clippy warnings in manifest writer --- crates/iceberg/src/spec/manifest/writer.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/iceberg/src/spec/manifest/writer.rs b/crates/iceberg/src/spec/manifest/writer.rs index 09d4f04491..ae6d6e0680 100644 --- a/crates/iceberg/src/spec/manifest/writer.rs +++ b/crates/iceberg/src/spec/manifest/writer.rs @@ -20,7 +20,6 @@ use std::future::Future; use std::pin::Pin; use apache_avro::{Writer as AvroWriter, to_value}; -use base64::encode; use bytes::Bytes; use itertools::Itertools; use serde_json::to_vec; @@ -29,7 +28,7 @@ use super::{ Datum, FormatVersion, ManifestContentType, PartitionSpec, PrimitiveType, UNASSIGNED_SEQUENCE_NUMBER, }; -use crate::encryption::{EncryptedOutputFile, StandardKeyMetadata}; +use crate::encryption::EncryptedOutputFile; use crate::error::Result; use crate::io::{FileWrite, OutputFile}; use crate::spec::manifest::_serde::{ManifestEntryV1, ManifestEntryV2};