diff --git a/daft/table/schema_inference.py b/daft/table/schema_inference.py index c9b06e651b..28488defe8 100644 --- a/daft/table/schema_inference.py +++ b/daft/table/schema_inference.py @@ -89,7 +89,6 @@ def from_parquet( assert isinstance( file, (str, pathlib.Path) ), "Native downloader only works on string inputs to read_parquet" - assert isinstance(file, (str, pathlib.Path)) io_config = config.io_config return Schema.from_parquet(str(file), io_config=io_config) diff --git a/src/daft-plan/src/source_info/storage_config.rs b/src/daft-plan/src/source_info/storage_config.rs index e8a082ad01..5f6ebe338d 100644 --- a/src/daft-plan/src/source_info/storage_config.rs +++ b/src/daft-plan/src/source_info/storage_config.rs @@ -17,67 +17,6 @@ use { std::hash::{Hash, Hasher}, }; -#[derive(Clone, Debug, Serialize, Deserialize)] -#[serde(transparent)] -#[cfg_attr( - feature = "python", - pyclass(module = "daft.daft", name = "StorageConfig") -)] -pub struct PyStorageConfig(Arc); - -#[cfg(feature = "python")] -#[pymethods] -impl PyStorageConfig { - #[new] - #[pyo3(signature = (*args))] - pub fn new(args: &PyTuple) -> PyResult { - match args.len() { - // Create dummy inner StorageConfig, to be overridden by __setstate__. - 0 => Ok(Arc::new(StorageConfig::Native( - NativeStorageConfig::new_internal(None).into(), - )) - .into()), - _ => Err(PyValueError::new_err(format!( - "expected no arguments to make new PyStorageConfig, got : {}", - args.len() - ))), - } - } - #[staticmethod] - fn native(config: NativeStorageConfig) -> Self { - Self(Arc::new(StorageConfig::Native(config.into()))) - } - - #[staticmethod] - fn python(config: PythonStorageConfig) -> Self { - Self(Arc::new(StorageConfig::Python(config))) - } - - #[getter] - fn get_config(&self, py: Python) -> PyObject { - use StorageConfig::*; - - match self.0.as_ref() { - Native(config) => config.as_ref().clone().into_py(py), - Python(config) => config.clone().into_py(py), - } - } -} - -impl_bincode_py_state_serialization!(PyStorageConfig); - -impl From for Arc { - fn from(value: PyStorageConfig) -> Self { - value.0 - } -} - -impl From> for PyStorageConfig { - fn from(value: Arc) -> Self { - Self(value) - } -} - #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Hash)] pub enum StorageConfig { Native(Arc), @@ -162,3 +101,64 @@ impl Hash for PythonStorageConfig { } } } + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(transparent)] +#[cfg_attr( + feature = "python", + pyclass(module = "daft.daft", name = "StorageConfig") +)] +pub struct PyStorageConfig(Arc); + +#[cfg(feature = "python")] +#[pymethods] +impl PyStorageConfig { + #[new] + #[pyo3(signature = (*args))] + pub fn new(args: &PyTuple) -> PyResult { + match args.len() { + // Create dummy inner StorageConfig, to be overridden by __setstate__. + 0 => Ok(Arc::new(StorageConfig::Native( + NativeStorageConfig::new_internal(None).into(), + )) + .into()), + _ => Err(PyValueError::new_err(format!( + "expected no arguments to make new PyStorageConfig, got : {}", + args.len() + ))), + } + } + #[staticmethod] + fn native(config: NativeStorageConfig) -> Self { + Self(Arc::new(StorageConfig::Native(config.into()))) + } + + #[staticmethod] + fn python(config: PythonStorageConfig) -> Self { + Self(Arc::new(StorageConfig::Python(config))) + } + + #[getter] + fn get_config(&self, py: Python) -> PyObject { + use StorageConfig::*; + + match self.0.as_ref() { + Native(config) => config.as_ref().clone().into_py(py), + Python(config) => config.clone().into_py(py), + } + } +} + +impl_bincode_py_state_serialization!(PyStorageConfig); + +impl From for Arc { + fn from(value: PyStorageConfig) -> Self { + value.0 + } +} + +impl From> for PyStorageConfig { + fn from(value: Arc) -> Self { + Self(value) + } +}