MCPcopy Create free account
hub / github.com/apache/arrow / garrow_output_stream_write_tensor

Function garrow_output_stream_write_tensor

c_glib/arrow-glib/output-stream.cpp:205–223  ·  view source on GitHub ↗

* garrow_output_stream_write_tensor: * @stream: A #GArrowOutputStream. * @tensor: A #GArrowTensor to be written. * @error: (nullable): Return location for a #GError or %NULL. * * Returns: The number of written bytes on success, -1 on error. * * Since: 0.4.0 */

Source from the content-addressed store, hash-verified

203 * Since: 0.4.0
204 */
205gint64
206garrow_output_stream_write_tensor(GArrowOutputStream *stream,
207 GArrowTensor *tensor,
208 GError **error)
209{
210 auto arrow_stream = garrow_output_stream_get_raw(stream);
211 auto arrow_tensor = garrow_tensor_get_raw(tensor);
212 int32_t metadata_length;
213 int64_t body_length;
214 auto status = arrow::ipc::WriteTensor(*arrow_tensor,
215 arrow_stream.get(),
216 &metadata_length,
217 &body_length);
218 if (garrow::check(error, status, "[output-stream][write-tensor]")) {
219 return metadata_length + body_length;
220 } else {
221 return -1;
222 }
223}
224
225/**
226 * garrow_output_stream_write_record_batch:

Callers

nothing calls this directly

Calls 5

garrow_tensor_get_rawFunction · 0.85
WriteTensorFunction · 0.85
checkFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected