From 563c1a963a35e2a301f1aca938c41abbf5570389 Mon Sep 17 00:00:00 2001 From: Sammy Sidhu Date: Sun, 24 Sep 2023 16:05:30 -0700 Subject: [PATCH] do comparision for fs --- daft/filesystem.py | 3 ++- src/daft-io/src/lib.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/daft/filesystem.py b/daft/filesystem.py index 45f36c21e8..86849b66c5 100644 --- a/daft/filesystem.py +++ b/daft/filesystem.py @@ -102,9 +102,10 @@ def get_filesystem(protocol: str, **kwargs) -> fsspec.AbstractFileSystem: def get_protocol_from_path(path: str) -> str: parsed_scheme = urllib.parse.urlparse(path, allow_fragments=False).scheme + parsed_scheme = parsed_scheme.lower() if parsed_scheme == "" or parsed_scheme is None: return "file" - if sys.platform == "win32" and len(parsed_scheme) == 1 and parsed_scheme in string.ascii_letters: + if sys.platform == "win32" and len(parsed_scheme) == 1 and ('a' <= parsed_scheme) and (parsed_scheme <= 'z'): return "file" return parsed_scheme diff --git a/src/daft-io/src/lib.rs b/src/daft-io/src/lib.rs index a416f16b3f..4f772ddee7 100644 --- a/src/daft-io/src/lib.rs +++ b/src/daft-io/src/lib.rs @@ -251,7 +251,7 @@ fn parse_url(input: &str) -> Result<(SourceType, Cow<'_, str>)> { "az" | "abfs" => Ok((SourceType::AzureBlob, fixed_input)), "gcs" | "gs" => Ok((SourceType::GCS, fixed_input)), #[cfg(target_env = "msvc")] - _ if scheme.len() == 1 => k((SourceType::File, Cow::Owned(format!("file://{input}")))), + _ if scheme.len() == 1 && ("a" <= scheme.as_str() && (scheme.as_str() <= "z")) => Ok((SourceType::File, Cow::Owned(format!("file://{input}")))), _ => Err(Error::NotImplementedSource { store: scheme }), } }