Skip to content

Commit

Permalink
Rebased on apache/pull/6637
Browse files Browse the repository at this point in the history
  • Loading branch information
ggershinsky authored and rok committed Mar 11, 2025
1 parent 38d6e69 commit 2917399
Show file tree
Hide file tree
Showing 28 changed files with 2,255 additions and 80 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/parquet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ jobs:
run: cargo check -p parquet --all-targets --all-features
- name: Check compilation --all-targets --no-default-features --features json
run: cargo check -p parquet --all-targets --no-default-features --features json
- name: Check compilation --no-default-features --features encryption --features async
run: cargo check -p parquet --no-default-features --features encryption --features async

# test the parquet crate builds against wasm32 in stable rust
wasm32-build:
Expand Down
5 changes: 5 additions & 0 deletions parquet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ rust-version = { workspace = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
ahash = { version = "0.8", default-features = false, features = ["compile-time-rng"] }
# See https://github.com/briansmith/ring/issues/918#issuecomment-2077788925
ring = { version = "0.17", default-features = false, features = ["wasm32_unknown_unknown_js", "std"], optional = true }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
ahash = { version = "0.8", default-features = false, features = ["runtime-rng"] }
Expand Down Expand Up @@ -70,6 +72,7 @@ half = { version = "2.1", default-features = false, features = ["num-traits"] }
sysinfo = { version = "0.33.0", optional = true, default-features = false, features = ["system"] }
crc32fast = { version = "1.4.2", optional = true, default-features = false }
simdutf8 = { version = "0.1.5", optional = true, default-features = false }
ring = { version = "0.17", default-features = false, features = ["std"], optional = true }

[dev-dependencies]
base64 = { version = "0.22", default-features = false, features = ["std"] }
Expand Down Expand Up @@ -125,6 +128,8 @@ sysinfo = ["dep:sysinfo"]
crc = ["dep:crc32fast"]
# Enable SIMD UTF-8 validation
simdutf8 = ["dep:simdutf8"]
# Enable Parquet modular encryption support
encryption = ["dep:ring"]


[[example]]
Expand Down
3 changes: 3 additions & 0 deletions parquet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ The `parquet` crate provides the following features which may be enabled in your
- `crc` - enables functionality to automatically verify checksums of each page (if present) when decoding
- `experimental` - Experimental APIs which may change, even between minor releases
- `simdutf8` (default) - Use the [`simdutf8`] crate for SIMD-accelerated UTF-8 validation
- `encryption` - support for reading / writing encrypted Parquet files

[`arrow`]: https://crates.io/crates/arrow
[`simdutf8`]: https://crates.io/crates/simdutf8
Expand All @@ -76,12 +77,14 @@ The `parquet` crate provides the following features which may be enabled in your
- [x] Row record reader
- [x] Arrow record reader
- [x] Async support (to Arrow)
- [x] Encrypted files
- [x] Statistics support
- [x] Write support
- [x] Primitive column value writers
- [ ] Row record writer
- [x] Arrow record writer
- [x] Async support
- [ ] Encrypted files
- [x] Predicate pushdown
- [x] Parquet format 4.0.0 support

Expand Down
9 changes: 8 additions & 1 deletion parquet/examples/read_with_rowgroup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ async fn main() -> Result<()> {
let mut file = File::open(&path).await.unwrap();

// The metadata could be cached in other places, this example only shows how to read
let metadata = file.get_metadata().await?;
let metadata = file
.get_metadata(
#[cfg(feature = "encryption")]
None,
)
.await?;

for rg in metadata.row_groups() {
let mut rowgroup = InMemoryRowGroup::create(rg.clone(), ProjectionMask::all());
Expand Down Expand Up @@ -121,6 +126,8 @@ impl RowGroups for InMemoryRowGroup {
self.metadata.column(i),
self.num_rows(),
None,
#[cfg(feature = "encryption")]
None,
)?);

Ok(Box::new(ColumnChunkIterator {
Expand Down
Loading

0 comments on commit 2917399

Please sign in to comment.