This is an automated email from the ASF dual-hosted git repository.
kou pushed a commit to branch main
in repository
https://gitbox.apache.org/repos/asf/arrow-flight-sql-postgresql.git
The following commit(s) were added to refs/heads/main by this push:
new aa24bb3 Add support for UInt8 (#67)
aa24bb3 is described below
commit aa24bb3ccb0202b38736a9e5c8dc74a868f43d6a
Author: Sutou Kouhei <[email protected]>
AuthorDate: Tue Aug 22 15:10:02 2023 +0900
Add support for UInt8 (#67)
Closes GH-51
---
src/afs.cc | 7 +++++++
test/test-flight-sql.rb | 1 +
2 files changed, 8 insertions(+)
diff --git a/src/afs.cc b/src/afs.cc
index ae53d72..1859130 100644
--- a/src/afs.cc
+++ b/src/afs.cc
@@ -738,6 +738,12 @@ class ArrowPGValueConverter : public arrow::ArrayVisitor {
return arrow::Status::OK();
}
+ arrow::Status Visit(const arrow::UInt8Array& array)
+ {
+ datum_ = UInt8GetDatum(array.Value(i_row_));
+ return arrow::Status::OK();
+ }
+
arrow::Status Visit(const arrow::Int16Array& array)
{
datum_ = Int16GetDatum(array.Value(i_row_));
@@ -877,6 +883,7 @@ class PreparedStatement {
switch (field->type()->id())
{
case arrow::Type::INT8:
+ case arrow::Type::UINT8:
case arrow::Type::INT16:
pgTypes.push_back(INT2OID);
break;
diff --git a/test/test-flight-sql.rb b/test/test-flight-sql.rb
index 0c83ef9..9a58a0b 100644
--- a/test/test-flight-sql.rb
+++ b/test/test-flight-sql.rb
@@ -85,6 +85,7 @@ SELECT * FROM data
data("int16", ["smallint", Arrow::Int16Array, [1, -2, 3]])
data("int32", ["integer", Arrow::Int32Array, [1, -2, 3]])
data("int64", ["bigint", Arrow::Int64Array, [1, -2, 3]])
+ data("uint8", ["smallint", Arrow::UInt8Array, [1, 2, 3]])
def test_insert_type
unless flight_sql_client.respond_to?(:prepare)
omit("red-arrow-flight-sql 14.0.0 or later is required")