WillAyd commented on code in PR #658:
URL: https://github.com/apache/arrow-adbc/pull/658#discussion_r1186725646
##########
c/driver/postgresql/postgresql_test.cc:
##########
@@ -97,6 +96,63 @@ class PostgresConnectionTest : public ::testing::Test,
protected:
PostgresQuirks quirks_;
};
+
+TEST_F(PostgresConnectionTest, GetInfoMetadata) {
+ ASSERT_THAT(AdbcConnectionNew(&connection, &error), IsOkStatus(&error));
+ ASSERT_THAT(AdbcConnectionInit(&connection, &database, &error),
IsOkStatus(&error));
+
+ adbc_validation::StreamReader reader;
+ std::vector<uint32_t> info = {
+ ADBC_INFO_DRIVER_NAME,
+ ADBC_INFO_DRIVER_VERSION,
+ ADBC_INFO_VENDOR_NAME,
+ ADBC_INFO_VENDOR_VERSION,
+ };
+ ASSERT_THAT(AdbcConnectionGetInfo(&connection, info.data(), info.size(),
+ &reader.stream.value, &error),
+ IsOkStatus(&error));
+ ASSERT_NO_FATAL_FAILURE(reader.GetSchema());
+
+ std::vector<uint32_t> seen;
+ while (true) {
+ ASSERT_NO_FATAL_FAILURE(reader.Next());
+ if (!reader.array->release) break;
+
+ for (int64_t row = 0; row < reader.array->length; row++) {
+ ASSERT_FALSE(ArrowArrayViewIsNull(reader.array_view->children[0], row));
+ const uint32_t code =
+ reader.array_view->children[0]->buffer_views[1].data.as_uint32[row];
+ seen.push_back(code);
+
+ switch (code) {
+ case ADBC_INFO_DRIVER_NAME: {
+ const char* expected = "ADBC PostgreSQL Driver";
Review Comment:
This test is way too deep in the implementation details of the dense union,
but I didn't see a better way of reading values from that union with nanoarrow.
Is there something I am overlooking or would this need to be implemented
upstream?
--
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]