Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(c/driver/postgresql): Inital COPY Writer design #1110

Merged
merged 14 commits into from
Sep 28, 2023
Prev Previous commit
Next Next commit
use expect instead of assert
  • Loading branch information
WillAyd committed Sep 27, 2023
commit 897248e5dfad5f02e865386036f2785f10a7f387
3 changes: 2 additions & 1 deletion c/driver/postgresql/postgres_copy_reader_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,13 @@ TEST(PostgresCopyUtilsTest, PostgresCopyWriteBoolean) {
ArrowBufferInit(&buffer);
ArrowBufferReserve(&buffer, sizeof(kTestPgCopyBoolean));
uint8_t* cursor = buffer.data;

ASSERT_EQ(tester.WriteAll(&buffer, nullptr), ENODATA);

// The last 4 bytes of a message can be transmitted via PQputCopyData
// so no need to test those bytes from the Writer
for (size_t i = 0; i < sizeof(kTestPgCopyBoolean) - 4; i++) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ultimately when we implement this in statement.cc I imagine we will build the buffer (maybe even in chunks) and send that via PQputCopyData . When all is said and done we would then do a PQputCopyEnd to send the last 4 bytes. Maybe we should make the end message a constant in the tests so it is clear what is part of the "data" versus the sentinel signaling the end of the buffer

ASSERT_EQ(cursor[i], kTestPgCopyBoolean[i]);
EXPECT_EQ(cursor[i], kTestPgCopyBoolean[i]);
}

buffer.data = cursor;
Expand Down
Loading