# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

[package]
name = "parquet"
version = { workspace = true }
license = { workspace = true }
description = "Apache Parquet implementation in Rust"
homepage = { workspace = true }
repository = { workspace = true }
authors = { workspace = true }
keywords = ["arrow", "parquet", "hadoop"]
readme = "README.md"
edition = { workspace = true }
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"] }

[dependencies]
arrow-array = { workspace = true, optional = true }
arrow-buffer = { workspace = true, optional = true }
arrow-csv = { workspace = true, optional = true }
arrow-data = { workspace = true, optional = true }
arrow-schema = { workspace = true, optional = true }
arrow-select = { workspace = true, optional = true }
arrow-ipc = { workspace = true, optional = true }
parquet-geospatial = { workspace = true, optional = true }
parquet-variant = { workspace = true, optional = true }
parquet-variant-json = { workspace = true, optional = true }
parquet-variant-compute = { workspace = true, optional = true }

object_store = { workspace = true, optional = true, features = ["tokio"] }

bytes = { version = "1.1", default-features = false, features = ["std"] }
snap = { version = "1.0", default-features = false, optional = true }
brotli = { version = "8.0", default-features = false, features = ["std"], optional = true }
# To use `flate2` you must enable either the `flate2-zlib-rs` or `flate2-rust_backend` backends
flate2 = { version = "1.1", default-features = false, optional = true }
lz4_flex = { version = "0.13", default-features = false, features = ["std", "frame"], optional = true }
zstd = { version = "0.13", optional = true, default-features = false }
chrono = { workspace = true }
num-bigint = { version = "0.4", default-features = false }
num-integer = { version = "0.1.46", default-features = false, features = ["std"] }
num-traits = { version = "0.2.19", default-features = false, features = ["std"] }
base64 = { version = "0.22", default-features = false, features = ["std", ], optional = true }
clap = { version = "4.1", default-features = false, features = ["std", "derive", "env", "help", "error-context", "usage"], optional = true }
serde = { version = "1.0", default-features = false, features = ["derive"], optional = true }
serde_json = { version = "1.0", default-features = false, features = ["std"], optional = true }
seq-macro = { version = "0.3", default-features = false }
futures = { version = "0.3", default-features = false, features = ["std"], optional = true }
tokio = { version = "1.0", optional = true, default-features = false, features = ["macros", "rt", "io-util"] }
hashbrown = { version = "0.17", default-features = false }
twox-hash = { version = "2.0", default-features = false, features = ["xxhash64"] }
paste = { version = "1.0" }
half = { version = "2.1", default-features = false, features = ["num-traits"] }
crc32fast = { version = "1.4.2", optional = true, default-features = false }
simdutf8 = { workspace = true , optional = true }
ring = { version = "0.17", default-features = false, features = ["std"], optional = true }

[dev-dependencies]
base64 = { version = "0.22", default-features = false, features = ["std"] }
criterion = { workspace = true, default-features = false, features = ["async_futures"]  }
snap = { version = "1.0", default-features = false }
tempfile = { version = "3.0", default-features = false }
insta = { workspace = true, default-features = true }
brotli = { version = "8.0", default-features = false, features = ["std"] }
flate2 = { version = "1.0", default-features = false, features = ["rust_backend"] }
lz4_flex = { version = "0.13", default-features = false, features = ["std", "frame"] }
zstd = { version = "0.13", default-features = false }
serde_json = { version = "1.0", features = ["std"], default-features = false }
arrow = { workspace = true, features = ["ipc", "test_utils", "prettyprint", "json"] }
arrow-cast = { workspace = true }
tokio = { version = "1.0", default-features = false, features = ["macros", "rt-multi-thread", "io-util", "fs"] }
rand = { version = "0.9", default-features = false, features = ["std", "std_rng", "thread_rng"] }
object_store = { workspace = true, features = ["azure", "fs"] }
sysinfo = { version = "0.38.1", default-features = false, features = ["system"] }

[package.metadata.docs.rs]
all-features = true

[features]
default = ["arrow", "snap", "brotli", "flate2-zlib-rs", "lz4", "zstd", "base64", "simdutf8"]
# Enable lz4
lz4 = ["lz4_flex"]
# Enable arrow reader/writer APIs
arrow = ["base64", "arrow-array", "arrow-buffer", "arrow-data", "arrow-schema", "arrow-select", "arrow-ipc"]
# Enable support for arrow canonical extension types
arrow_canonical_extension_types = ["arrow-schema?/canonical_extension_types"]
# Enable CLI tools
cli = ["json", "base64", "clap", "arrow-csv", "serde"]
# Enable JSON APIs
json = ["serde_json", "base64"]
# Enable internal testing APIs
test_common = ["arrow/test_utils"]
# Experimental, unstable functionality primarily used for testing
experimental = ["variant_experimental"]
# Enable async APIs
async = ["futures", "tokio"]
# Enable object_store integration
object_store = ["dep:object_store", "async"]
# Group Zstd dependencies
zstd = ["dep:zstd"]
# Verify 32-bit CRC checksum when decoding parquet pages
crc = ["dep:crc32fast"]
# Enable SIMD UTF-8 validation
simdutf8 = ["dep:simdutf8"]
# Enable Parquet modular encryption support
encryption = ["dep:ring"]
# Enable flate2's default Rust backend
flate2-rust_backend = ["flate2/rust_backend"]
# Enable flate2's zlib-rs backend
flate2-zlib-rs = ["flate2/zlib-rs"]
# Enable parquet variant support
variant_experimental = ["arrow", "parquet-variant", "parquet-variant-json", "parquet-variant-compute"]
# Enable geospatial support
geospatial = ["parquet-geospatial"]
# Alias for typo. TODO: Remove in future major version bump.
flate2-rust_backened = ["flate2-rust_backend"]


[[example]]
name = "external_metadata"
required-features = ["arrow", "async"]
path = "./examples/external_metadata.rs"

[[example]]
name = "read_parquet"
required-features = ["arrow"]
path = "./examples/read_parquet.rs"

[[example]]
name = "write_parquet"
required-features = ["cli"]
path = "./examples/write_parquet.rs"

[[example]]
name = "read_with_rowgroup"
required-features = ["arrow", "async"]
path = "./examples/read_with_rowgroup.rs"

[[test]]
name = "arrow_writer_layout"
required-features = ["arrow"]

[[test]]
name = "arrow_reader"
required-features = ["arrow"]
path = "./tests/arrow_reader/mod.rs"

[[test]]
name = "arrow_writer"
required-features = ["arrow"]
path = "./tests/arrow_writer.rs"

[[test]]
name = "encryption"
required-features = ["arrow"]
path = "./tests/encryption/mod.rs"

[[test]]
name = "variant_integration"
required-features = ["arrow", "variant_experimental", "serde"]
path = "./tests/variant_integration.rs"

[[bin]]
name = "parquet-read"
required-features = ["cli"]

[[bin]]
name = "parquet-rewrite"
required-features = ["arrow", "cli"]

[[bin]]
name = "parquet-schema"
required-features = ["cli"]

[[bin]]
name = "parquet-rowcount"
required-features = ["cli"]

[[bin]]
name = "parquet-concat"
required-features = ["cli"]

[[bin]]
name = "parquet-fromcsv"
required-features = ["arrow", "cli", "snap", "brotli", "flate2", "lz4", "zstd"]

[[bin]]
name = "parquet-show-bloom-filter"
required-features = ["cli"]

[[bin]]
name = "parquet-layout"
required-features = ["cli"]

[[bin]]
name = "parquet-index"
required-features = ["cli"]

[[bench]]
name = "arrow_writer"
required-features = ["arrow"]
harness = false

[[bench]]
name = "push_decoder"
required-features = ["arrow"]
harness = false

[[bench]]
name = "writer_overhead"
required-features = ["arrow"]
harness = false

[[bench]]
name = "arrow_reader"
required-features = ["arrow", "test_common", "experimental"]
harness = false

[[bench]]
name = "arrow_statistics"
required-features = ["arrow"]
harness = false

[[bench]]
name = "arrow_reader_row_filter"
required-features = ["arrow", "async"]
harness = false

[[bench]]
name = "arrow_reader_clickbench"
required-features = ["arrow", "async", "object_store"]
harness = false

[[bench]]
name = "compression"
required-features = ["experimental", "default"]
harness = false

[[bench]]
name = "encoding"
required-features = ["experimental", "default"]
harness = false

[[bench]]
name = "metadata"
harness = false

[[bench]]
name = "parquet_round_trip"
required-features = ["arrow"]
harness = false

[[bench]]
name = "row_selector"
harness = false
required-features = ["arrow"]

[[bench]]
name = "row_group_index_reader"
required-features = ["arrow"]
harness = false

[[bench]]
name = "row_selection_cursor"
harness = false
required-features = ["arrow"]

[[bench]]
name = "bloom_filter"
harness = false

[[bench]]
name = "arrow_reader_peak_memory"
required-features = ["arrow", "test_common", "experimental"]
harness = false

[lib]
bench = false
