timsaucer commented on code in PR #825:
URL: https://github.com/apache/datafusion-python/pull/825#discussion_r1730293176
##########
src/context.rs:
##########
@@ -471,18 +474,31 @@ impl PySessionContext {
name: Option<&str>,
py: Python,
) -> PyResult<PyDataFrame> {
- // Instantiate pyarrow Table object & convert to batches
- let table = data.call_method0("to_batches")?;
+ let (schema, batches) =
+ if let Ok(stream_reader) =
ArrowArrayStreamReader::from_pyarrow_bound(&data) {
+ // Works for any object that implements __arrow_c_stream__ in
pycapsule.
+
+ let schema = stream_reader.schema().as_ref().to_owned();
Review Comment:
`create_dataframe` below this does require a `Schema`. Well, really it needs
an `Option<PyArrowType<Schema>>` which needs ownership.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]