| 139 | } |
| 140 | |
| 141 | fn register_batch(&self, name: String, batch: Bound<'_, PyAny>) -> PyResult<()> { |
| 142 | let batch = datafusion::arrow::record_batch::RecordBatch::from_pyarrow_bound(&batch)?; |
| 143 | let schema = batch.schema(); |
| 144 | let mem_table = datafusion::datasource::MemTable::try_new(schema, vec![vec![batch]]) |
| 145 | .map_err(df_to_py_err)?; |
| 146 | self.inner |
| 147 | .register_temp_table(&name, Arc::new(mem_table)) |
| 148 | .map_err(df_to_py_err) |
| 149 | } |
| 150 | |
| 151 | fn sql(&self, py: Python<'_>, sql: String) -> PyResult<Vec<Py<PyAny>>> { |
| 152 | let rt = runtime(); |