You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Edward Nolan (Jira)" <ji...@apache.org> on 2022/10/24 21:22:00 UTC

[jira] [Created] (ARROW-18146) [C++] arrow::UInt64Builder::Reset() doesn't affect the builder's length()

Edward Nolan created ARROW-18146:
------------------------------------

             Summary: [C++] arrow::UInt64Builder::Reset() doesn't affect the builder's length()
                 Key: ARROW-18146
                 URL: https://issues.apache.org/jira/browse/ARROW-18146
             Project: Apache Arrow
          Issue Type: Bug
          Components: C++
         Environment: OS: Ubuntu 22.04

Linux ed-ubuntu-pc 5.15.0-47-generic #51-Ubuntu SMP Thu Aug 11 07:51:15 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Compiler: c++ (Ubuntu 11.2.0-19ubuntu1) 11.2.0
            Reporter: Edward Nolan


Git hash of Arrow version tested:
eb01350b1a6e4588df4653495fb962065409250b

Steps to reproduce:
Build Arrow and Parquet statically, and install to a prefix directory, {{{}~/arrow/cpp/release/prefix{}}}:
{code:java}
cd
git clone https://github.com/apache/arrow.git
cd arrow/cpp/
mkdir release
cd release
cmake -DARROW_BUILD_SHARED=OFF -DARROW_BUILD_STATIC=ON -DCMAKE_CXX_STANDARD=17 -DARROW_DEPENDENCY_SOURCE=BUNDLED ..
make -j32
mkdir prefix
make DESTDIR=prefix install{code}
Build the following main file:
{code:cpp}
#include <arrow/array/builder_primitive.h>
#include <cassert>

int main(int, char**) {
  arrow::UInt64Builder foo{};
  assert(foo.length() == 0);
  (void)foo.Append(123);
  assert(foo.length() == 1);
  foo.Reset();
  assert(foo.length() == 0);
}
{code}
Using the following CMakeLists.txt:
{code:java}
project("arrowresetbug")

set(ARROW_HOME "/home/enolan/arrow/cpp/release/prefix/usr/local")
find_package(Arrow CONFIG PATHS "/home/enolan/arrow/cpp/release/prefix/usr/local/lib/cmake/Arrow" NO_DEFAULT_PATH REQUIRED)

set(CMAKE_CXX_FLAGS "-std=c++17")

add_executable(main main.cpp)

target_link_libraries(main arrow_static)
{code}
Expected behavior:
No assertions fire because Reset() resets the length of the builder

Actual behavior:
{code:java}
main: /home/enolan/stuff/2022-10/arrowresetbug/main.cpp:10: int main(int, char**): Assertion `foo.length() == 0' failed.
Aborted (core dumped) {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)