Skip to content

Commit 00a3660

Browse files
authored
feat: add Mosaic data file reader (#386)
1 parent feca4dc commit 00a3660

5 files changed

Lines changed: 600 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
run: cargo fmt --all -- --check
5959

6060
- name: Clippy
61-
run: cargo clippy --all-targets --workspace --features fulltext,vortex -- -D warnings
61+
run: cargo clippy --all-targets --workspace --features fulltext,vortex,mosaic -- -D warnings
6262

6363
build:
6464
runs-on: ${{ matrix.os }}
@@ -71,7 +71,7 @@ jobs:
7171
steps:
7272
- uses: actions/checkout@v6
7373
- name: Build
74-
run: cargo build --features fulltext,vortex
74+
run: cargo build --features fulltext,vortex,mosaic
7575

7676
unit:
7777
runs-on: ${{ matrix.os }}
@@ -85,7 +85,7 @@ jobs:
8585
- uses: actions/checkout@v6
8686

8787
- name: Test
88-
run: cargo test -p paimon --all-targets --features fulltext,vortex
88+
run: cargo test -p paimon --all-targets --features fulltext,vortex,mosaic
8989
env:
9090
RUST_LOG: DEBUG
9191
RUST_BACKTRACE: full

crates/integrations/datafusion/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ keywords = ["paimon", "datafusion", "integrations"]
2929

3030
[features]
3131
fulltext = ["paimon/fulltext"]
32+
mosaic = ["paimon/mosaic"]
3233
vortex = ["paimon/vortex"]
3334

3435
[dependencies]

crates/paimon/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ storage-all = [
4242
"storage-hdfs",
4343
]
4444
fulltext = ["tantivy", "tempfile"]
45+
mosaic = ["dep:paimon-mosaic-core"]
4546
vortex = ["dep:vortex"]
4647

4748
storage-memory = ["opendal/services-memory"]
@@ -101,6 +102,7 @@ uuid = { version = "1", features = ["v4"] }
101102
urlencoding = "2.1"
102103
tantivy = { version = "0.22", optional = true }
103104
tempfile = { version = "3", optional = true }
105+
paimon-mosaic-core = { version = "0.1.0", optional = true }
104106
vortex = { version = "0.68", features = ["tokio"], optional = true }
105107
libloading = "0.9"
106108
# Keep CI on the dependency set that passed before unicode-segmentation 1.13.3.

crates/paimon/src/arrow/format/mod.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
mod avro;
1919
pub(crate) mod blob;
20+
#[cfg(feature = "mosaic")]
21+
mod mosaic;
2022
mod orc;
2123
mod parquet;
2224
#[cfg(feature = "vortex")]
@@ -106,18 +108,36 @@ pub(crate) fn create_format_reader(
106108
} else if lower.ends_with(".avro") {
107109
Ok(Box::new(avro::AvroFormatReader))
108110
} else {
111+
#[cfg(feature = "mosaic")]
112+
if lower.ends_with(".mosaic") {
113+
return Ok(Box::new(mosaic::MosaicFormatReader));
114+
}
109115
#[cfg(feature = "vortex")]
110116
if lower.ends_with(".vortex") {
111117
return Ok(Box::new(vortex::VortexFormatReader));
112118
}
113119
Err(Error::Unsupported {
114120
message: format!(
115-
"unsupported file format: expected .parquet, .blob, .orc, or .avro, got: {path}"
121+
"unsupported file format: expected {}, got: {path}",
122+
supported_read_formats().join(", ")
116123
),
117124
})
118125
}
119126
}
120127

128+
fn supported_read_formats() -> Vec<&'static str> {
129+
vec![
130+
".parquet",
131+
".blob",
132+
".orc",
133+
".avro",
134+
#[cfg(feature = "mosaic")]
135+
".mosaic",
136+
#[cfg(feature = "vortex")]
137+
".vortex",
138+
]
139+
}
140+
121141
/// Create a format writer that streams directly to storage.
122142
pub(crate) async fn create_format_writer(
123143
output: &OutputFile,

0 commit comments

Comments
 (0)