Browse Source

Verify arrow data type in `send_output`

We only support `UInt8` arrays right now.
tags/v0.2.3-rc
Philipp Oppermann 3 years ago
parent
commit
cc4acfee91
Failed to extract signature
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      apis/python/node/src/lib.rs

+ 3
- 0
apis/python/node/src/lib.rs View File

@@ -47,6 +47,9 @@ impl Node {
let data = py_bytes.as_bytes();
self.send_output_slice(output_id, data.len(), data, metadata)
} else if let Ok(arrow_array) = arrow::array::ArrayData::from_pyarrow(data.as_ref(py)) {
if arrow_array.data_type() != &arrow::datatypes::DataType::UInt8 {
eyre::bail!("only arrow arrays with data type `UInt8` are supported");
}
if arrow_array.buffers().len() != 1 {
eyre::bail!("output arrow array must contain a single buffer");
}


Loading…
Cancel
Save