Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C++] arrow::UInt64Builder::Reset() doesn't affect the builder's length() #33341

Closed
asfimport opened this issue Oct 24, 2022 · 1 comment
Closed

Comments

@asfimport
Copy link
Collaborator

Git hash of Arrow version tested:
eb01350

Steps to reproduce:
Build Arrow statically, and install to a prefix directory, {}~/arrow/cpp/release/prefix{}:

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

Build the following main file:

#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);
}

Using the following CMakeLists.txt:

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)

Expected behavior:
No assertions fire because Reset() resets the length of the builder

Actual behavior:

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

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

Note: This issue was originally created as ARROW-18146. Please see the migration documentation for further details.

@enolan-maystreet
Copy link

This issue was resolved by the fix for #33398

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants