Copilot commented on code in PR #49784:
URL: https://github.com/apache/arrow/pull/49784#discussion_r3105065219


##########
cpp/src/arrow/flight/sql/odbc/tests/CMakeLists.txt:
##########
@@ -42,6 +42,11 @@ set(ARROW_FLIGHT_SQL_ODBC_TEST_SRCS
     # GH-46889: move protobuf_test_util to a more common location
     ../../../../engine/substrait/protobuf_test_util.cc)
 
+# Resolve segmentation fault error on Windows platform due to Arrow Compute 
Library Initialization
+if(WIN32)
+  list(APPEND ARROW_FLIGHT_SQL_ODBC_TEST_SRCS ../../../../compute/test_env.cc)
+endif()

Review Comment:
   Adding `../../../../compute/test_env.cc` introduces a second `main()` (see 
`cpp/src/arrow/compute/test_env.cc`), which will likely cause a linker error 
(multiple definition of `main`) or unintentionally override the test runner 
entrypoint on Windows. Instead, initialize Arrow Compute from an existing 
global test environment (e.g., call `arrow::compute::Initialize()` inside 
`OdbcTestEnvironment::SetUp()` under `#ifdef _WIN32`) or add a small helper 
source that registers the compute environment but does not define `main()`.
   ```suggestion
   # Do not add ../../../../compute/test_env.cc here: it defines its own main(),
   # which would conflict with this test target's runner on Windows. Any Arrow
   # Compute initialization must be performed from the existing ODBC test
   # environment or from a helper source that does not define main().
   ```



##########
cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.h:
##########
@@ -41,12 +41,26 @@
 static constexpr std::string_view kTestConnectStr = 
"ARROW_FLIGHT_SQL_ODBC_CONN";
 static constexpr std::string_view kTestDsn = "Apache Arrow Flight SQL Test 
DSN";
 
-inline SQLHENV env = 0;
-inline SQLHDBC conn = 0;
-inline SQLHSTMT stmt = 0;
+inline std::string remote_test_connect_str = "";
 
-inline bool skipping_test = false;
-inline bool connected = false;
+struct OdbcHandles {
+  SQLHENV env = SQL_NULL_HENV;
+  SQLHDBC conn = SQL_NULL_HDBC;
+  SQLHSTMT stmt = SQL_NULL_HSTMT;
+};
+
+inline OdbcHandles remote_odbcv3_handles;
+inline OdbcHandles remote_odbcv2_handles;
+inline OdbcHandles remote_non_connection_handles;
+inline OdbcHandles mock_odbcv3_handles;
+inline OdbcHandles mock_odbcv2_handles;
+inline OdbcHandles mock_non_connection_handles;
+
+// These handles are meant to point to to the relevant handle above

Review Comment:
   Typo in comment: "point to to" -> "point to".
   ```suggestion
   // These handles are meant to point to the relevant handle above
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to