Skip to content

Commit 850ba66

Browse files
committed
Move inside iceberg crate
1 parent c5c84d8 commit 850ba66

20 files changed

+84
-87
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ members = [
2323
"crates/iceberg",
2424
"crates/integration_tests",
2525
"crates/integrations/*",
26-
"crates/puffin",
2726
"crates/test_utils",
2827
]
2928
exclude = ["bindings/python"]

crates/iceberg/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ tokio = { workspace = true, optional = true }
8181
typed-builder = { workspace = true }
8282
url = { workspace = true }
8383
uuid = { workspace = true }
84+
zstd = { workspace = true }
8485

8586
[dev-dependencies]
8687
ctor = { workspace = true }

crates/iceberg/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,5 @@ mod runtime;
8484
pub mod arrow;
8585
mod utils;
8686
pub mod writer;
87+
88+
pub mod puffin;
File renamed without changes.

crates/puffin/src/compression.rs renamed to crates/iceberg/src/puffin/compression.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
use iceberg::{Error, ErrorKind, Result};
1918
use serde::{Deserialize, Serialize};
2019

20+
use crate::{Error, ErrorKind, Result};
21+
2122
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone, Copy)]
2223
#[serde(rename_all = "lowercase")]
2324
#[derive(Default)]
@@ -73,7 +74,7 @@ impl CompressionCodec {
7374

7475
#[cfg(test)]
7576
mod tests {
76-
use crate::compression::CompressionCodec;
77+
use crate::puffin::compression::CompressionCodec;
7778

7879
#[tokio::test]
7980
async fn test_compression_codec_none() {
File renamed without changes.

crates/puffin/src/metadata.rs renamed to crates/iceberg/src/puffin/metadata.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
use std::collections::{HashMap, HashSet};
1919

2020
use bytes::Bytes;
21-
use iceberg::io::{FileRead, InputFile};
22-
use iceberg::{Error, ErrorKind, Result};
2321
use once_cell::sync::Lazy;
2422
use serde::{Deserialize, Serialize};
2523

26-
use crate::compression::CompressionCodec;
24+
use crate::io::{FileRead, InputFile};
25+
use crate::puffin::compression::CompressionCodec;
26+
use crate::{Error, ErrorKind, Result};
2727

2828
/// Human-readable identification of the application writing the file, along with its version.
2929
/// Example: "Trino version 381"
@@ -286,11 +286,11 @@ mod tests {
286286
use std::collections::HashMap;
287287

288288
use bytes::Bytes;
289-
use iceberg::io::{FileIOBuilder, InputFile};
290289
use tempfile::TempDir;
291290

292-
use crate::metadata::{BlobMetadata, CompressionCodec, FileMetadata};
293-
use crate::test_utils::{
291+
use crate::io::{FileIOBuilder, InputFile};
292+
use crate::puffin::metadata::{BlobMetadata, CompressionCodec, FileMetadata};
293+
use crate::puffin::test_utils::{
294294
empty_footer_payload, empty_footer_payload_bytes, empty_footer_payload_bytes_length_bytes,
295295
rust_empty_uncompressed_input_file, rust_uncompressed_metric_input_file,
296296
rust_zstd_compressed_metric_input_file, uncompressed_metric_file_metadata,

crates/iceberg/src/puffin/mod.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
//! Iceberg Puffin file format implementation
19+
20+
#![deny(missing_docs)]
21+
22+
mod blob;
23+
pub use blob::{Blob, APACHE_DATASKETCHES_THETA_V1};
24+
25+
mod compression;
26+
pub use compression::CompressionCodec;
27+
28+
mod metadata;
29+
pub use metadata::{BlobMetadata, FileMetadata, CREATED_BY_PROPERTY};
30+
31+
mod reader;
32+
pub use reader::PuffinReader;
33+
34+
#[cfg(test)]
35+
mod test_utils;
36+
37+
mod writer;
38+
pub use writer::PuffinWriter;

crates/puffin/src/reader.rs renamed to crates/iceberg/src/puffin/reader.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
use iceberg::io::{FileRead, InputFile};
19-
use iceberg::Result;
20-
21-
use crate::blob::Blob;
22-
use crate::metadata::{BlobMetadata, FileMetadata};
18+
use crate::io::{FileRead, InputFile};
19+
use crate::puffin::blob::Blob;
20+
use crate::puffin::metadata::{BlobMetadata, FileMetadata};
21+
use crate::Result;
2322

2423
/// Puffin reader
2524
pub struct PuffinReader {
@@ -68,12 +67,12 @@ impl PuffinReader {
6867
#[cfg(test)]
6968
mod tests {
7069

71-
use crate::test_utils::{
70+
use crate::puffin::test_utils::{
7271
blob_0, blob_1, rust_uncompressed_metric_input_file,
7372
rust_zstd_compressed_metric_input_file, uncompressed_metric_file_metadata,
7473
zstd_compressed_metric_file_metadata,
7574
};
76-
use crate::PuffinReader;
75+
use crate::puffin::PuffinReader;
7776

7877
#[tokio::test]
7978
async fn test_puffin_reader_uncompressed_metric_data() {

crates/puffin/src/test_utils.rs renamed to crates/iceberg/src/puffin/test_utils.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@
1717

1818
use std::collections::HashMap;
1919

20-
use iceberg::io::{FileIOBuilder, InputFile};
20+
use crate::io::{FileIOBuilder, InputFile};
21+
use crate::puffin::blob::Blob;
22+
use crate::puffin::compression::CompressionCodec;
23+
use crate::puffin::metadata::{BlobMetadata, FileMetadata, CREATED_BY_PROPERTY};
2124

22-
use crate::blob::Blob;
23-
use crate::compression::CompressionCodec;
24-
use crate::metadata::{BlobMetadata, FileMetadata, CREATED_BY_PROPERTY};
25-
26-
const V1_RUST: &str = "testdata/v1/rust-generated";
27-
const V1_JAVA: &str = "testdata/v1/java-generated";
25+
const RUST_TESTDATA: &str = "testdata/puffin/rust-generated";
26+
const JAVA_TESTDATA: &str = "testdata/puffin/java-generated";
2827
const EMPTY_UNCOMPRESSED: &str = "empty-puffin-uncompressed.bin";
2928
const METRIC_UNCOMPRESSED: &str = "sample-metric-data-uncompressed.bin";
3029
const METRIC_ZSTD_COMPRESSED: &str = "sample-metric-data-compressed-zstd.bin";
@@ -38,27 +37,27 @@ fn input_file_for_test_data(path: &str) -> InputFile {
3837
}
3938

4039
pub(crate) fn java_empty_uncompressed_input_file() -> InputFile {
41-
input_file_for_test_data(&[V1_JAVA, EMPTY_UNCOMPRESSED].join("/"))
40+
input_file_for_test_data(&[JAVA_TESTDATA, EMPTY_UNCOMPRESSED].join("/"))
4241
}
4342

4443
pub(crate) fn rust_empty_uncompressed_input_file() -> InputFile {
45-
input_file_for_test_data(&[V1_RUST, EMPTY_UNCOMPRESSED].join("/"))
44+
input_file_for_test_data(&[RUST_TESTDATA, EMPTY_UNCOMPRESSED].join("/"))
4645
}
4746

4847
pub(crate) fn java_uncompressed_metric_input_file() -> InputFile {
49-
input_file_for_test_data(&[V1_JAVA, METRIC_UNCOMPRESSED].join("/"))
48+
input_file_for_test_data(&[JAVA_TESTDATA, METRIC_UNCOMPRESSED].join("/"))
5049
}
5150

5251
pub(crate) fn rust_uncompressed_metric_input_file() -> InputFile {
53-
input_file_for_test_data(&[V1_RUST, METRIC_UNCOMPRESSED].join("/"))
52+
input_file_for_test_data(&[RUST_TESTDATA, METRIC_UNCOMPRESSED].join("/"))
5453
}
5554

5655
pub(crate) fn java_zstd_compressed_metric_input_file() -> InputFile {
57-
input_file_for_test_data(&[V1_JAVA, METRIC_ZSTD_COMPRESSED].join("/"))
56+
input_file_for_test_data(&[JAVA_TESTDATA, METRIC_ZSTD_COMPRESSED].join("/"))
5857
}
5958

6059
pub(crate) fn rust_zstd_compressed_metric_input_file() -> InputFile {
61-
input_file_for_test_data(&[V1_RUST, METRIC_ZSTD_COMPRESSED].join("/"))
60+
input_file_for_test_data(&[RUST_TESTDATA, METRIC_ZSTD_COMPRESSED].join("/"))
6261
}
6362

6463
pub(crate) fn empty_footer_payload() -> FileMetadata {

0 commit comments

Comments
 (0)