This is an automated email from the ASF dual-hosted git repository.
zeroshade pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-go.git
The following commit(s) were added to refs/heads/main by this push:
new 355d563 GH-46087: [FlightSQL] Allow returning column remarks in
FlightSQL's CommandGetTables (#361)
355d563 is described below
commit 355d5639c1fef6e03a66187a65457feece95d0ec
Author: Mateusz Rzeszutek <[email protected]>
AuthorDate: Sat May 3 01:24:34 2025 +0200
GH-46087: [FlightSQL] Allow returning column remarks in FlightSQL's
CommandGetTables (#361)
### Rationale for this change
See https://github.com/apache/arrow/pull/46110
### What changes are included in this PR?
A new column metadata value
### Are these changes tested?
No; there seem to be no tests that'd verify that `ColumnMetadata` works;
should I add unit tests specifically for the new methods?
### Are there any user-facing changes?
Yes, two new methods
---
arrow/flight/flightsql/column_metadata.go | 11 +++++++++++
arrow/internal/flight_integration/scenario.go | 2 ++
2 files changed, 13 insertions(+)
diff --git a/arrow/flight/flightsql/column_metadata.go
b/arrow/flight/flightsql/column_metadata.go
index d46fab3..10163aa 100644
--- a/arrow/flight/flightsql/column_metadata.go
+++ b/arrow/flight/flightsql/column_metadata.go
@@ -50,6 +50,7 @@ const (
IsCaseSensitiveKey = "ARROW:FLIGHT:SQL:IS_CASE_SENSITIVE"
IsReadOnlyKey = "ARROW:FLIGHT:SQL:IS_READ_ONLY"
IsSearchableKey = "ARROW:FLIGHT:SQL:IS_SEARCHABLE"
+ RemarksKey = "ARROW:FLIGHT:SQL:REMARKS"
)
// ColumnMetadata is a helper object for managing and querying the
@@ -130,6 +131,10 @@ func (c *ColumnMetadata) IsSearchable() (bool, bool) {
return c.findBoolVal(IsSearchableKey)
}
+func (c *ColumnMetadata) Remarks() (string, bool) {
+ return c.findStrVal(RemarksKey)
+}
+
// ColumnMetadataBuilder is a convenience builder for constructing
// sql column metadata using the expected standard metadata keys.
// All methods return the builder itself so it can be chained
@@ -215,3 +220,9 @@ func (c *ColumnMetadataBuilder) IsSearchable(v bool)
*ColumnMetadataBuilder {
c.vals = append(c.vals, boolToStr(v))
return c
}
+
+func (c *ColumnMetadataBuilder) Remarks(remarks string) *ColumnMetadataBuilder
{
+ c.keys = append(c.keys, RemarksKey)
+ c.vals = append(c.vals, remarks)
+ return c
+}
diff --git a/arrow/internal/flight_integration/scenario.go
b/arrow/internal/flight_integration/scenario.go
index 20c6300..a640d06 100644
--- a/arrow/internal/flight_integration/scenario.go
+++ b/arrow/internal/flight_integration/scenario.go
@@ -2228,6 +2228,7 @@ func getQuerySchema() *arrow.Schema {
IsSearchable(true).
CatalogName("catalog_test").
Precision(100).
+ Remarks("test column").
Build().Data}}, nil)
}
@@ -2242,6 +2243,7 @@ func getQueryWithTransactionSchema() *arrow.Schema {
SchemaName("schema_test").
IsSearchable(true).
CatalogName("catalog_test").
+ Remarks("test column").
Precision(100).Build().Data}}, nil)
}