Re: [C++] 0x00 in Binary type

2020-11-18 Thread Micah Kornfield
+1 to what Francois said. You either want to use the method that takes a length or string_view for this case: https://github.com/apache/arrow/blob/843e8bb556a03f0e4c18841a623d1a0e9c236ee5/cpp/src/arrow/array/builder_binary.h#L72 On Wed, Nov 18, 2020 at 11:05 AM Francois Saint-Jacques <

Re: [C++] 0x00 in Binary type

2020-11-18 Thread Francois Saint-Jacques
I would say at first sight that it's due to your usage of char[] and builder.Append(d) implicitly does a strlen. François On Wed, Nov 18, 2020 at 2:00 PM Ying Zhou wrote: > > Sure! > > BinaryBuilder builder; > char d[] = "\x00\x01\xbf\x5b”; > (void)(builder.Append(d)); > std::shared_ptr array;

Re: [C++] 0x00 in Binary type

2020-11-18 Thread Ying Zhou
Sure! BinaryBuilder builder; char d[] = "\x00\x01\xbf\x5b”; (void)(builder.Append(d)); std::shared_ptr array; (void)(builder.Finish()); int32_t dataLength = 0; auto aarray = std::static_pointer_cast(array); const uint8_t* data = aarray->GetValue(0, ); data = aarray->GetValue(3, );

Re: [C++] 0x00 in Binary type

2020-11-18 Thread Antoine Pitrou
Hello, Le 18/11/2020 à 19:06, Ying Zhou a écrit : > > According to the documentation BINARY is "Variable-length bytes (no guarantee > of UTF8-ness)”. However in practice if I embed 0x00 in the middle of a char > array and Append it to a BinaryBuilder the 0x00 is converted to 0xff, >

[C++] 0x00 in Binary type

2020-11-18 Thread Ying Zhou
Hello, According to the documentation BINARY is "Variable-length bytes (no guarantee of UTF8-ness)”. However in practice if I embed 0x00 in the middle of a char array and Append it to a BinaryBuilder the 0x00 is converted to 0xff, everything after it is not appended and the length is computed