Skip to content

Commit

Permalink
&BlobMetadata and update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
fqaiser94 committed Jan 23, 2025
1 parent 9c7b8cf commit 4d64762
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion crates/iceberg/src/puffin/blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8>,
/// Arbitrary meta-information about the blob
pub(crate) properties: HashMap<String, String>,
Expand Down
16 changes: 8 additions & 8 deletions crates/iceberg/src/puffin/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ impl PuffinReader {
}

/// Returns blob
pub(crate) async fn blob(&self, blob_metadata: BlobMetadata) -> Result<Blob> {
pub(crate) async fn blob(&self, blob_metadata: &BlobMetadata) -> Result<Blob> {
let file_read = self.input_file.reader().await?;
let start = blob_metadata.offset;
let end = start + blob_metadata.length;
let bytes = file_read.read(start..end).await?.to_vec();
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(),
})
}
}
Expand All @@ -84,15 +84,15 @@ mod tests {

assert_eq!(
puffin_reader
.blob(file_metadata.blobs.first().unwrap().clone())
.blob(file_metadata.blobs.first().unwrap())
.await
.unwrap(),
blob_0()
);

assert_eq!(
puffin_reader
.blob(file_metadata.blobs.get(1).unwrap().clone())
.blob(file_metadata.blobs.get(1).unwrap())
.await
.unwrap(),
blob_1(),
Expand All @@ -109,15 +109,15 @@ mod tests {

assert_eq!(
puffin_reader
.blob(file_metadata.blobs.first().unwrap().clone())
.blob(file_metadata.blobs.first().unwrap())
.await
.unwrap(),
blob_0()
);

assert_eq!(
puffin_reader
.blob(file_metadata.blobs.get(1).unwrap().clone())
.blob(file_metadata.blobs.get(1).unwrap())
.await
.unwrap(),
blob_1(),
Expand Down

0 comments on commit 4d64762

Please sign in to comment.