Skip to content

Commit 355d563

Browse files
GH-46087: [FlightSQL] Allow returning column remarks in FlightSQL's CommandGetTables (#361)
### Rationale for this change See apache/arrow#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
1 parent b624664 commit 355d563

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

arrow/flight/flightsql/column_metadata.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const (
5050
IsCaseSensitiveKey = "ARROW:FLIGHT:SQL:IS_CASE_SENSITIVE"
5151
IsReadOnlyKey = "ARROW:FLIGHT:SQL:IS_READ_ONLY"
5252
IsSearchableKey = "ARROW:FLIGHT:SQL:IS_SEARCHABLE"
53+
RemarksKey = "ARROW:FLIGHT:SQL:REMARKS"
5354
)
5455

5556
// ColumnMetadata is a helper object for managing and querying the
@@ -130,6 +131,10 @@ func (c *ColumnMetadata) IsSearchable() (bool, bool) {
130131
return c.findBoolVal(IsSearchableKey)
131132
}
132133

134+
func (c *ColumnMetadata) Remarks() (string, bool) {
135+
return c.findStrVal(RemarksKey)
136+
}
137+
133138
// ColumnMetadataBuilder is a convenience builder for constructing
134139
// sql column metadata using the expected standard metadata keys.
135140
// All methods return the builder itself so it can be chained
@@ -215,3 +220,9 @@ func (c *ColumnMetadataBuilder) IsSearchable(v bool) *ColumnMetadataBuilder {
215220
c.vals = append(c.vals, boolToStr(v))
216221
return c
217222
}
223+
224+
func (c *ColumnMetadataBuilder) Remarks(remarks string) *ColumnMetadataBuilder {
225+
c.keys = append(c.keys, RemarksKey)
226+
c.vals = append(c.vals, remarks)
227+
return c
228+
}

arrow/internal/flight_integration/scenario.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2228,6 +2228,7 @@ func getQuerySchema() *arrow.Schema {
22282228
IsSearchable(true).
22292229
CatalogName("catalog_test").
22302230
Precision(100).
2231+
Remarks("test column").
22312232
Build().Data}}, nil)
22322233
}
22332234

@@ -2242,6 +2243,7 @@ func getQueryWithTransactionSchema() *arrow.Schema {
22422243
SchemaName("schema_test").
22432244
IsSearchable(true).
22442245
CatalogName("catalog_test").
2246+
Remarks("test column").
22452247
Precision(100).Build().Data}}, nil)
22462248
}
22472249

0 commit comments

Comments
 (0)