[
https://issues.apache.org/jira/browse/ARROW-6470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16923810#comment-16923810
]
Wes McKinney commented on ARROW-6470:
-------------------------------------
If you can spare the CPU cycles it's good practice to use {{Validate}} with
various data structures as a sanity check. You can also put {{Validate}} checks
inside your own debug assertions
> [C++] Segmentation fault when trying to serialzie empty SerializeRecordBatch
> -----------------------------------------------------------------------------
>
> Key: ARROW-6470
> URL: https://issues.apache.org/jira/browse/ARROW-6470
> Project: Apache Arrow
> Issue Type: Bug
> Components: C++
> Affects Versions: 0.13.0
> Reporter: Wamsi Viswanath
> Priority: Major
>
> Below is a simple reproducible example, please let me know if the behavior is
> valid:
> ```
> #include <arrow/api.h>
> #include <arrow/io/memory.h>
> #include <arrow/ipc/api.h>
> #include <cstdio>
> #include <iostream>
> int main()
> { std::shared_ptr<arrow::Schema> schema =
> arrow::schema(\\{arrow::field("int_", arrow::int32(), false)}
> );
> std::vector<std::shared_ptr<arrow::Array>> arrays = {};
> std::shared_ptr<arrow::RecordBatch> record_batch =
> arrow::RecordBatch::Make(schema, arrays[0]->length(), arrays);
> std::shared_ptr<arrow::Buffer> serialized_buffer;
> if (!arrow::ipc::SerializeRecordBatch(
> *record_batch, arrow::default_memory_pool(), &serialized_buffer)
> .ok())
> { throw std::runtime_error("Error: Serializing Records."); }
> }
> ```
--
This message was sent by Atlassian Jira
(v8.3.2#803003)