From 4d647628f6831922142c5586b59a33142c49dc8e Mon Sep 17 00:00:00 2001 From: fqaiser94 Date: Wed, 22 Jan 2025 20:52:30 -0500 Subject: [PATCH] &BlobMetadata and update comment --- crates/iceberg/src/puffin/blob.rs | 2 +- crates/iceberg/src/puffin/reader.rs | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/iceberg/src/puffin/blob.rs b/crates/iceberg/src/puffin/blob.rs index 2b1a0f697..a08fd9417 100644 --- a/crates/iceberg/src/puffin/blob.rs +++ b/crates/iceberg/src/puffin/blob.rs @@ -31,7 +31,7 @@ pub(crate) struct Blob { pub(crate) snapshot_id: i64, /// Sequence number of the Iceberg table's snapshot the blob was computed from pub(crate) sequence_number: i64, - /// The actual blob data + /// The uncompressed blob data pub(crate) data: Vec, /// Arbitrary meta-information about the blob pub(crate) properties: HashMap, diff --git a/crates/iceberg/src/puffin/reader.rs b/crates/iceberg/src/puffin/reader.rs index 072ffdb85..1ab1b4dd5 100644 --- a/crates/iceberg/src/puffin/reader.rs +++ b/crates/iceberg/src/puffin/reader.rs @@ -46,7 +46,7 @@ impl PuffinReader { } /// Returns blob - pub(crate) async fn blob(&self, blob_metadata: BlobMetadata) -> Result { + pub(crate) async fn blob(&self, blob_metadata: &BlobMetadata) -> Result { let file_read = self.input_file.reader().await?; let start = blob_metadata.offset; let end = start + blob_metadata.length; @@ -54,12 +54,12 @@ impl PuffinReader { let data = blob_metadata.compression_codec.decompress(bytes)?; Ok(Blob { - r#type: blob_metadata.r#type, - fields: blob_metadata.fields, + r#type: blob_metadata.r#type.clone(), + fields: blob_metadata.fields.clone(), snapshot_id: blob_metadata.snapshot_id, sequence_number: blob_metadata.sequence_number, data, - properties: blob_metadata.properties, + properties: blob_metadata.properties.clone(), }) } } @@ -84,7 +84,7 @@ mod tests { assert_eq!( puffin_reader - .blob(file_metadata.blobs.first().unwrap().clone()) + .blob(file_metadata.blobs.first().unwrap()) .await .unwrap(), blob_0() @@ -92,7 +92,7 @@ mod tests { assert_eq!( puffin_reader - .blob(file_metadata.blobs.get(1).unwrap().clone()) + .blob(file_metadata.blobs.get(1).unwrap()) .await .unwrap(), blob_1(), @@ -109,7 +109,7 @@ mod tests { assert_eq!( puffin_reader - .blob(file_metadata.blobs.first().unwrap().clone()) + .blob(file_metadata.blobs.first().unwrap()) .await .unwrap(), blob_0() @@ -117,7 +117,7 @@ mod tests { assert_eq!( puffin_reader - .blob(file_metadata.blobs.get(1).unwrap().clone()) + .blob(file_metadata.blobs.get(1).unwrap()) .await .unwrap(), blob_1(),