Skip to content

Commit c925fbb

Browse files
authored
GH-47646: [C++][FlightRPC] Follow Naming Convention (#47658)
### Rationale for this change We want our code to adhere to Arrow's expected naming conventions. ### What changes are included in this PR? Functions are renamed to be `PascalCase` and variables are renamed to be `snake_case`. Private/protected member variables are named `member_var_`. Public member variables are named `member_var`. ### Are these changes tested? N/A ### Are there any user-facing changes? No. * GitHub Issue: #47646 Authored-by: justing-bq <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
1 parent a13525d commit c925fbb

File tree

75 files changed

+1898
-1864
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1898
-1864
lines changed

cpp/src/arrow/flight/sql/odbc/flight_sql/accessors/binary_array_accessor.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ inline RowStatus MoveSingleCellToBinaryBuffer(ColumnBinding* binding, BinaryArra
5656
value_offset = -1;
5757
}
5858

59-
if (binding->strlen_buffer) {
60-
binding->strlen_buffer[i] = static_cast<ssize_t>(remaining_length);
59+
if (binding->str_len_buffer) {
60+
binding->str_len_buffer[i] = static_cast<ssize_t>(remaining_length);
6161
}
6262

6363
return result;
@@ -72,15 +72,15 @@ BinaryArrayFlightSqlAccessor<TARGET_TYPE>::BinaryArrayFlightSqlAccessor(Array* a
7272

7373
template <>
7474
RowStatus
75-
BinaryArrayFlightSqlAccessor<odbcabstraction::CDataType_BINARY>::MoveSingleCell_impl(
75+
BinaryArrayFlightSqlAccessor<odbcabstraction::CDataType_BINARY>::MoveSingleCellImpl(
7676
ColumnBinding* binding, int64_t arrow_row, int64_t i, int64_t& value_offset,
7777
bool update_value_offset, odbcabstraction::Diagnostics& diagnostics) {
7878
return MoveSingleCellToBinaryBuffer(binding, this->GetArray(), arrow_row, i,
7979
value_offset, update_value_offset, diagnostics);
8080
}
8181

8282
template <CDataType TARGET_TYPE>
83-
size_t BinaryArrayFlightSqlAccessor<TARGET_TYPE>::GetCellLength_impl(
83+
size_t BinaryArrayFlightSqlAccessor<TARGET_TYPE>::GetCellLengthImpl(
8484
ColumnBinding* binding) const {
8585
return binding->buffer_length;
8686
}

cpp/src/arrow/flight/sql/odbc/flight_sql/accessors/binary_array_accessor.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ class BinaryArrayFlightSqlAccessor
3434
public:
3535
explicit BinaryArrayFlightSqlAccessor(Array* array);
3636

37-
RowStatus MoveSingleCell_impl(ColumnBinding* binding, int64_t arrow_row, int64_t i,
38-
int64_t& value_offset, bool update_value_offset,
39-
odbcabstraction::Diagnostics& diagnostics);
37+
RowStatus MoveSingleCellImpl(ColumnBinding* binding, int64_t arrow_row, int64_t i,
38+
int64_t& value_offset, bool update_value_offset,
39+
odbcabstraction::Diagnostics& diagnostics);
4040

41-
size_t GetCellLength_impl(ColumnBinding* binding) const;
41+
size_t GetCellLengthImpl(ColumnBinding* binding) const;
4242
};
4343

4444
} // namespace flight_sql

cpp/src/arrow/flight/sql/odbc/flight_sql/accessors/binary_array_accessor_test.cc

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ TEST(BinaryArrayAccessor, Test_CDataType_BINARY_Basic) {
3535

3636
BinaryArrayFlightSqlAccessor<odbcabstraction::CDataType_BINARY> accessor(array.get());
3737

38-
size_t max_strlen = 64;
39-
std::vector<char> buffer(values.size() * max_strlen);
40-
std::vector<ssize_t> strlen_buffer(values.size());
38+
size_t max_str_len = 64;
39+
std::vector<char> buffer(values.size() * max_str_len);
40+
std::vector<ssize_t> str_len_buffer(values.size());
4141

4242
ColumnBinding binding(odbcabstraction::CDataType_BINARY, 0, 0, buffer.data(),
43-
max_strlen, strlen_buffer.data());
43+
max_str_len, str_len_buffer.data());
4444

4545
int64_t value_offset = 0;
4646
odbcabstraction::Diagnostics diagnostics("Foo", "Foo", OdbcVersion::V_3);
@@ -49,12 +49,13 @@ TEST(BinaryArrayAccessor, Test_CDataType_BINARY_Basic) {
4949
diagnostics, nullptr));
5050

5151
for (int i = 0; i < values.size(); ++i) {
52-
ASSERT_EQ(values[i].length(), strlen_buffer[i]);
52+
ASSERT_EQ(values[i].length(), str_len_buffer[i]);
5353
// Beware that CDataType_BINARY values are not null terminated.
5454
// It's safe to create a std::string from this data because we know it's
5555
// ASCII, this doesn't work with arbitrary binary data.
56-
ASSERT_EQ(values[i], std::string(buffer.data() + i * max_strlen,
57-
buffer.data() + i * max_strlen + strlen_buffer[i]));
56+
ASSERT_EQ(values[i],
57+
std::string(buffer.data() + i * max_str_len,
58+
buffer.data() + i * max_str_len + str_len_buffer[i]));
5859
}
5960
}
6061

@@ -65,12 +66,12 @@ TEST(BinaryArrayAccessor, Test_CDataType_BINARY_Truncation) {
6566

6667
BinaryArrayFlightSqlAccessor<odbcabstraction::CDataType_BINARY> accessor(array.get());
6768

68-
size_t max_strlen = 8;
69-
std::vector<char> buffer(values.size() * max_strlen);
70-
std::vector<ssize_t> strlen_buffer(values.size());
69+
size_t max_str_len = 8;
70+
std::vector<char> buffer(values.size() * max_str_len);
71+
std::vector<ssize_t> str_len_buffer(values.size());
7172

7273
ColumnBinding binding(odbcabstraction::CDataType_BINARY, 0, 0, buffer.data(),
73-
max_strlen, strlen_buffer.data());
74+
max_str_len, str_len_buffer.data());
7475

7576
std::stringstream ss;
7677
int64_t value_offset = 0;
@@ -83,13 +84,13 @@ TEST(BinaryArrayAccessor, Test_CDataType_BINARY_Truncation) {
8384
int64_t original_value_offset = value_offset;
8485
ASSERT_EQ(1, accessor.GetColumnarData(&binding, 0, 1, value_offset, true, diagnostics,
8586
nullptr));
86-
ASSERT_EQ(values[0].length() - original_value_offset, strlen_buffer[0]);
87+
ASSERT_EQ(values[0].length() - original_value_offset, str_len_buffer[0]);
8788

8889
int64_t chunk_length = 0;
8990
if (value_offset == -1) {
90-
chunk_length = strlen_buffer[0];
91+
chunk_length = str_len_buffer[0];
9192
} else {
92-
chunk_length = max_strlen;
93+
chunk_length = max_str_len;
9394
}
9495

9596
// Beware that CDataType_BINARY values are not null terminated.

cpp/src/arrow/flight/sql/odbc/flight_sql/accessors/boolean_array_accessor.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ BooleanArrayFlightSqlAccessor<TARGET_TYPE>::BooleanArrayFlightSqlAccessor(Array*
2929
BooleanArrayFlightSqlAccessor<TARGET_TYPE>>(array) {}
3030

3131
template <CDataType TARGET_TYPE>
32-
RowStatus BooleanArrayFlightSqlAccessor<TARGET_TYPE>::MoveSingleCell_impl(
32+
RowStatus BooleanArrayFlightSqlAccessor<TARGET_TYPE>::MoveSingleCellImpl(
3333
ColumnBinding* binding, int64_t arrow_row, int64_t i, int64_t& value_offset,
3434
bool update_value_offset, odbcabstraction::Diagnostics& diagnostics) {
3535
typedef unsigned char c_type;
@@ -38,15 +38,15 @@ RowStatus BooleanArrayFlightSqlAccessor<TARGET_TYPE>::MoveSingleCell_impl(
3838
auto* buffer = static_cast<c_type*>(binding->buffer);
3939
buffer[i] = value ? 1 : 0;
4040

41-
if (binding->strlen_buffer) {
42-
binding->strlen_buffer[i] = static_cast<ssize_t>(GetCellLength_impl(binding));
41+
if (binding->str_len_buffer) {
42+
binding->str_len_buffer[i] = static_cast<ssize_t>(GetCellLengthImpl(binding));
4343
}
4444

4545
return odbcabstraction::RowStatus_SUCCESS;
4646
}
4747

4848
template <CDataType TARGET_TYPE>
49-
size_t BooleanArrayFlightSqlAccessor<TARGET_TYPE>::GetCellLength_impl(
49+
size_t BooleanArrayFlightSqlAccessor<TARGET_TYPE>::GetCellLengthImpl(
5050
ColumnBinding* binding) const {
5151
return sizeof(unsigned char);
5252
}

cpp/src/arrow/flight/sql/odbc/flight_sql/accessors/boolean_array_accessor.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ class BooleanArrayFlightSqlAccessor
3535
public:
3636
explicit BooleanArrayFlightSqlAccessor(Array* array);
3737

38-
RowStatus MoveSingleCell_impl(ColumnBinding* binding, int64_t arrow_row, int64_t i,
39-
int64_t& value_offset, bool update_value_offset,
40-
odbcabstraction::Diagnostics& diagnostics);
38+
RowStatus MoveSingleCellImpl(ColumnBinding* binding, int64_t arrow_row, int64_t i,
39+
int64_t& value_offset, bool update_value_offset,
40+
odbcabstraction::Diagnostics& diagnostics);
4141

42-
size_t GetCellLength_impl(ColumnBinding* binding) const;
42+
size_t GetCellLengthImpl(ColumnBinding* binding) const;
4343
};
4444

4545
} // namespace flight_sql

cpp/src/arrow/flight/sql/odbc/flight_sql/accessors/boolean_array_accessor_test.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ TEST(BooleanArrayFlightSqlAccessor, Test_BooleanArray_CDataType_BIT) {
3535
BooleanArrayFlightSqlAccessor<odbcabstraction::CDataType_BIT> accessor(array.get());
3636

3737
std::vector<char> buffer(values.size());
38-
std::vector<ssize_t> strlen_buffer(values.size());
38+
std::vector<ssize_t> str_len_buffer(values.size());
3939

4040
ColumnBinding binding(odbcabstraction::CDataType_BIT, 0, 0, buffer.data(), 0,
41-
strlen_buffer.data());
41+
str_len_buffer.data());
4242

4343
int64_t value_offset = 0;
4444
odbcabstraction::Diagnostics diagnostics("Foo", "Foo", OdbcVersion::V_3);
@@ -47,7 +47,7 @@ TEST(BooleanArrayFlightSqlAccessor, Test_BooleanArray_CDataType_BIT) {
4747
diagnostics, nullptr));
4848

4949
for (int i = 0; i < values.size(); ++i) {
50-
ASSERT_EQ(sizeof(unsigned char), strlen_buffer[i]);
50+
ASSERT_EQ(sizeof(unsigned char), str_len_buffer[i]);
5151
ASSERT_EQ(values[i] ? 1 : 0, buffer[i]);
5252
}
5353
}

cpp/src/arrow/flight/sql/odbc/flight_sql/accessors/common.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ inline size_t CopyFromArrayValuesToBinding(ARRAY_TYPE* array, ColumnBinding* bin
3333
int64_t starting_row, int64_t cells) {
3434
constexpr ssize_t element_size = sizeof(typename ARRAY_TYPE::value_type);
3535

36-
if (binding->strlen_buffer) {
36+
if (binding->str_len_buffer) {
3737
for (int64_t i = 0; i < cells; ++i) {
3838
int64_t current_row = starting_row + i;
3939
if (array->IsNull(current_row)) {
40-
binding->strlen_buffer[i] = odbcabstraction::NULL_DATA;
40+
binding->str_len_buffer[i] = odbcabstraction::NULL_DATA;
4141
} else {
42-
binding->strlen_buffer[i] = element_size;
42+
binding->str_len_buffer[i] = element_size;
4343
}
4444
}
4545
} else {

cpp/src/arrow/flight/sql/odbc/flight_sql/accessors/date_array_accessor.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ DateArrayFlightSqlAccessor<TARGET_TYPE, ARROW_ARRAY>::DateArrayFlightSqlAccessor
6060
DateArrayFlightSqlAccessor<TARGET_TYPE, ARROW_ARRAY>>(array) {}
6161

6262
template <CDataType TARGET_TYPE, typename ARROW_ARRAY>
63-
RowStatus DateArrayFlightSqlAccessor<TARGET_TYPE, ARROW_ARRAY>::MoveSingleCell_impl(
63+
RowStatus DateArrayFlightSqlAccessor<TARGET_TYPE, ARROW_ARRAY>::MoveSingleCellImpl(
6464
ColumnBinding* binding, int64_t arrow_row, int64_t cell_counter,
6565
int64_t& value_offset, bool update_value_offset,
6666
odbcabstraction::Diagnostics& diagnostics) {
@@ -74,16 +74,16 @@ RowStatus DateArrayFlightSqlAccessor<TARGET_TYPE, ARROW_ARRAY>::MoveSingleCell_i
7474
buffer[cell_counter].month = date.tm_mon + 1;
7575
buffer[cell_counter].day = date.tm_mday;
7676

77-
if (binding->strlen_buffer) {
78-
binding->strlen_buffer[cell_counter] =
79-
static_cast<ssize_t>(GetCellLength_impl(binding));
77+
if (binding->str_len_buffer) {
78+
binding->str_len_buffer[cell_counter] =
79+
static_cast<ssize_t>(GetCellLengthImpl(binding));
8080
}
8181

8282
return odbcabstraction::RowStatus_SUCCESS;
8383
}
8484

8585
template <CDataType TARGET_TYPE, typename ARROW_ARRAY>
86-
size_t DateArrayFlightSqlAccessor<TARGET_TYPE, ARROW_ARRAY>::GetCellLength_impl(
86+
size_t DateArrayFlightSqlAccessor<TARGET_TYPE, ARROW_ARRAY>::GetCellLengthImpl(
8787
ColumnBinding* binding) const {
8888
return sizeof(DATE_STRUCT);
8989
}

cpp/src/arrow/flight/sql/odbc/flight_sql/accessors/date_array_accessor.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ class DateArrayFlightSqlAccessor
3434
public:
3535
explicit DateArrayFlightSqlAccessor(Array* array);
3636

37-
RowStatus MoveSingleCell_impl(ColumnBinding* binding, int64_t arrow_row,
38-
int64_t cell_counter, int64_t& value_offset,
39-
bool update_value_offset,
40-
odbcabstraction::Diagnostics& diagnostics);
37+
RowStatus MoveSingleCellImpl(ColumnBinding* binding, int64_t arrow_row,
38+
int64_t cell_counter, int64_t& value_offset,
39+
bool update_value_offset,
40+
odbcabstraction::Diagnostics& diagnostics);
4141

42-
size_t GetCellLength_impl(ColumnBinding* binding) const;
42+
size_t GetCellLengthImpl(ColumnBinding* binding) const;
4343
};
4444

4545
} // namespace flight_sql

cpp/src/arrow/flight/sql/odbc/flight_sql/accessors/date_array_accessor_test.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ TEST(DateArrayAccessor, Test_Date32Array_CDataType_DATE) {
5151
dynamic_cast<NumericArray<Date32Type>*>(array.get()));
5252

5353
std::vector<tagDATE_STRUCT> buffer(values.size());
54-
std::vector<ssize_t> strlen_buffer(values.size());
54+
std::vector<ssize_t> str_len_buffer(values.size());
5555

5656
ColumnBinding binding(odbcabstraction::CDataType_DATE, 0, 0, buffer.data(), 0,
57-
strlen_buffer.data());
57+
str_len_buffer.data());
5858

5959
int64_t value_offset = 0;
6060
odbcabstraction::Diagnostics diagnostics("Foo", "Foo", OdbcVersion::V_3);
@@ -63,7 +63,7 @@ TEST(DateArrayAccessor, Test_Date32Array_CDataType_DATE) {
6363
diagnostics, nullptr));
6464

6565
for (size_t i = 0; i < values.size(); ++i) {
66-
ASSERT_EQ(sizeof(DATE_STRUCT), strlen_buffer[i]);
66+
ASSERT_EQ(sizeof(DATE_STRUCT), str_len_buffer[i]);
6767

6868
ASSERT_EQ(expected[i].year, buffer[i].year);
6969
ASSERT_EQ(expected[i].month, buffer[i].month);
@@ -89,10 +89,10 @@ TEST(DateArrayAccessor, Test_Date64Array_CDataType_DATE) {
8989
dynamic_cast<NumericArray<Date64Type>*>(array.get()));
9090

9191
std::vector<tagDATE_STRUCT> buffer(values.size());
92-
std::vector<ssize_t> strlen_buffer(values.size());
92+
std::vector<ssize_t> str_len_buffer(values.size());
9393

9494
ColumnBinding binding(odbcabstraction::CDataType_DATE, 0, 0, buffer.data(), 0,
95-
strlen_buffer.data());
95+
str_len_buffer.data());
9696

9797
int64_t value_offset = 0;
9898
odbcabstraction::Diagnostics diagnostics("Foo", "Foo", OdbcVersion::V_3);
@@ -101,7 +101,7 @@ TEST(DateArrayAccessor, Test_Date64Array_CDataType_DATE) {
101101
diagnostics, nullptr));
102102

103103
for (size_t i = 0; i < values.size(); ++i) {
104-
ASSERT_EQ(sizeof(DATE_STRUCT), strlen_buffer[i]);
104+
ASSERT_EQ(sizeof(DATE_STRUCT), str_len_buffer[i]);
105105
ASSERT_EQ(expected[i].year, buffer[i].year);
106106
ASSERT_EQ(expected[i].month, buffer[i].month);
107107
ASSERT_EQ(expected[i].day, buffer[i].day);

0 commit comments

Comments
 (0)