[
https://issues.apache.org/jira/browse/ARROW-14065?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated ARROW-14065:
-----------------------------------
Labels: pull-request-available (was: )
> [C++] FixedSizeBinaryBuilder behaves incorrectly since v5.0 with
> "Resize+Advance" operation
> -------------------------------------------------------------------------------------------
>
> Key: ARROW-14065
> URL: https://issues.apache.org/jira/browse/ARROW-14065
> Project: Apache Arrow
> Issue Type: Bug
> Components: C++
> Affects Versions: 5.0.0
> Reporter: Tao He
> Priority: Major
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> With the following code, we first "Resize" a builder, then fill the content,
> and finally use "Advance" to move the pointer to the end,
> ```cpp
> #include <iostream>
> #include <memory>
> #include "arrow/array/array_binary.h"
> #include "arrow/array/builder_binary.h"
> #include "arrow/status.h"
> #include "arrow/util/config.h"
> int main(int argc, char** argv) {
> struct S {
> int64_t a;
> double b;
> };
> arrow::FixedSizeBinaryBuilder b1(arrow::fixed_size_binary(sizeof(S)));
> arrow::FixedSizeBinaryBuilder b4(arrow::fixed_size_binary(sizeof(S)));
> b4.Resize(10);
> // ... fill the array data in random-access fashion ...
> b4.Advance(10);
> std::shared_ptr<arrow::FixedSizeBinaryArray> a4;
> b4.Finish(&a4);
> std::cout << "array length: " << a4->length() << std::endl;
> std::cout << "buffer size: " << a4->values()->size() << std::endl;
> return 0;
> }
> ```
> The output is 10 and 160 with arrow 4.0 (which is desired behavior) however
> arrow 5.0 yields 10 and 0, which means the length of array is not 0 but the
> underlying buffer is a null pointer.
> The same error doesn't happen to other types, e.g., IntBuilders.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)