Skip to content

Commit d46ee0c

Browse files
committed
Address more comments
1 parent 247b6c5 commit d46ee0c

File tree

3 files changed

+6
-23
lines changed

3 files changed

+6
-23
lines changed

cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_result_set_metadata.cc

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "arrow/flight/sql/column_metadata.h"
2121
#include "arrow/flight/sql/odbc/odbc_impl/platform.h"
2222
#include "arrow/flight/sql/odbc/odbc_impl/util.h"
23+
#include "arrow/type_traits.h"
2324
#include "arrow/util/key_value_metadata.h"
2425

2526
#include <utility>
@@ -204,7 +205,8 @@ size_t FlightSqlResultSetMetadata::GetOctetLength(int column_position) {
204205
.value_or(DefaultLengthForVariableLengthColumns);
205206
}
206207

207-
std::string FlightSqlResultSetMetadata::GetTypeName(int column_position, int data_type) {
208+
std::string FlightSqlResultSetMetadata::GetTypeName(int column_position,
209+
int16_t data_type) {
208210
ColumnMetadata metadata = GetMetadata(schema_->field(column_position - 1));
209211

210212
return metadata.GetTypeName().ValueOrElse([data_type] {
@@ -240,26 +242,7 @@ Searchability FlightSqlResultSetMetadata::IsSearchable(int column_position) {
240242
bool FlightSqlResultSetMetadata::IsUnsigned(int column_position) {
241243
const std::shared_ptr<Field>& field = schema_->field(column_position - 1);
242244

243-
switch (field->type()->id()) {
244-
case Type::INT8:
245-
case Type::INT16:
246-
case Type::INT32:
247-
case Type::INT64:
248-
case Type::DOUBLE:
249-
case Type::FLOAT:
250-
case Type::HALF_FLOAT:
251-
case Type::DECIMAL32:
252-
case Type::DECIMAL64:
253-
case Type::DECIMAL128:
254-
case Type::DECIMAL256:
255-
return false;
256-
case Type::UINT8:
257-
case Type::UINT16:
258-
case Type::UINT32:
259-
case Type::UINT64:
260-
default:
261-
return true;
262-
}
245+
return arrow::is_unsigned_integer(field->type()->id());
263246
}
264247

265248
bool FlightSqlResultSetMetadata::IsFixedPrecScale(int column_position) {

cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_result_set_metadata.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class FlightSqlResultSetMetadata : public ResultSetMetadata {
7777

7878
size_t GetOctetLength(int column_position) override;
7979

80-
std::string GetTypeName(int column_position, int data_type) override;
80+
std::string GetTypeName(int column_position, int16_t data_type) override;
8181

8282
Updatability GetUpdatable(int column_position) override;
8383

cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/result_set_metadata.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class ResultSetMetadata {
144144
/// \param column_position [in] the position of the column, starting from 1.
145145
/// \param data_type [in] the data type of the column.
146146
/// \return the data type string.
147-
virtual std::string GetTypeName(int column_position, int data_type) = 0;
147+
virtual std::string GetTypeName(int column_position, int16_t data_type) = 0;
148148

149149
/// \brief It returns a numeric values indicate the updatability of the
150150
/// column.

0 commit comments

Comments
 (0)