From 8921453e47bc02cd8bdb46bc88058824e2cba974 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Wed, 15 Oct 2025 15:59:18 -0700 Subject: [PATCH 1/3] [in-progress] Address GH-46096 code review comments Need to wait for Justin's changes to push this --- .../accessors/binary_array_accessor_test.cc | 3 +- .../accessors/boolean_array_accessor_test.cc | 3 +- .../accessors/date_array_accessor_test.cc | 3 +- .../accessors/decimal_array_accessor_test.cc | 3 +- .../primitive_array_accessor_test.cc | 3 +- .../accessors/string_array_accessor_test.cc | 3 +- .../accessors/time_array_accessor_test.cc | 3 +- .../timestamp_array_accessor_test.cc | 3 +- .../odbc_impl/flight_sql_connection_test.cc | 3 +- .../flight_sql_stream_chunk_buffer_test.cc | 3 +- .../sql/odbc/odbc_impl/json_converter_test.cc | 3 +- .../odbc/odbc_impl/parse_table_types_test.cc | 3 +- .../record_batch_transformer_test.cc | 3 +- .../flight/sql/odbc/odbc_impl/util_test.cc | 3 +- .../flight/sql/odbc/tests/columns_test.cc | 2 +- .../sql/odbc/tests/connection_attr_test.cc | 2 +- .../sql/odbc/tests/connection_info_test.cc | 2 +- .../flight/sql/odbc/tests/connection_test.cc | 49 +++++-------------- .../flight/sql/odbc/tests/errors_test.cc | 2 +- .../sql/odbc/tests/get_functions_test.cc | 2 +- .../sql/odbc/tests/statement_attr_test.cc | 2 +- .../flight/sql/odbc/tests/statement_test.cc | 4 +- .../flight/sql/odbc/tests/tables_test.cc | 2 +- .../flight/sql/odbc/tests/type_info_test.cc | 2 +- 24 files changed, 49 insertions(+), 62 deletions(-) diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/binary_array_accessor_test.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/binary_array_accessor_test.cc index a50b4b151dd..423870eb3be 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/binary_array_accessor_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/binary_array_accessor_test.cc @@ -18,7 +18,8 @@ #include "arrow/flight/sql/odbc/odbc_impl/accessors/binary_array_accessor.h" #include "arrow/testing/builder.h" #include "arrow/testing/gtest_util.h" -#include "gtest/gtest.h" + +#include namespace arrow::flight::sql::odbc { diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/boolean_array_accessor_test.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/boolean_array_accessor_test.cc index fab7c5bf8c4..b3f402dd7c1 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/boolean_array_accessor_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/boolean_array_accessor_test.cc @@ -17,7 +17,8 @@ #include "arrow/flight/sql/odbc/odbc_impl/accessors/boolean_array_accessor.h" #include "arrow/testing/builder.h" -#include "gtest/gtest.h" + +#include namespace arrow::flight::sql::odbc { diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/date_array_accessor_test.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/date_array_accessor_test.cc index 1b5c4765b3b..a482a838101 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/date_array_accessor_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/date_array_accessor_test.cc @@ -20,7 +20,8 @@ #include "arrow/flight/sql/odbc/odbc_impl/accessors/boolean_array_accessor.h" #include "arrow/flight/sql/odbc/odbc_impl/calendar_utils.h" #include "arrow/testing/builder.h" -#include "gtest/gtest.h" + +#include namespace arrow::flight::sql::odbc { diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/decimal_array_accessor_test.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/decimal_array_accessor_test.cc index 84bfe0c8733..6664b2d6e60 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/decimal_array_accessor_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/decimal_array_accessor_test.cc @@ -19,7 +19,8 @@ #include "arrow/builder.h" #include "arrow/testing/builder.h" #include "arrow/util/decimal.h" -#include "gtest/gtest.h" + +#include namespace arrow::flight::sql::odbc { namespace { diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/primitive_array_accessor_test.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/primitive_array_accessor_test.cc index f01ebd2e4c0..a5ce05fb717 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/primitive_array_accessor_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/primitive_array_accessor_test.cc @@ -19,7 +19,8 @@ #include "arrow/flight/sql/odbc/odbc_impl/diagnostics.h" #include "arrow/testing/builder.h" -#include "gtest/gtest.h" + +#include namespace arrow::flight::sql::odbc { diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/string_array_accessor_test.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/string_array_accessor_test.cc index d5f19a8130d..4d0e1393407 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/string_array_accessor_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/string_array_accessor_test.cc @@ -19,7 +19,8 @@ #include "arrow/flight/sql/odbc/odbc_impl/encoding.h" #include "arrow/testing/builder.h" -#include "gtest/gtest.h" + +#include namespace arrow::flight::sql::odbc { diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/time_array_accessor_test.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/time_array_accessor_test.cc index fda3201a42a..41bd0d73ea7 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/time_array_accessor_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/time_array_accessor_test.cc @@ -20,7 +20,8 @@ #include "arrow/flight/sql/odbc/odbc_impl/calendar_utils.h" #include "arrow/flight/sql/odbc/odbc_impl/util.h" #include "arrow/testing/builder.h" -#include "gtest/gtest.h" + +#include namespace arrow::flight::sql::odbc { diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/timestamp_array_accessor_test.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/timestamp_array_accessor_test.cc index ea5b6b067de..dd4917b0e37 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/timestamp_array_accessor_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/accessors/timestamp_array_accessor_test.cc @@ -20,7 +20,8 @@ #include "arrow/flight/sql/odbc/odbc_impl/calendar_utils.h" #include "arrow/flight/sql/odbc/odbc_impl/util.h" #include "arrow/testing/builder.h" -#include "gtest/gtest.h" + +#include namespace arrow::flight::sql::odbc { diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_connection_test.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_connection_test.cc index 7ad83176e03..8dc5604de6a 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_connection_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_connection_test.cc @@ -19,7 +19,8 @@ #include "arrow/flight/sql/odbc/odbc_impl/platform.h" #include "arrow/flight/types.h" -#include "gtest/gtest.h" + +#include #include diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_stream_chunk_buffer_test.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_stream_chunk_buffer_test.cc index 3c768fcff13..a3f23ecaaf9 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_stream_chunk_buffer_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/flight_sql_stream_chunk_buffer_test.cc @@ -23,7 +23,8 @@ #include "arrow/flight/sql/odbc/odbc_impl/json_converter.h" #include "arrow/flight/test_flight_server.h" #include "arrow/flight/test_util.h" -#include "gtest/gtest.h" + +#include namespace arrow::flight::sql::odbc { diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/json_converter_test.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/json_converter_test.cc index a3c3275affd..1ce6c16202f 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/json_converter_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/json_converter_test.cc @@ -19,7 +19,8 @@ #include "arrow/scalar.h" #include "arrow/testing/builder.h" #include "arrow/type.h" -#include "gtest/gtest.h" + +#include namespace arrow::flight::sql::odbc { diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/parse_table_types_test.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/parse_table_types_test.cc index cf1e5930a82..3749c276d4f 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/parse_table_types_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/parse_table_types_test.cc @@ -18,7 +18,8 @@ #include "arrow/flight/sql/odbc/odbc_impl/flight_sql_statement_get_tables.h" #include "arrow/flight/sql/odbc/odbc_impl/platform.h" -#include "gtest/gtest.h" + +#include namespace arrow::flight::sql::odbc { diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/record_batch_transformer_test.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/record_batch_transformer_test.cc index 9727167a500..a5e094317ea 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/record_batch_transformer_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/record_batch_transformer_test.cc @@ -20,7 +20,8 @@ #include "arrow/flight/sql/odbc/odbc_impl/platform.h" #include "arrow/record_batch.h" #include "arrow/testing/builder.h" -#include "gtest/gtest.h" + +#include namespace arrow::flight::sql::odbc { namespace { diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/util_test.cc b/cpp/src/arrow/flight/sql/odbc/odbc_impl/util_test.cc index 94be15ac382..4946355ff20 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/util_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/util_test.cc @@ -23,7 +23,8 @@ #include "arrow/testing/builder.h" #include "arrow/testing/gtest_util.h" #include "arrow/testing/util.h" -#include "gtest/gtest.h" + +#include namespace arrow::flight::sql::odbc { diff --git a/cpp/src/arrow/flight/sql/odbc/tests/columns_test.cc b/cpp/src/arrow/flight/sql/odbc/tests/columns_test.cc index b460955a8a1..159dbc5fb62 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/columns_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/tests/columns_test.cc @@ -24,7 +24,7 @@ #include #include -#include "gtest/gtest.h" +#include namespace arrow::flight::sql::odbc { // Helper functions diff --git a/cpp/src/arrow/flight/sql/odbc/tests/connection_attr_test.cc b/cpp/src/arrow/flight/sql/odbc/tests/connection_attr_test.cc index 4e1439ed92d..fa3771adb39 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/connection_attr_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/tests/connection_attr_test.cc @@ -24,7 +24,7 @@ #include #include -#include "gtest/gtest.h" +#include namespace arrow::flight::sql::odbc { diff --git a/cpp/src/arrow/flight/sql/odbc/tests/connection_info_test.cc b/cpp/src/arrow/flight/sql/odbc/tests/connection_info_test.cc index cbca173e1ca..7a46731260b 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/connection_info_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/tests/connection_info_test.cc @@ -24,7 +24,7 @@ #include #include -#include "gtest/gtest.h" +#include namespace arrow::flight::sql::odbc { diff --git a/cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc b/cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc index 56297ede395..dab8d065d28 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc @@ -24,31 +24,34 @@ #include #include -#include "gmock/gmock.h" -#include "gtest/gtest.h" +#include namespace arrow::flight::sql::odbc { - +// -AL- TODO wait for Justin's fixes to address the remaining comments. +// Need to remove the tests with just the allocation, all allocation should be freed TEST(SQLAllocHandle, TestSQLAllocHandleEnv) { - // ODBC Environment SQLHENV env; // Allocate an environment handle - SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); + ASSERT_EQ(SQL_SUCCESS, SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env)); + + ASSERT_NE(env, nullptr); - ASSERT_THAT(env, ::testing::NotNull()); + // Free an environment handle + ASSERT_EQ(SQL_SUCCESS, SQLFreeHandle(SQL_HANDLE_ENV, env)); } TEST(SQLAllocEnv, TestSQLAllocEnv) { - // ODBC Environment SQLHENV env; // Allocate an environment handle ASSERT_EQ(SQL_SUCCESS, SQLAllocEnv(&env)); + + // Free an environment handle + ASSERT_EQ(SQL_SUCCESS, SQLFreeEnv(env)); } TEST(SQLAllocHandle, TestSQLAllocHandleConnect) { - // ODBC Environment SQLHENV env; SQLHDBC conn; @@ -60,7 +63,6 @@ TEST(SQLAllocHandle, TestSQLAllocHandleConnect) { } TEST(SQLAllocConnect, TestSQLAllocHandleConnect) { - // ODBC Environment SQLHENV env; SQLHDBC conn; @@ -71,19 +73,7 @@ TEST(SQLAllocConnect, TestSQLAllocHandleConnect) { ASSERT_EQ(SQL_SUCCESS, SQLAllocConnect(env, &conn)); } -TEST(SQLFreeHandle, TestSQLFreeHandleEnv) { - // ODBC Environment - SQLHENV env; - - // Allocate an environment handle - SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); - - // Free an environment handle - ASSERT_EQ(SQL_SUCCESS, SQLFreeHandle(SQL_HANDLE_ENV, env)); -} - TEST(SQLFreeEnv, TestSQLFreeEnv) { - // ODBC Environment SQLHENV env; // Allocate an environment handle @@ -94,7 +84,6 @@ TEST(SQLFreeEnv, TestSQLFreeEnv) { } TEST(SQLFreeHandle, TestSQLFreeHandleConnect) { - // ODBC Environment SQLHENV env; SQLHDBC conn; @@ -121,7 +110,6 @@ TYPED_TEST(FlightSQLODBCTestBase, TestFreeNullHandles) { } TEST(SQLFreeConnect, TestSQLFreeConnect) { - // ODBC Environment SQLHENV env; SQLHDBC conn; @@ -136,7 +124,6 @@ TEST(SQLFreeConnect, TestSQLFreeConnect) { } TEST(SQLGetEnvAttr, TestSQLGetEnvAttrODBCVersion) { - // ODBC Environment SQLHENV env; SQLINTEGER version; @@ -150,7 +137,6 @@ TEST(SQLGetEnvAttr, TestSQLGetEnvAttrODBCVersion) { } TEST(SQLSetEnvAttr, TestSQLSetEnvAttrODBCVersionValid) { - // ODBC Environment SQLHENV env; // Allocate an environment handle @@ -162,7 +148,6 @@ TEST(SQLSetEnvAttr, TestSQLSetEnvAttrODBCVersionValid) { } TEST(SQLSetEnvAttr, TestSQLSetEnvAttrODBCVersionInvalid) { - // ODBC Environment SQLHENV env; // Allocate an environment handle @@ -212,7 +197,6 @@ TYPED_TEST(FlightSQLODBCTestBase, DISABLED_TestSQLGetEnvAttrNullValuePointer) { } TEST(SQLSetEnvAttr, TestSQLSetEnvAttrOutputNTSValid) { - // ODBC Environment SQLHENV env; // Allocate an environment handle @@ -224,7 +208,6 @@ TEST(SQLSetEnvAttr, TestSQLSetEnvAttrOutputNTSValid) { } TEST(SQLSetEnvAttr, TestSQLSetEnvAttrOutputNTSInvalid) { - // ODBC Environment SQLHENV env; // Allocate an environment handle @@ -236,7 +219,6 @@ TEST(SQLSetEnvAttr, TestSQLSetEnvAttrOutputNTSInvalid) { } TEST(SQLSetEnvAttr, TestSQLSetEnvAttrNullValuePointer) { - // ODBC Environment SQLHENV env; // Allocate an environment handle @@ -247,7 +229,6 @@ TEST(SQLSetEnvAttr, TestSQLSetEnvAttrNullValuePointer) { } TYPED_TEST(FlightSQLODBCTestBase, TestSQLDriverConnect) { - // ODBC Environment SQLHENV env; SQLHDBC conn; @@ -307,7 +288,6 @@ TYPED_TEST(FlightSQLODBCTestBase, TestSQLDriverConnect) { #if defined _WIN32 || defined _WIN64 TYPED_TEST(FlightSQLODBCTestBase, TestSQLDriverConnectDsn) { - // ODBC Environment SQLHENV env; SQLHDBC conn; @@ -371,7 +351,6 @@ TYPED_TEST(FlightSQLODBCTestBase, TestSQLDriverConnectDsn) { } TYPED_TEST(FlightSQLODBCTestBase, TestSQLConnect) { - // ODBC Environment SQLHENV env; SQLHDBC conn; @@ -431,7 +410,6 @@ TYPED_TEST(FlightSQLODBCTestBase, TestSQLConnect) { } TEST_F(FlightSQLODBCRemoteTestBase, TestSQLConnectInputUidPwd) { - // ODBC Environment SQLHENV env; SQLHDBC conn; @@ -500,7 +478,6 @@ TEST_F(FlightSQLODBCRemoteTestBase, TestSQLConnectInputUidPwd) { } TEST_F(FlightSQLODBCRemoteTestBase, TestSQLConnectInvalidUid) { - // ODBC Environment SQLHENV env; SQLHDBC conn; @@ -558,7 +535,6 @@ TEST_F(FlightSQLODBCRemoteTestBase, TestSQLConnectInvalidUid) { } TEST_F(FlightSQLODBCRemoteTestBase, TestSQLConnectDSNPrecedence) { - // ODBC Environment SQLHENV env; SQLHDBC conn; @@ -623,7 +599,6 @@ TEST_F(FlightSQLODBCRemoteTestBase, TestSQLConnectDSNPrecedence) { #endif TEST_F(FlightSQLODBCRemoteTestBase, TestSQLDriverConnectInvalidUid) { - // ODBC Environment SQLHENV env; SQLHDBC conn; @@ -665,7 +640,6 @@ TEST_F(FlightSQLODBCRemoteTestBase, TestSQLDriverConnectInvalidUid) { } TEST(SQLDisconnect, TestSQLDisconnectWithoutConnection) { - // ODBC Environment SQLHENV env; SQLHDBC conn; @@ -717,7 +691,6 @@ TYPED_TEST(FlightSQLODBCTestBase, TestSQLAllocFreeStmt) { } TYPED_TEST(FlightSQLODBCTestBase, TestCloseConnectionWithOpenStatement) { - // ODBC Environment SQLHENV env; SQLHDBC conn; SQLHSTMT statement; diff --git a/cpp/src/arrow/flight/sql/odbc/tests/errors_test.cc b/cpp/src/arrow/flight/sql/odbc/tests/errors_test.cc index 0b29a085f8d..c7db5188f63 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/errors_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/tests/errors_test.cc @@ -24,7 +24,7 @@ #include #include -#include "gtest/gtest.h" +#include namespace arrow::flight::sql::odbc { diff --git a/cpp/src/arrow/flight/sql/odbc/tests/get_functions_test.cc b/cpp/src/arrow/flight/sql/odbc/tests/get_functions_test.cc index 55365c5472a..01e1e9efc12 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/get_functions_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/tests/get_functions_test.cc @@ -24,7 +24,7 @@ #include #include -#include "gtest/gtest.h" +#include namespace arrow::flight::sql::odbc { diff --git a/cpp/src/arrow/flight/sql/odbc/tests/statement_attr_test.cc b/cpp/src/arrow/flight/sql/odbc/tests/statement_attr_test.cc index 9dbecf7b3a3..e9ad10a6e45 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/statement_attr_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/tests/statement_attr_test.cc @@ -27,7 +27,7 @@ #include #include -#include "gtest/gtest.h" +#include namespace arrow::flight::sql::odbc { diff --git a/cpp/src/arrow/flight/sql/odbc/tests/statement_test.cc b/cpp/src/arrow/flight/sql/odbc/tests/statement_test.cc index fc04f4f46f8..ad341ddd68f 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/statement_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/tests/statement_test.cc @@ -26,8 +26,8 @@ #include -#include "gmock/gmock.h" -#include "gtest/gtest.h" +#include +#include namespace arrow::flight::sql::odbc { TYPED_TEST(FlightSQLODBCTestBase, TestSQLExecDirectSimpleQuery) { diff --git a/cpp/src/arrow/flight/sql/odbc/tests/tables_test.cc b/cpp/src/arrow/flight/sql/odbc/tests/tables_test.cc index 77fdadd915f..3c93cc05560 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/tables_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/tests/tables_test.cc @@ -24,7 +24,7 @@ #include #include -#include "gtest/gtest.h" +#include namespace arrow::flight::sql::odbc { diff --git a/cpp/src/arrow/flight/sql/odbc/tests/type_info_test.cc b/cpp/src/arrow/flight/sql/odbc/tests/type_info_test.cc index e8f0aa07f52..2943de78f41 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/type_info_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/tests/type_info_test.cc @@ -24,7 +24,7 @@ #include #include -#include "gtest/gtest.h" +#include namespace arrow::flight::sql::odbc { From 485f34e124d5d5b3deb5b0695e8cff4b6185e124 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Thu, 16 Oct 2025 16:28:11 -0700 Subject: [PATCH 2/3] Address GH-47708 code review comments --- cpp/src/arrow/flight/sql/odbc/tests/columns_test.cc | 4 +--- cpp/src/arrow/flight/sql/odbc/tests/connection_attr_test.cc | 4 +--- cpp/src/arrow/flight/sql/odbc/tests/connection_info_test.cc | 4 +--- cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc | 4 +--- cpp/src/arrow/flight/sql/odbc/tests/errors_test.cc | 4 +--- cpp/src/arrow/flight/sql/odbc/tests/get_functions_test.cc | 4 +--- cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.h | 4 +--- cpp/src/arrow/flight/sql/odbc/tests/statement_attr_test.cc | 4 +--- cpp/src/arrow/flight/sql/odbc/tests/statement_test.cc | 4 +--- cpp/src/arrow/flight/sql/odbc/tests/tables_test.cc | 4 +--- cpp/src/arrow/flight/sql/odbc/tests/type_info_test.cc | 4 +--- 11 files changed, 11 insertions(+), 33 deletions(-) diff --git a/cpp/src/arrow/flight/sql/odbc/tests/columns_test.cc b/cpp/src/arrow/flight/sql/odbc/tests/columns_test.cc index 159dbc5fb62..df1c93d74aa 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/columns_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/tests/columns_test.cc @@ -16,9 +16,7 @@ // under the License. #include "arrow/flight/sql/odbc/tests/odbc_test_suite.h" -#ifdef _WIN32 -# include -#endif +#include "arrow/flight/sql/odbc/odbc_impl/platform.h" #include #include diff --git a/cpp/src/arrow/flight/sql/odbc/tests/connection_attr_test.cc b/cpp/src/arrow/flight/sql/odbc/tests/connection_attr_test.cc index fa3771adb39..db30d8f6f61 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/connection_attr_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/tests/connection_attr_test.cc @@ -16,9 +16,7 @@ // under the License. #include "arrow/flight/sql/odbc/tests/odbc_test_suite.h" -#ifdef _WIN32 -# include -#endif +#include "arrow/flight/sql/odbc/odbc_impl/platform.h" #include #include diff --git a/cpp/src/arrow/flight/sql/odbc/tests/connection_info_test.cc b/cpp/src/arrow/flight/sql/odbc/tests/connection_info_test.cc index 7a46731260b..7cccde1b65b 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/connection_info_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/tests/connection_info_test.cc @@ -16,9 +16,7 @@ // under the License. #include "arrow/flight/sql/odbc/tests/odbc_test_suite.h" -#ifdef _WIN32 -# include -#endif +#include "arrow/flight/sql/odbc/odbc_impl/platform.h" #include #include diff --git a/cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc b/cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc index dab8d065d28..c84c1f2b860 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc @@ -16,9 +16,7 @@ // under the License. #include "arrow/flight/sql/odbc/tests/odbc_test_suite.h" -#ifdef _WIN32 -# include -#endif +#include "arrow/flight/sql/odbc/odbc_impl/platform.h" #include #include diff --git a/cpp/src/arrow/flight/sql/odbc/tests/errors_test.cc b/cpp/src/arrow/flight/sql/odbc/tests/errors_test.cc index c7db5188f63..f8777b58a05 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/errors_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/tests/errors_test.cc @@ -16,9 +16,7 @@ // under the License. #include "arrow/flight/sql/odbc/tests/odbc_test_suite.h" -#ifdef _WIN32 -# include -#endif +#include "arrow/flight/sql/odbc/odbc_impl/platform.h" #include #include diff --git a/cpp/src/arrow/flight/sql/odbc/tests/get_functions_test.cc b/cpp/src/arrow/flight/sql/odbc/tests/get_functions_test.cc index 01e1e9efc12..f1343196219 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/get_functions_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/tests/get_functions_test.cc @@ -16,9 +16,7 @@ // under the License. #include "arrow/flight/sql/odbc/tests/odbc_test_suite.h" -#ifdef _WIN32 -# include -#endif +#include "arrow/flight/sql/odbc/odbc_impl/platform.h" #include #include diff --git a/cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.h b/cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.h index 5d685191719..22624fc928a 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.h +++ b/cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.h @@ -24,9 +24,7 @@ #include "arrow/flight/sql/example/sqlite_server.h" #include "arrow/flight/sql/odbc/odbc_impl/encoding_utils.h" -#ifdef _WIN32 -# include -#endif +#include "arrow/flight/sql/odbc/odbc_impl/platform.h" #include #include diff --git a/cpp/src/arrow/flight/sql/odbc/tests/statement_attr_test.cc b/cpp/src/arrow/flight/sql/odbc/tests/statement_attr_test.cc index e9ad10a6e45..08cd3210be1 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/statement_attr_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/tests/statement_attr_test.cc @@ -19,9 +19,7 @@ #include "arrow/flight/sql/odbc/odbc_impl/odbc_statement.h" #include "arrow/flight/sql/odbc/odbc_impl/spi/statement.h" -#ifdef _WIN32 -# include -#endif +#include "arrow/flight/sql/odbc/odbc_impl/platform.h" #include #include diff --git a/cpp/src/arrow/flight/sql/odbc/tests/statement_test.cc b/cpp/src/arrow/flight/sql/odbc/tests/statement_test.cc index ad341ddd68f..59456fe1e9b 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/statement_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/tests/statement_test.cc @@ -16,9 +16,7 @@ // under the License. #include "arrow/flight/sql/odbc/tests/odbc_test_suite.h" -#ifdef _WIN32 -# include -#endif +#include "arrow/flight/sql/odbc/odbc_impl/platform.h" #include #include diff --git a/cpp/src/arrow/flight/sql/odbc/tests/tables_test.cc b/cpp/src/arrow/flight/sql/odbc/tests/tables_test.cc index 3c93cc05560..154e79c2308 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/tables_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/tests/tables_test.cc @@ -16,9 +16,7 @@ // under the License. #include "arrow/flight/sql/odbc/tests/odbc_test_suite.h" -#ifdef _WIN32 -# include -#endif +#include "arrow/flight/sql/odbc/odbc_impl/platform.h" #include #include diff --git a/cpp/src/arrow/flight/sql/odbc/tests/type_info_test.cc b/cpp/src/arrow/flight/sql/odbc/tests/type_info_test.cc index 2943de78f41..da9d92ef1fa 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/type_info_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/tests/type_info_test.cc @@ -16,9 +16,7 @@ // under the License. #include "arrow/flight/sql/odbc/tests/odbc_test_suite.h" -#ifdef _WIN32 -# include -#endif +#include "arrow/flight/sql/odbc/odbc_impl/platform.h" #include #include From fd43bd6ec3a85e19fec9f8e62c4e81c133bbe34a Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Thu, 16 Oct 2025 16:58:02 -0700 Subject: [PATCH 3/3] remove comment --- cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc b/cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc index c84c1f2b860..3119facfa70 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc +++ b/cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc @@ -25,8 +25,6 @@ #include namespace arrow::flight::sql::odbc { -// -AL- TODO wait for Justin's fixes to address the remaining comments. -// Need to remove the tests with just the allocation, all allocation should be freed TEST(SQLAllocHandle, TestSQLAllocHandleEnv) { SQLHENV env;