liurenjie1024 commented on code in PR #1165:
URL: https://github.com/apache/iceberg-rust/pull/1165#discussion_r2033164613
##########
crates/iceberg/src/puffin/blob.rs:
##########
@@ -18,21 +18,53 @@
use std::collections::HashMap;
/// A serialized form of a "compact" Theta sketch produced by the Apache
DataSketches library.
-pub(crate) const APACHE_DATASKETCHES_THETA_V1: &str =
"apache-datasketches-theta-v1";
+pub const APACHE_DATASKETCHES_THETA_V1: &str = "apache-datasketches-theta-v1";
/// The blob
#[derive(Debug, PartialEq, Clone)]
-pub(crate) struct Blob {
- /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+pub struct Blob {
pub(crate) r#type: String,
- /// List of field IDs the blob was computed for; the order of items is
used to compute sketches stored in the blob.
pub(crate) fields: Vec<i32>,
- /// ID of the Iceberg table's snapshot the blob was computed from
pub(crate) snapshot_id: i64,
- /// Sequence number of the Iceberg table's snapshot the blob was computed
from
pub(crate) sequence_number: i64,
- /// The uncompressed blob data
pub(crate) data: Vec<u8>,
- /// Arbitrary meta-information about the blob
pub(crate) properties: HashMap<String, String>,
}
+
+impl Blob {
+ #[inline]
+ /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+ pub fn blob_type(&self) -> &String {
+ &self.r#type
+ }
+
+ #[inline]
+ /// List of field IDs the blob was computed for; the order of items is
used to compute sketches stored in the blob.
+ pub fn fields(&self) -> &Vec<i32> {
Review Comment:
```suggestion
pub fn fields(&self) -> &[i32] {
```
##########
crates/iceberg/src/puffin/blob.rs:
##########
@@ -18,21 +18,53 @@
use std::collections::HashMap;
/// A serialized form of a "compact" Theta sketch produced by the Apache
DataSketches library.
-pub(crate) const APACHE_DATASKETCHES_THETA_V1: &str =
"apache-datasketches-theta-v1";
+pub const APACHE_DATASKETCHES_THETA_V1: &str = "apache-datasketches-theta-v1";
/// The blob
#[derive(Debug, PartialEq, Clone)]
-pub(crate) struct Blob {
- /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+pub struct Blob {
pub(crate) r#type: String,
- /// List of field IDs the blob was computed for; the order of items is
used to compute sketches stored in the blob.
pub(crate) fields: Vec<i32>,
- /// ID of the Iceberg table's snapshot the blob was computed from
pub(crate) snapshot_id: i64,
- /// Sequence number of the Iceberg table's snapshot the blob was computed
from
pub(crate) sequence_number: i64,
- /// The uncompressed blob data
pub(crate) data: Vec<u8>,
- /// Arbitrary meta-information about the blob
pub(crate) properties: HashMap<String, String>,
}
+
+impl Blob {
+ #[inline]
+ /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+ pub fn blob_type(&self) -> &String {
Review Comment:
```suggestion
pub fn blob_type(&self) -> &str {
```
##########
crates/iceberg/src/puffin/blob.rs:
##########
@@ -18,21 +18,53 @@
use std::collections::HashMap;
/// A serialized form of a "compact" Theta sketch produced by the Apache
DataSketches library.
-pub(crate) const APACHE_DATASKETCHES_THETA_V1: &str =
"apache-datasketches-theta-v1";
+pub const APACHE_DATASKETCHES_THETA_V1: &str = "apache-datasketches-theta-v1";
/// The blob
#[derive(Debug, PartialEq, Clone)]
-pub(crate) struct Blob {
- /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+pub struct Blob {
pub(crate) r#type: String,
- /// List of field IDs the blob was computed for; the order of items is
used to compute sketches stored in the blob.
pub(crate) fields: Vec<i32>,
- /// ID of the Iceberg table's snapshot the blob was computed from
pub(crate) snapshot_id: i64,
- /// Sequence number of the Iceberg table's snapshot the blob was computed
from
pub(crate) sequence_number: i64,
- /// The uncompressed blob data
pub(crate) data: Vec<u8>,
- /// Arbitrary meta-information about the blob
pub(crate) properties: HashMap<String, String>,
}
+
+impl Blob {
+ #[inline]
+ /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+ pub fn blob_type(&self) -> &String {
+ &self.r#type
+ }
+
+ #[inline]
+ /// List of field IDs the blob was computed for; the order of items is
used to compute sketches stored in the blob.
+ pub fn fields(&self) -> &Vec<i32> {
+ &self.fields
+ }
+
+ #[inline]
+ /// ID of the Iceberg table's snapshot the blob was computed from
+ pub fn snapshot_id(&self) -> &i64 {
Review Comment:
```suggestion
pub fn snapshot_id(&self) -> i64 {
```
##########
crates/iceberg/src/puffin/metadata.rs:
##########
@@ -26,35 +26,77 @@ use crate::{Error, ErrorKind, Result};
/// Human-readable identification of the application writing the file, along
with its version.
/// Example: "Trino version 381"
-pub(crate) const CREATED_BY_PROPERTY: &str = "created-by";
+pub const CREATED_BY_PROPERTY: &str = "created-by";
/// Metadata about a blob.
/// For more information, see:
https://iceberg.apache.org/puffin-spec/#blobmetadata
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
#[serde(rename_all = "kebab-case")]
-pub(crate) struct BlobMetadata {
- /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+pub struct BlobMetadata {
pub(crate) r#type: String,
- /// List of field IDs the blob was computed for; the order of items is
used to compute sketches stored in the blob.
pub(crate) fields: Vec<i32>,
- /// ID of the Iceberg table's snapshot the blob was computed from
pub(crate) snapshot_id: i64,
- /// Sequence number of the Iceberg table's snapshot the blob was computed
from
pub(crate) sequence_number: i64,
- /// The offset in the file where the blob contents start
pub(crate) offset: u64,
- /// The length of the blob stored in the file (after compression, if
compressed)
pub(crate) length: u64,
- /// The compression codec used to compress the data
#[serde(skip_serializing_if = "CompressionCodec::is_none")]
#[serde(default)]
pub(crate) compression_codec: CompressionCodec,
- /// Arbitrary meta-information about the blob
#[serde(skip_serializing_if = "HashMap::is_empty")]
#[serde(default)]
pub(crate) properties: HashMap<String, String>,
}
+impl BlobMetadata {
+ #[inline]
+ /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+ pub fn blob_type(&self) -> &String {
+ &self.r#type
+ }
+
+ #[inline]
+ /// List of field IDs the blob was computed for; the order of items is
used to compute sketches stored in the blob.
+ pub fn fields(&self) -> &Vec<i32> {
+ &self.fields
+ }
+
+ #[inline]
+ /// ID of the Iceberg table's snapshot the blob was computed from
+ pub fn snapshot_id(&self) -> &i64 {
+ &self.snapshot_id
+ }
+
+ #[inline]
+ /// Sequence number of the Iceberg table's snapshot the blob was computed
from
+ pub fn sequence_number(&self) -> &i64 {
+ &self.sequence_number
+ }
+
+ #[inline]
+ /// The offset in the file where the blob contents start
+ pub fn offset(&self) -> &u64 {
+ &self.offset
+ }
+
+ #[inline]
+ /// The length of the blob stored in the file (after compression, if
compressed)
+ pub fn length(&self) -> &u64 {
Review Comment:
```suggestion
pub fn length(&self) -> u64 {
```
##########
crates/iceberg/src/puffin/metadata.rs:
##########
@@ -26,35 +26,77 @@ use crate::{Error, ErrorKind, Result};
/// Human-readable identification of the application writing the file, along
with its version.
/// Example: "Trino version 381"
-pub(crate) const CREATED_BY_PROPERTY: &str = "created-by";
+pub const CREATED_BY_PROPERTY: &str = "created-by";
/// Metadata about a blob.
/// For more information, see:
https://iceberg.apache.org/puffin-spec/#blobmetadata
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
#[serde(rename_all = "kebab-case")]
-pub(crate) struct BlobMetadata {
- /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+pub struct BlobMetadata {
pub(crate) r#type: String,
- /// List of field IDs the blob was computed for; the order of items is
used to compute sketches stored in the blob.
pub(crate) fields: Vec<i32>,
- /// ID of the Iceberg table's snapshot the blob was computed from
pub(crate) snapshot_id: i64,
- /// Sequence number of the Iceberg table's snapshot the blob was computed
from
pub(crate) sequence_number: i64,
- /// The offset in the file where the blob contents start
pub(crate) offset: u64,
- /// The length of the blob stored in the file (after compression, if
compressed)
pub(crate) length: u64,
- /// The compression codec used to compress the data
#[serde(skip_serializing_if = "CompressionCodec::is_none")]
#[serde(default)]
pub(crate) compression_codec: CompressionCodec,
- /// Arbitrary meta-information about the blob
#[serde(skip_serializing_if = "HashMap::is_empty")]
#[serde(default)]
pub(crate) properties: HashMap<String, String>,
}
+impl BlobMetadata {
+ #[inline]
+ /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+ pub fn blob_type(&self) -> &String {
Review Comment:
```suggestion
pub fn blob_type(&self) -> &str {
```
##########
crates/iceberg/src/puffin/metadata.rs:
##########
@@ -26,35 +26,77 @@ use crate::{Error, ErrorKind, Result};
/// Human-readable identification of the application writing the file, along
with its version.
/// Example: "Trino version 381"
-pub(crate) const CREATED_BY_PROPERTY: &str = "created-by";
+pub const CREATED_BY_PROPERTY: &str = "created-by";
/// Metadata about a blob.
/// For more information, see:
https://iceberg.apache.org/puffin-spec/#blobmetadata
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
#[serde(rename_all = "kebab-case")]
-pub(crate) struct BlobMetadata {
- /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+pub struct BlobMetadata {
pub(crate) r#type: String,
- /// List of field IDs the blob was computed for; the order of items is
used to compute sketches stored in the blob.
pub(crate) fields: Vec<i32>,
- /// ID of the Iceberg table's snapshot the blob was computed from
pub(crate) snapshot_id: i64,
- /// Sequence number of the Iceberg table's snapshot the blob was computed
from
pub(crate) sequence_number: i64,
- /// The offset in the file where the blob contents start
pub(crate) offset: u64,
- /// The length of the blob stored in the file (after compression, if
compressed)
pub(crate) length: u64,
- /// The compression codec used to compress the data
#[serde(skip_serializing_if = "CompressionCodec::is_none")]
#[serde(default)]
pub(crate) compression_codec: CompressionCodec,
- /// Arbitrary meta-information about the blob
#[serde(skip_serializing_if = "HashMap::is_empty")]
#[serde(default)]
pub(crate) properties: HashMap<String, String>,
}
+impl BlobMetadata {
+ #[inline]
+ /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+ pub fn blob_type(&self) -> &String {
+ &self.r#type
+ }
+
+ #[inline]
+ /// List of field IDs the blob was computed for; the order of items is
used to compute sketches stored in the blob.
+ pub fn fields(&self) -> &Vec<i32> {
+ &self.fields
+ }
+
+ #[inline]
+ /// ID of the Iceberg table's snapshot the blob was computed from
+ pub fn snapshot_id(&self) -> &i64 {
+ &self.snapshot_id
+ }
+
+ #[inline]
+ /// Sequence number of the Iceberg table's snapshot the blob was computed
from
+ pub fn sequence_number(&self) -> &i64 {
Review Comment:
```suggestion
pub fn sequence_number(&self) -> i64 {
```
##########
crates/iceberg/src/puffin/metadata.rs:
##########
@@ -26,35 +26,77 @@ use crate::{Error, ErrorKind, Result};
/// Human-readable identification of the application writing the file, along
with its version.
/// Example: "Trino version 381"
-pub(crate) const CREATED_BY_PROPERTY: &str = "created-by";
+pub const CREATED_BY_PROPERTY: &str = "created-by";
/// Metadata about a blob.
/// For more information, see:
https://iceberg.apache.org/puffin-spec/#blobmetadata
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
#[serde(rename_all = "kebab-case")]
-pub(crate) struct BlobMetadata {
- /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+pub struct BlobMetadata {
pub(crate) r#type: String,
- /// List of field IDs the blob was computed for; the order of items is
used to compute sketches stored in the blob.
pub(crate) fields: Vec<i32>,
- /// ID of the Iceberg table's snapshot the blob was computed from
pub(crate) snapshot_id: i64,
- /// Sequence number of the Iceberg table's snapshot the blob was computed
from
pub(crate) sequence_number: i64,
- /// The offset in the file where the blob contents start
pub(crate) offset: u64,
- /// The length of the blob stored in the file (after compression, if
compressed)
pub(crate) length: u64,
- /// The compression codec used to compress the data
#[serde(skip_serializing_if = "CompressionCodec::is_none")]
#[serde(default)]
pub(crate) compression_codec: CompressionCodec,
- /// Arbitrary meta-information about the blob
#[serde(skip_serializing_if = "HashMap::is_empty")]
#[serde(default)]
pub(crate) properties: HashMap<String, String>,
}
+impl BlobMetadata {
+ #[inline]
+ /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+ pub fn blob_type(&self) -> &String {
+ &self.r#type
+ }
+
+ #[inline]
+ /// List of field IDs the blob was computed for; the order of items is
used to compute sketches stored in the blob.
+ pub fn fields(&self) -> &Vec<i32> {
+ &self.fields
+ }
+
+ #[inline]
+ /// ID of the Iceberg table's snapshot the blob was computed from
+ pub fn snapshot_id(&self) -> &i64 {
+ &self.snapshot_id
+ }
+
+ #[inline]
+ /// Sequence number of the Iceberg table's snapshot the blob was computed
from
+ pub fn sequence_number(&self) -> &i64 {
+ &self.sequence_number
+ }
+
+ #[inline]
+ /// The offset in the file where the blob contents start
+ pub fn offset(&self) -> &u64 {
Review Comment:
```suggestion
pub fn offset(&self) -> u64 {
```
##########
crates/iceberg/src/puffin/blob.rs:
##########
@@ -18,21 +18,53 @@
use std::collections::HashMap;
/// A serialized form of a "compact" Theta sketch produced by the Apache
DataSketches library.
-pub(crate) const APACHE_DATASKETCHES_THETA_V1: &str =
"apache-datasketches-theta-v1";
+pub const APACHE_DATASKETCHES_THETA_V1: &str = "apache-datasketches-theta-v1";
/// The blob
#[derive(Debug, PartialEq, Clone)]
-pub(crate) struct Blob {
- /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+pub struct Blob {
pub(crate) r#type: String,
- /// List of field IDs the blob was computed for; the order of items is
used to compute sketches stored in the blob.
pub(crate) fields: Vec<i32>,
- /// ID of the Iceberg table's snapshot the blob was computed from
pub(crate) snapshot_id: i64,
- /// Sequence number of the Iceberg table's snapshot the blob was computed
from
pub(crate) sequence_number: i64,
- /// The uncompressed blob data
pub(crate) data: Vec<u8>,
- /// Arbitrary meta-information about the blob
pub(crate) properties: HashMap<String, String>,
}
+
+impl Blob {
+ #[inline]
+ /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+ pub fn blob_type(&self) -> &String {
+ &self.r#type
+ }
+
+ #[inline]
+ /// List of field IDs the blob was computed for; the order of items is
used to compute sketches stored in the blob.
+ pub fn fields(&self) -> &Vec<i32> {
+ &self.fields
+ }
+
+ #[inline]
+ /// ID of the Iceberg table's snapshot the blob was computed from
+ pub fn snapshot_id(&self) -> &i64 {
+ &self.snapshot_id
+ }
+
+ #[inline]
+ /// Sequence number of the Iceberg table's snapshot the blob was computed
from
+ pub fn sequence_number(&self) -> &i64 {
+ &self.sequence_number
+ }
+
+ #[inline]
+ /// The uncompressed blob data
+ pub fn data(&self) -> &Vec<u8> {
Review Comment:
```suggestion
pub fn data(&self) -> &[u8] {
```
##########
crates/iceberg/src/puffin/blob.rs:
##########
@@ -18,21 +18,53 @@
use std::collections::HashMap;
/// A serialized form of a "compact" Theta sketch produced by the Apache
DataSketches library.
-pub(crate) const APACHE_DATASKETCHES_THETA_V1: &str =
"apache-datasketches-theta-v1";
+pub const APACHE_DATASKETCHES_THETA_V1: &str = "apache-datasketches-theta-v1";
/// The blob
#[derive(Debug, PartialEq, Clone)]
-pub(crate) struct Blob {
- /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+pub struct Blob {
pub(crate) r#type: String,
- /// List of field IDs the blob was computed for; the order of items is
used to compute sketches stored in the blob.
pub(crate) fields: Vec<i32>,
- /// ID of the Iceberg table's snapshot the blob was computed from
pub(crate) snapshot_id: i64,
- /// Sequence number of the Iceberg table's snapshot the blob was computed
from
pub(crate) sequence_number: i64,
- /// The uncompressed blob data
pub(crate) data: Vec<u8>,
- /// Arbitrary meta-information about the blob
pub(crate) properties: HashMap<String, String>,
}
+
+impl Blob {
+ #[inline]
+ /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+ pub fn blob_type(&self) -> &String {
+ &self.r#type
+ }
+
+ #[inline]
+ /// List of field IDs the blob was computed for; the order of items is
used to compute sketches stored in the blob.
+ pub fn fields(&self) -> &Vec<i32> {
+ &self.fields
+ }
+
+ #[inline]
+ /// ID of the Iceberg table's snapshot the blob was computed from
+ pub fn snapshot_id(&self) -> &i64 {
+ &self.snapshot_id
+ }
+
+ #[inline]
+ /// Sequence number of the Iceberg table's snapshot the blob was computed
from
+ pub fn sequence_number(&self) -> &i64 {
Review Comment:
```suggestion
pub fn sequence_number(&self) -> i64 {
```
##########
crates/iceberg/src/puffin/metadata.rs:
##########
@@ -26,35 +26,77 @@ use crate::{Error, ErrorKind, Result};
/// Human-readable identification of the application writing the file, along
with its version.
/// Example: "Trino version 381"
-pub(crate) const CREATED_BY_PROPERTY: &str = "created-by";
+pub const CREATED_BY_PROPERTY: &str = "created-by";
/// Metadata about a blob.
/// For more information, see:
https://iceberg.apache.org/puffin-spec/#blobmetadata
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
#[serde(rename_all = "kebab-case")]
-pub(crate) struct BlobMetadata {
- /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+pub struct BlobMetadata {
pub(crate) r#type: String,
- /// List of field IDs the blob was computed for; the order of items is
used to compute sketches stored in the blob.
pub(crate) fields: Vec<i32>,
- /// ID of the Iceberg table's snapshot the blob was computed from
pub(crate) snapshot_id: i64,
- /// Sequence number of the Iceberg table's snapshot the blob was computed
from
pub(crate) sequence_number: i64,
- /// The offset in the file where the blob contents start
pub(crate) offset: u64,
- /// The length of the blob stored in the file (after compression, if
compressed)
pub(crate) length: u64,
- /// The compression codec used to compress the data
#[serde(skip_serializing_if = "CompressionCodec::is_none")]
#[serde(default)]
pub(crate) compression_codec: CompressionCodec,
- /// Arbitrary meta-information about the blob
#[serde(skip_serializing_if = "HashMap::is_empty")]
#[serde(default)]
pub(crate) properties: HashMap<String, String>,
}
+impl BlobMetadata {
+ #[inline]
+ /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+ pub fn blob_type(&self) -> &String {
+ &self.r#type
+ }
+
+ #[inline]
+ /// List of field IDs the blob was computed for; the order of items is
used to compute sketches stored in the blob.
+ pub fn fields(&self) -> &Vec<i32> {
Review Comment:
```suggestion
pub fn fields(&self) -> &[i32] {
```
##########
crates/iceberg/src/puffin/metadata.rs:
##########
@@ -26,35 +26,77 @@ use crate::{Error, ErrorKind, Result};
/// Human-readable identification of the application writing the file, along
with its version.
/// Example: "Trino version 381"
-pub(crate) const CREATED_BY_PROPERTY: &str = "created-by";
+pub const CREATED_BY_PROPERTY: &str = "created-by";
/// Metadata about a blob.
/// For more information, see:
https://iceberg.apache.org/puffin-spec/#blobmetadata
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
#[serde(rename_all = "kebab-case")]
-pub(crate) struct BlobMetadata {
- /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+pub struct BlobMetadata {
pub(crate) r#type: String,
- /// List of field IDs the blob was computed for; the order of items is
used to compute sketches stored in the blob.
pub(crate) fields: Vec<i32>,
- /// ID of the Iceberg table's snapshot the blob was computed from
pub(crate) snapshot_id: i64,
- /// Sequence number of the Iceberg table's snapshot the blob was computed
from
pub(crate) sequence_number: i64,
- /// The offset in the file where the blob contents start
pub(crate) offset: u64,
- /// The length of the blob stored in the file (after compression, if
compressed)
pub(crate) length: u64,
- /// The compression codec used to compress the data
#[serde(skip_serializing_if = "CompressionCodec::is_none")]
#[serde(default)]
pub(crate) compression_codec: CompressionCodec,
- /// Arbitrary meta-information about the blob
#[serde(skip_serializing_if = "HashMap::is_empty")]
#[serde(default)]
pub(crate) properties: HashMap<String, String>,
}
+impl BlobMetadata {
+ #[inline]
+ /// See blob types: https://iceberg.apache.org/puffin-spec/#blob-types
+ pub fn blob_type(&self) -> &String {
+ &self.r#type
+ }
+
+ #[inline]
+ /// List of field IDs the blob was computed for; the order of items is
used to compute sketches stored in the blob.
+ pub fn fields(&self) -> &Vec<i32> {
+ &self.fields
+ }
+
+ #[inline]
+ /// ID of the Iceberg table's snapshot the blob was computed from
+ pub fn snapshot_id(&self) -> &i64 {
Review Comment:
```suggestion
pub fn snapshot_id(&self) -> i64 {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]