Skip to content

Commit

Permalink
pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
wjones127 committed Jan 31, 2025
1 parent fbfed9d commit e208df6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
1 change: 1 addition & 0 deletions rust/lance-core/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub mod deletion;
pub mod futures;
pub mod hash;
pub mod mask;
pub mod parse;

Check failure on line 11 in rust/lance-core/src/utils.rs

View workflow job for this annotation

GitHub Actions / linux-build (nightly)

file not found for module `parse`
pub mod path;
pub mod testing;
pub mod tokio;
Expand Down
9 changes: 1 addition & 8 deletions rust/lance-io/src/object_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use bytes::Bytes;
use chrono::{DateTime, Utc};
use deepsize::DeepSizeOf;
use futures::{future, stream::BoxStream, StreamExt, TryStreamExt};
use lance_core::utils::parse::str_is_truthy;
use lance_core::utils::tokio::get_num_compute_intensive_cpus;
use object_store::aws::{
AmazonS3ConfigKey, AwsCredential as ObjectStoreAwsCredential, AwsCredentialProvider,
Expand Down Expand Up @@ -1039,14 +1040,6 @@ fn infer_block_size(scheme: &str) -> usize {
}
}

fn str_is_truthy(val: &str) -> bool {
val.eq_ignore_ascii_case("1")
| val.eq_ignore_ascii_case("true")
| val.eq_ignore_ascii_case("on")
| val.eq_ignore_ascii_case("yes")
| val.eq_ignore_ascii_case("y")
}

/// Attempt to create a Url from given table location.
///
/// The location could be:
Expand Down
12 changes: 3 additions & 9 deletions rust/lance/src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use arrow_schema::DataType;
use async_trait::async_trait;
use futures::{stream, StreamExt, TryStreamExt};
use itertools::Itertools;
use lance_core::utils::parse::str_is_truthy;
use lance_file::reader::FileReader;
use lance_file::v2;
use lance_file::v2::reader::FileReaderOptions;
Expand Down Expand Up @@ -70,15 +71,8 @@ use self::vector::{build_vector_index, VectorIndexParams, LANCE_VECTOR_INDEX};

// Whether to auto-migrate a dataset when we encounter corruption.
fn auto_migrate_corruption() -> bool {
static MAX_CONN_RESET_RETRIES: OnceLock<bool> = OnceLock::new();
fn str_is_truthy(val: &str) -> bool {
val.eq_ignore_ascii_case("1")
| val.eq_ignore_ascii_case("true")
| val.eq_ignore_ascii_case("on")
| val.eq_ignore_ascii_case("yes")
| val.eq_ignore_ascii_case("y")
}
*MAX_CONN_RESET_RETRIES.get_or_init(|| {
static LANCE_AUTO_MIGRATION: OnceLock<bool> = OnceLock::new();
*LANCE_AUTO_MIGRATION.get_or_init(|| {
std::env::var("LANCE_AUTO_MIGRATION")
.ok()
.map(|s| str_is_truthy(&s))
Expand Down

0 comments on commit e208df6

Please sign in to comment.