You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by li...@apache.org on 2023/06/16 01:20:31 UTC
[arrow-adbc] branch main updated: feat(c/driver/postgresql): Binary ingest (#808)
This is an automated email from the ASF dual-hosted git repository.
lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git
The following commit(s) were added to refs/heads/main by this push:
new 3f12011f feat(c/driver/postgresql): Binary ingest (#808)
3f12011f is described below
commit 3f12011fe6c70ab24fd708ecbe8cc2e15a2ca729
Author: William Ayd <wi...@icloud.com>
AuthorDate: Thu Jun 15 18:20:25 2023 -0700
feat(c/driver/postgresql): Binary ingest (#808)
---
c/driver/postgresql/postgresql_test.cc | 1 -
c/driver/postgresql/statement.cc | 10 +++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/c/driver/postgresql/postgresql_test.cc b/c/driver/postgresql/postgresql_test.cc
index 15403384..eed03fa9 100644
--- a/c/driver/postgresql/postgresql_test.cc
+++ b/c/driver/postgresql/postgresql_test.cc
@@ -469,7 +469,6 @@ class PostgresStatementTest : public ::testing::Test,
void TestSqlIngestUInt16() { GTEST_SKIP() << "Not implemented"; }
void TestSqlIngestUInt32() { GTEST_SKIP() << "Not implemented"; }
void TestSqlIngestUInt64() { GTEST_SKIP() << "Not implemented"; }
- void TestSqlIngestBinary() { GTEST_SKIP() << "Not implemented"; }
void TestSqlPrepareErrorParamCountMismatch() { GTEST_SKIP() << "Not yet implemented"; }
void TestSqlPrepareGetParameterSchema() { GTEST_SKIP() << "Not yet implemented"; }
diff --git a/c/driver/postgresql/statement.cc b/c/driver/postgresql/statement.cc
index d052a06c..30920467 100644
--- a/c/driver/postgresql/statement.cc
+++ b/c/driver/postgresql/statement.cc
@@ -211,6 +211,10 @@ struct BindStream {
type_id = PostgresTypeId::kText;
param_lengths[i] = 0;
break;
+ case ArrowType::NANOARROW_TYPE_BINARY:
+ type_id = PostgresTypeId::kBytea;
+ param_lengths[i] = 0;
+ break;
default:
SetError(error, "%s%" PRIu64 "%s%s%s%s", "[libpq] Field #",
static_cast<uint64_t>(i + 1), " ('", bind_schema->children[i]->name,
@@ -316,7 +320,8 @@ struct BindStream {
std::memcpy(param_values[col], &value, sizeof(uint64_t));
break;
}
- case ArrowType::NANOARROW_TYPE_STRING: {
+ case ArrowType::NANOARROW_TYPE_STRING:
+ case ArrowType::NANOARROW_TYPE_BINARY: {
const ArrowBufferView view =
ArrowArrayViewGetBytesUnsafe(array_view->children[col], row);
// TODO: overflow check?
@@ -589,6 +594,9 @@ AdbcStatusCode PostgresStatement::CreateBulkTable(
case ArrowType::NANOARROW_TYPE_STRING:
create += " TEXT";
break;
+ case ArrowType::NANOARROW_TYPE_BINARY:
+ create += " BYTEA";
+ break;
default:
// TODO: data type to string
SetError(error, "%s%" PRIu64 "%s%s%s%ud", "[libpq] Field #",