Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor: Provide Debug impl for pub structs #73 #92

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/catalog/rest/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ impl RestCatalogConfig {
}
}

#[derive(Debug)]
struct HttpClient(Client);

impl HttpClient {
Expand Down Expand Up @@ -178,6 +179,7 @@ impl HttpClient {
}

/// Rest catalog implementation.
#[derive(Debug)]
pub struct RestCatalog {
config: RestCatalogConfig,
client: HttpClient,
Expand Down
6 changes: 5 additions & 1 deletion crates/iceberg/src/catalog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use std::ops::Deref;

/// The catalog API for Iceberg Rust.
#[async_trait]
pub trait Catalog {
pub trait Catalog: std::fmt::Debug {
/// List namespaces from table.
async fn list_namespaces(&self, parent: Option<&NamespaceIdent>)
-> Result<Vec<NamespaceIdent>>;
Expand Down Expand Up @@ -215,6 +215,7 @@ impl TableIdent {
}

/// TableCreation represents the creation of a table in the catalog.
#[derive(Debug)]
pub struct TableCreation {
/// The name of the table.
pub name: String,
Expand All @@ -231,6 +232,7 @@ pub struct TableCreation {
}

/// TableCommit represents the commit of a table in the catalog.
#[derive(Debug)]
pub struct TableCommit {
/// The table ident.
pub ident: TableIdent,
Expand All @@ -243,6 +245,7 @@ pub struct TableCommit {
}

/// TableRequirement represents a requirement for a table in the catalog.
#[derive(Debug)]
pub enum TableRequirement {
/// The table must not already exist; used for create transactions
NotExist,
Expand Down Expand Up @@ -273,6 +276,7 @@ pub enum TableRequirement {
/// TableUpdate represents an update to a table in the catalog.
///
/// TODO: we should fill with UpgradeFormatVersionUpdate, AddSchemaUpdate and so on.
#[derive(Debug)]
pub enum TableUpdate {}

#[cfg(test)]
Expand Down
1 change: 1 addition & 0 deletions crates/iceberg/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ pub struct FileIO {
}

/// Builder for [`FileIO`].
#[derive(Debug)]
pub struct FileIOBuilder {
/// This is used to infer scheme of operator.
///
Expand Down
1 change: 1 addition & 0 deletions crates/iceberg/src/rest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

//! This module provide rest catalog implementation.

#[derive(Debug)]
pub struct RestCatalog {
url: String,
}
10 changes: 10 additions & 0 deletions crates/iceberg/src/spec/manifest_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ pub struct ManifestListWriter {
avro_writer: Writer<'static, Vec<u8>>,
}

impl std::fmt::Debug for ManifestListWriter {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("ManifestListWriter")
.field("format_version", &self.format_version)
.field("output_file", &self.output_file)
.field("avro_writer", &self.avro_writer.schema())
.finish_non_exhaustive()
}
}

impl ManifestListWriter {
/// Construct a v1 [`ManifestListWriter`] that writes to a provided [`OutputFile`].
pub fn v1(output_file: OutputFile, snapshot_id: i64, parent_snapshot_id: i64) -> Self {
Expand Down
1 change: 1 addition & 0 deletions crates/iceberg/src/spec/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ pub struct Schema {
}

/// Schema builder.
#[derive(Debug)]
pub struct SchemaBuilder {
schema_id: i32,
fields: Vec<NestedFieldRef>,
Expand Down
2 changes: 1 addition & 1 deletion crates/iceberg/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::TableIdent;
use typed_builder::TypedBuilder;

/// Table represents a table in the catalog.
#[derive(TypedBuilder)]
#[derive(TypedBuilder, Debug)]
pub struct Table {
file_io: FileIO,
#[builder(default, setter(strip_option))]
Expand Down
1 change: 1 addition & 0 deletions crates/iceberg/src/transform/bucket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use arrow_schema::{DataType, TimeUnit};

use super::TransformFunction;

#[derive(Debug)]
pub struct Bucket {
mod_n: u32,
}
Expand Down
1 change: 1 addition & 0 deletions crates/iceberg/src/transform/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use arrow_array::ArrayRef;
use super::TransformFunction;

/// Return identity array.
#[derive(Debug)]
pub struct Identity {}

impl TransformFunction for Identity {
Expand Down
4 changes: 4 additions & 0 deletions crates/iceberg/src/transform/temporal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const DAY_PER_SECOND: f64 = 1.0_f64 / 24.0_f64 / 3600.0_f64;
const UNIX_EPOCH_YEAR: i32 = 1970;

/// Extract a date or timestamp year, as years from 1970
#[derive(Debug)]
pub struct Year;

impl TransformFunction for Year {
Expand All @@ -55,6 +56,7 @@ impl TransformFunction for Year {
}

/// Extract a date or timestamp month, as months from 1970-01-01
#[derive(Debug)]
pub struct Month;

impl TransformFunction for Month {
Expand All @@ -81,6 +83,7 @@ impl TransformFunction for Month {
}

/// Extract a date or timestamp day, as days from 1970-01-01
#[derive(Debug)]
pub struct Day;

impl TransformFunction for Day {
Expand Down Expand Up @@ -115,6 +118,7 @@ impl TransformFunction for Day {
}

/// Extract a timestamp hour, as hours from 1970-01-01 00:00:00
#[derive(Debug)]
pub struct Hour;

impl TransformFunction for Hour {
Expand Down
1 change: 1 addition & 0 deletions crates/iceberg/src/transform/truncate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use crate::Error;

use super::TransformFunction;

#[derive(Debug)]
pub struct Truncate {
width: u32,
}
Expand Down
1 change: 1 addition & 0 deletions crates/iceberg/src/transform/void.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use arrow_array::{new_null_array, ArrayRef};

use super::TransformFunction;

#[derive(Debug)]
pub struct Void {}

impl TransformFunction for Void {
Expand Down
Loading