rustyconover commented on code in PR #966:
URL: https://github.com/apache/arrow-nanoarrow/pull/966#discussion_r4296625620
##########
src/nanoarrow/ipc/writer_test.cc:
##########
@@ -726,3 +726,91 @@ TEST(NanoarrowIpcWriter, CompressedDictionaryStream) {
EXPECT_EQ(std::string(v0.data, v0.size_bytes), "foo");
EXPECT_EQ(std::string(v1.data, v1.size_bytes), "bar");
}
+
+TEST(NanoarrowIpcWriter, RoundtripEmptyArraysHaveZeroOffset) {
+ // nanoarrow's encoder writes a zero-length offsets buffer for an empty
array (as IPC
+ // permits). Decoded arrays must still export offsets[0] == 0 through the C
data
+ // interface, which carries no buffer sizes, whether or not the body is
shared.
+ struct ArrowError error;
Review Comment:
Moved. `ArrayTestFinishBuildingEmptyArrayOffsets` in `array_test.cc` checks
`ArrowArrayFinishBuildingDefault()` on empty string, large binary and list
arrays, both when the offsets buffer was never allocated and when it has 0
bytes over storage filled with `0xff`. The IPC case is now
`NanoarrowIpcDecodeEmptyArrayOffsets` in `decoder_test.cc`. It uses a record
batch bytes fixture (one row of `struct<l: list<string>, i: int32>`, with the
schema built in code) where the empty string array's 0-byte offsets buffer sits
at the same body offset as `i`'s data, `0x55555555`. It decodes with both a
borrowed and a shared body. Both tests fail on `main`. I removed the round-trip
test from `writer_test.cc`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]