diff --git a/parquet/src/file/metadata/reader.rs b/parquet/src/file/metadata/reader.rs index c803d6013db8..2a927f15fb64 100644 --- a/parquet/src/file/metadata/reader.rs +++ b/parquet/src/file/metadata/reader.rs @@ -31,7 +31,7 @@ use crate::schema::types; use crate::schema::types::SchemaDescriptor; use crate::thrift::{TCompactSliceInputProtocol, TSerializable}; -#[cfg(feature = "async")] +#[cfg(all(feature = "async", feature = "arrow"))] use crate::arrow::async_reader::MetadataFetch; /// Reads the [`ParquetMetaData`] from a byte stream. @@ -321,7 +321,7 @@ impl ParquetMetaDataReader { /// /// See [`Self::with_prefetch_hint`] for a discussion of how to reduce the number of fetches /// performed by this function. - #[cfg(feature = "async")] + #[cfg(all(feature = "async", feature = "arrow"))] pub async fn load_and_finish( mut self, fetch: F, @@ -336,7 +336,7 @@ impl ParquetMetaDataReader { /// /// See [`Self::with_prefetch_hint`] for a discussion of how to reduce the number of fetches /// performed by this function. - #[cfg(feature = "async")] + #[cfg(all(feature = "async", feature = "arrow"))] pub async fn try_load( &mut self, mut fetch: F, @@ -357,12 +357,12 @@ impl ParquetMetaDataReader { /// Asynchronously fetch the page index structures when a [`ParquetMetaData`] has already /// been obtained. See [`Self::new_with_metadata()`]. - #[cfg(feature = "async")] + #[cfg(all(feature = "async", feature = "arrow"))] pub async fn load_page_index(&mut self, fetch: F) -> Result<()> { self.load_page_index_with_remainder(fetch, None).await } - #[cfg(feature = "async")] + #[cfg(all(feature = "async", feature = "arrow"))] async fn load_page_index_with_remainder( &mut self, mut fetch: F, @@ -513,7 +513,7 @@ impl ParquetMetaDataReader { /// Return the number of bytes to read in the initial pass. If `prefetch_size` has /// been provided, then return that value if it is larger than the size of the Parquet /// file footer (8 bytes). Otherwise returns `8`. - #[cfg(feature = "async")] + #[cfg(all(feature = "async", feature = "arrow"))] fn get_prefetch_size(&self) -> usize { if let Some(prefetch) = self.prefetch_hint { if prefetch > FOOTER_SIZE { @@ -523,7 +523,7 @@ impl ParquetMetaDataReader { FOOTER_SIZE } - #[cfg(feature = "async")] + #[cfg(all(feature = "async", feature = "arrow"))] async fn load_metadata( fetch: &mut F, file_size: usize, @@ -851,8 +851,7 @@ mod tests { } } -#[cfg(feature = "async")] -#[cfg(test)] +#[cfg(all(feature = "async", feature = "arrow", test))] mod async_tests { use super::*; use bytes::Bytes; diff --git a/parquet/tests/arrow_reader/bad_data.rs b/parquet/tests/arrow_reader/bad_data.rs index e2975c17c8b9..74342031432a 100644 --- a/parquet/tests/arrow_reader/bad_data.rs +++ b/parquet/tests/arrow_reader/bad_data.rs @@ -111,6 +111,7 @@ fn test_arrow_rs_gh_6229_dict_header() { } #[test] +#[cfg(feature = "snap")] fn test_arrow_rs_gh_6229_dict_levels() { let err = read_file("ARROW-RS-GH-6229-LEVELS.parquet").unwrap_err(); assert_eq!( diff --git a/parquet/tests/arrow_reader/checksum.rs b/parquet/tests/arrow_reader/checksum.rs index c60908d8b95d..b500b7cb1df8 100644 --- a/parquet/tests/arrow_reader/checksum.rs +++ b/parquet/tests/arrow_reader/checksum.rs @@ -26,10 +26,10 @@ use parquet::arrow::arrow_reader::ArrowReaderBuilder; fn test_datapage_v1_corrupt_checksum() { let errors = read_file_batch_errors("datapage_v1-corrupt-checksum.parquet"); assert_eq!(errors, [ - Err("Parquet argument error: Parquet error: Page CRC checksum mismatch".to_string()), + Err("Parquet argument error: Parquet error: Page CRC checksum mismatch".to_string()), Ok(()), Ok(()), - Err("Parquet argument error: Parquet error: Page CRC checksum mismatch".to_string()), + Err("Parquet argument error: Parquet error: Page CRC checksum mismatch".to_string()), Err("Parquet argument error: Parquet error: Not all children array length are the same!".to_string()) ]); } @@ -41,6 +41,7 @@ fn test_datapage_v1_uncompressed_checksum() { } #[test] +#[cfg(feature = "snap")] fn test_datapage_v1_snappy_compressed_checksum() { let errors = read_file_batch_errors("datapage_v1-snappy-compressed-checksum.parquet"); assert_eq!(errors, [Ok(()), Ok(()), Ok(()), Ok(()), Ok(())]); @@ -52,6 +53,7 @@ fn test_plain_dict_uncompressed_checksum() { assert_eq!(errors, [Ok(())]); } #[test] +#[cfg(feature = "snap")] fn test_rle_dict_snappy_checksum() { let errors = read_file_batch_errors("rle-dict-snappy-checksum.parquet"); assert_eq!(errors, [Ok(())]);