Skip to content

Commit 3b95a1d

Browse files
committed
fix: add support for PyDataFrame extraction in PySchema implementation
1 parent b780838 commit 3b95a1d

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/catalog.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
use crate::dataframe::PyDataFrame;
1819
use crate::dataset::Dataset;
1920
use crate::errors::{py_datafusion_err, to_datafusion_err, PyDataFusionError, PyDataFusionResult};
2021
use crate::table::PyTableProvider;
@@ -203,6 +204,12 @@ impl PySchema {
203204
py_table.table
204205
} else if let Ok(py_provider) = table_provider.extract::<PyTableProvider>() {
205206
py_provider.into_inner()
207+
} else if table_provider.extract::<PyDataFrame>().is_ok() {
208+
return Err(PyDataFusionError::Common(
209+
"Expected a Table or TableProvider. Convert DataFrames with \"DataFrame.into_view()\" or \"TableProvider.from_dataframe()\"."
210+
.to_string(),
211+
)
212+
.into());
206213
} else if let Some(provider) = table_provider_from_pycapsule(&table_provider)? {
207214
provider
208215
} else {

0 commit comments

Comments
 (0)