You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Wes McKinney (Jira)" <ji...@apache.org> on 2019/09/05 23:06:00 UTC
[jira] [Closed] (ARROW-6470) [C++] Segmentation fault when trying
to serialzie empty SerializeRecordBatch
[ https://issues.apache.org/jira/browse/ARROW-6470?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Wes McKinney closed ARROW-6470.
-------------------------------
Resolution: Fixed
The RecordBatch you constructed is invalid since you pass a length-0 list of fields when you schema has one field. If you call {{record_batch->Validate()}} it will return error Status. We have debug assertions which check for this but these assertions are not run in release builds
> [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)