lidavidm commented on code in PR #115:
URL: https://github.com/apache/arrow-nanoarrow/pull/115#discussion_r1114945084
##########
extensions/nanoarrow_ipc/src/nanoarrow/nanoarrow_ipc_test.cc:
##########
@@ -168,3 +169,58 @@ TEST(NanoarrowIpcTest, NanoarrowIpcDecodeSimpleSchema) {
ArrowIpcReaderReset(&reader);
}
+
+class ArrowTypeParameterizedTestFixture
+ : public ::testing::TestWithParam<std::shared_ptr<arrow::DataType>> {
+ protected:
+ std::shared_ptr<arrow::DataType> data_type;
+};
+
+TEST_P(ArrowTypeParameterizedTestFixture, NanoarrowIpcArrowTypeRoundtrip) {
+ const std::shared_ptr<arrow::DataType>& data_type = GetParam();
+ std::shared_ptr<arrow::Schema> dummy_schema =
+ arrow::schema({arrow::field("dummy_name", data_type)});
+ auto maybe_serialized = arrow::ipc::SerializeSchema(*dummy_schema);
+ ASSERT_TRUE(maybe_serialized.ok());
+
+ struct ArrowBufferView buffer_view;
+ buffer_view.data.data = maybe_serialized.ValueUnsafe()->data();
+ buffer_view.size_bytes = maybe_serialized.ValueOrDie()->size();
+
+ struct ArrowIpcReader reader;
+ ArrowIpcReaderInit(&reader);
+ ASSERT_EQ(ArrowIpcReaderVerify(&reader, buffer_view, nullptr), NANOARROW_OK);
+ EXPECT_EQ(reader.header_size_bytes, buffer_view.size_bytes);
+ EXPECT_EQ(reader.body_size_bytes, 0);
+
+ ASSERT_EQ(ArrowIpcReaderDecode(&reader, buffer_view, nullptr), NANOARROW_OK);
+ auto maybe_schema = arrow::ImportSchema(&reader.schema);
+ ASSERT_TRUE(maybe_schema.ok());
+ EXPECT_TRUE(maybe_schema.ValueUnsafe()->Equals(dummy_schema));
+
+ ArrowIpcReaderReset(&reader);
+}
+
+INSTANTIATE_TEST_SUITE_P(
+ NanoarrowIpcTest, ArrowTypeParameterizedTestFixture,
+ ::testing::Values(
+ arrow::null(), arrow::boolean(), arrow::int8(), arrow::uint8(),
arrow::int16(),
+ arrow::uint16(), arrow::int32(), arrow::uint32(), arrow::int64(),
arrow::uint64(),
+ arrow::utf8(), arrow::float16(), arrow::float32(), arrow::float64(),
+ arrow::decimal128(10, 3), arrow::decimal256(10, 3),
arrow::large_utf8(),
+ arrow::binary(), arrow::large_binary(), arrow::fixed_size_binary(123),
+ arrow::date32(), arrow::date64(),
arrow::time32(arrow::TimeUnit::SECOND),
+ arrow::time32(arrow::TimeUnit::MILLI),
arrow::time64(arrow::TimeUnit::MICRO),
+ arrow::time64(arrow::TimeUnit::NANO),
arrow::timestamp(arrow::TimeUnit::SECOND),
+ arrow::timestamp(arrow::TimeUnit::MILLI),
+ arrow::timestamp(arrow::TimeUnit::MICRO),
arrow::timestamp(arrow::TimeUnit::NANO),
+ arrow::timestamp(arrow::TimeUnit::SECOND, "UTC"),
+ arrow::duration(arrow::TimeUnit::SECOND),
arrow::duration(arrow::TimeUnit::MILLI),
+ arrow::duration(arrow::TimeUnit::MICRO),
arrow::duration(arrow::TimeUnit::NANO),
+ arrow::month_interval(), arrow::day_time_interval(),
+ arrow::month_day_nano_interval(),
+ arrow::list(arrow::field("some_custom_name", arrow::int32())),
+ arrow::large_list(arrow::field("some_custom_name", arrow::int32())),
+ arrow::fixed_size_list(arrow::field("some_custom_name",
arrow::int32()), 123),
+ arrow::struct_({arrow::field("col1", arrow::int32()),
Review Comment:
Ah, now I see the last commit message
--
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]