paleolimbot commented on code in PR #738:
URL: https://github.com/apache/arrow-nanoarrow/pull/738#discussion_r2892103640
##########
src/nanoarrow/ipc/decoder_test.cc:
##########
@@ -605,139 +702,6 @@ TEST(NanoarrowIpcTest, NanoarrowIpcSetDecompressor) {
ArrowIpcDecoderReset(&decoder);
}
-#if defined(NANOARROW_BUILD_TESTS_WITH_ARROW)
-class ArrowTypeParameterizedTestFixture
- : public ::testing::TestWithParam<std::shared_ptr<arrow::DataType>> {
- protected:
- std::shared_ptr<arrow::DataType> data_type;
-};
-
-TEST_P(ArrowTypeParameterizedTestFixture, NanoarrowIpcArrowTypeRoundtrip) {
Review Comment:
These are just moved because I found the order of the tests was hard to
parse with respect to where the parameter s were defined.
##########
src/nanoarrow/ipc/decoder_test.cc:
##########
@@ -871,8 +835,190 @@ TEST(NanoarrowIpcTest,
NanoarrowIpcSharedBufferThreadSafeDecode) {
// We will get a (occasional) memory leak if the atomic counter does not work
}
+TEST(NanoarrowIpcTest, NanoarrowIpcFooterDecodingErrors) {
+ struct ArrowError error;
+
+ nanoarrow::ipc::UniqueDecoder decoder;
+ ArrowIpcDecoderInit(decoder.get());
+
+ // not enough data to get the size+magic
Review Comment:
These are also just moved around
##########
src/nanoarrow/ipc/decoder_test.cc:
##########
@@ -538,6 +585,56 @@ TEST(NanoarrowIpcTest,
NanoarrowIpcDecodeSimpleRecordBatchErrors) {
ArrowIpcDecoderReset(&decoder);
}
+TEST(NanoarrowIpcTest, NanoarrowIpcDecodeDictionarySchema) {
+ struct ArrowIpcDecoder decoder;
+ struct ArrowError error;
+ struct ArrowSchema schema;
+
+ struct ArrowBufferView data;
+ data.data.as_uint8 = kDictionarySchema;
+ data.size_bytes = sizeof(kDictionarySchema);
+
+ ASSERT_EQ(ArrowIpcDecoderInit(&decoder), NANOARROW_OK);
+
+ EXPECT_EQ(ArrowIpcDecoderDecodeHeader(&decoder, data, &error), NANOARROW_OK);
+ ASSERT_EQ(decoder.message_type, NANOARROW_IPC_MESSAGE_TYPE_SCHEMA);
+
+ ASSERT_EQ(ArrowIpcDecoderDecodeSchema(&decoder, &schema, &error),
NANOARROW_OK);
+ ASSERT_EQ(schema.n_children, 1);
+ EXPECT_STREQ(schema.children[0]->name, "some_col");
+ EXPECT_EQ(schema.children[0]->flags, ARROW_FLAG_NULLABLE);
+ EXPECT_STREQ(schema.children[0]->format, "c");
+
+ ASSERT_NE(schema.children[0]->dictionary, nullptr);
+ EXPECT_STREQ(schema.children[0]->dictionary->format, "u");
Review Comment:
This is the crux of what this PR does: it can decode a schema message that
contains a dictionary instead of erroring.
--
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]