Skip to content

Commit

Permalink
chore(rust): fix some features (#11529)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 authored Oct 5, 2023
1 parent ef7236b commit 187b951
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion crates/polars-io/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ serde_json = { version = "1", default-features = false, features = ["alloc", "ra
simd-json = { workspace = true, optional = true }
simdutf8 = { workspace = true, optional = true }
smartstring = { workspace = true }
tokio = { workspace = true, features = ["net", "rt-multi-thread"], optional = true }
tokio = { workspace = true, features = ["net", "rt-multi-thread", "time"], optional = true }
tokio-util = { workspace = true, features = ["io", "io-util"], optional = true }
url = { workspace = true, optional = true }

Expand Down
8 changes: 4 additions & 4 deletions crates/polars-io/src/cloud/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use object_store::azure::MicrosoftAzureBuilder;
use object_store::gcp::GoogleCloudStorageBuilder;
#[cfg(feature = "gcp")]
pub use object_store::gcp::GoogleConfigKey;
#[cfg(feature = "async")]
#[cfg(feature = "cloud")]
use object_store::ObjectStore;
#[cfg(any(feature = "aws", feature = "gcp", feature = "azure"))]
use object_store::{BackoffConfig, RetryConfig};
Expand All @@ -26,7 +26,7 @@ use polars_utils::cache::FastFixedCache;
use serde::{Deserialize, Serialize};
#[cfg(feature = "aws")]
use smartstring::alias::String as SmartString;
#[cfg(feature = "async")]
#[cfg(feature = "cloud")]
use url::Url;

#[cfg(feature = "aws")]
Expand Down Expand Up @@ -85,7 +85,7 @@ pub enum CloudType {
impl FromStr for CloudType {
type Err = PolarsError;

#[cfg(feature = "async")]
#[cfg(feature = "cloud")]
fn from_str(url: &str) -> Result<Self, Self::Err> {
let parsed = Url::parse(url).map_err(to_compute_err)?;
Ok(match parsed.scheme() {
Expand All @@ -97,7 +97,7 @@ impl FromStr for CloudType {
})
}

#[cfg(not(feature = "async"))]
#[cfg(not(feature = "cloud"))]
fn from_str(_s: &str) -> Result<Self, Self::Err> {
polars_bail!(ComputeError: "at least one of the cloud features must be enabled");
}
Expand Down
8 changes: 4 additions & 4 deletions crates/polars-io/src/parquet/read_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use rayon::prelude::*;

use super::mmap::ColumnStore;
use crate::mmap::{MmapBytesReader, ReaderBytes};
#[cfg(feature = "async")]
#[cfg(feature = "cloud")]
use crate::parquet::async_impl::FetchRowGroupsFromObjectStore;
use crate::parquet::mmap::mmap_columns;
use crate::parquet::predicates::read_this_row_group;
Expand Down Expand Up @@ -375,12 +375,12 @@ impl FetchRowGroupsFromMmapReader {
// We couldn't use a trait as async trait gave very hard HRT lifetime errors.
// Maybe a puzzle for another day.
pub enum RowGroupFetcher {
#[cfg(feature = "async")]
#[cfg(feature = "cloud")]
ObjectStore(FetchRowGroupsFromObjectStore),
Local(FetchRowGroupsFromMmapReader),
}

#[cfg(feature = "async")]
#[cfg(feature = "cloud")]
impl From<FetchRowGroupsFromObjectStore> for RowGroupFetcher {
fn from(value: FetchRowGroupsFromObjectStore) -> Self {
RowGroupFetcher::ObjectStore(value)
Expand All @@ -397,7 +397,7 @@ impl RowGroupFetcher {
async fn fetch_row_groups(&mut self, _row_groups: Range<usize>) -> PolarsResult<ColumnStore> {
match self {
RowGroupFetcher::Local(f) => f.fetch_row_groups(_row_groups).await,
#[cfg(feature = "async")]
#[cfg(feature = "cloud")]
RowGroupFetcher::ObjectStore(f) => f.fetch_row_groups(_row_groups).await,
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-pipe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ version_check = { workspace = true }
[features]
csv = ["polars-plan/csv", "polars-io/csv"]
cloud = ["async", "polars-io/cloud", "polars-plan/cloud", "tokio"]
parquet = ["polars-plan/parquet", "polars-io/parquet"]
parquet = ["polars-plan/parquet", "polars-io/parquet", "polars-io/async"]
ipc = ["polars-plan/ipc", "polars-io/ipc"]
async = ["polars-plan/async", "polars-io/async"]
nightly = ["polars-core/nightly", "polars-utils/nightly", "hashbrown/nightly"]
Expand Down
1 change: 1 addition & 0 deletions crates/polars-pipe/src/executors/sinks/file_sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::thread::JoinHandle;

use crossbeam_channel::{bounded, Receiver, Sender};
use polars_core::prelude::*;
#[cfg(feature = "csv")]
use polars_io::csv::CsvWriter;
#[cfg(feature = "parquet")]
use polars_io::parquet::ParquetWriter;
Expand Down

0 comments on commit 187b951

Please sign in to comment.