From 74e4f20c76e5f47c33bccb2afe91c6600dde227f Mon Sep 17 00:00:00 2001 From: AestheticAkhmad Date: Thu, 18 Dec 2025 21:18:52 +0100 Subject: [PATCH 1/4] Refactor classes in Flight ODBC into type_fwd.h --- .../sql/odbc/odbc_impl/odbc_connection.h | 7 +---- .../sql/odbc/odbc_impl/odbc_descriptor.h | 7 +---- .../sql/odbc/odbc_impl/odbc_environment.h | 2 +- .../sql/odbc/odbc_impl/odbc_statement.h | 8 +---- .../sql/odbc/odbc_impl/spi/connection.h | 3 +- .../sql/odbc/odbc_impl/spi/result_set.h | 3 +- .../flight/sql/odbc/odbc_impl/spi/statement.h | 6 ++-- .../flight/sql/odbc/odbc_impl/type_fwd.h | 31 +++++++++++++++++++ 8 files changed, 39 insertions(+), 28 deletions(-) create mode 100644 cpp/src/arrow/flight/sql/odbc/odbc_impl/type_fwd.h diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_connection.h b/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_connection.h index a968e04edd5..d50e99d0b61 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_connection.h +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_connection.h @@ -19,6 +19,7 @@ #include #include "arrow/flight/sql/odbc/odbc_impl/odbc_handle.h" +#include "arrow/flight/sql/odbc/odbc_impl/type_fwd.h" #include #include @@ -26,12 +27,6 @@ #include #include -namespace ODBC { -class ODBCEnvironment; -class ODBCDescriptor; -class ODBCStatement; -} // namespace ODBC - /** * @brief An abstraction over an ODBC connection handle. This also wraps an SPI * Connection. diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_descriptor.h b/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_descriptor.h index d28adbc91d2..f0259d40098 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_descriptor.h +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_descriptor.h @@ -18,6 +18,7 @@ #pragma once #include "arrow/flight/sql/odbc/odbc_impl/odbc_handle.h" +#include "arrow/flight/sql/odbc/odbc_impl/type_fwd.h" #include #include @@ -26,13 +27,7 @@ #include #include -namespace arrow::flight::sql::odbc { -class ResultSetMetadata; -} // namespace arrow::flight::sql::odbc - namespace ODBC { -class ODBCConnection; -class ODBCStatement; struct DescriptorRecord { std::string base_column_name; diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_environment.h b/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_environment.h index db798e8b76f..059358bd8dc 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_environment.h +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_environment.h @@ -18,6 +18,7 @@ #pragma once #include "arrow/flight/sql/odbc/odbc_impl/odbc_handle.h" +#include "arrow/flight/sql/odbc/odbc_impl/type_fwd.h" #include #include @@ -28,7 +29,6 @@ class Driver; } // namespace arrow::flight::sql::odbc namespace ODBC { -class ODBCConnection; /** * @brief An abstraction over an ODBC environment handle. diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_statement.h b/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_statement.h index 8bb448993f2..a0e4afae165 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_statement.h +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_statement.h @@ -18,20 +18,14 @@ #pragma once #include "arrow/flight/sql/odbc/odbc_impl/odbc_handle.h" +#include "arrow/flight/sql/odbc/odbc_impl/type_fwd.h" #include #include #include #include -namespace arrow::flight::sql::odbc { -class Statement; -class ResultSet; -} // namespace arrow::flight::sql::odbc - namespace ODBC { -class ODBCConnection; -class ODBCDescriptor; /** * @brief An abstraction over an ODBC connection handle. This also wraps an SPI diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/connection.h b/cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/connection.h index 6e913cf2dba..6feb5f208a4 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/connection.h +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/connection.h @@ -27,6 +27,7 @@ #include "arrow/flight/sql/odbc/odbc_impl/diagnostics.h" #include "arrow/flight/sql/odbc/odbc_impl/types.h" +#include "arrow/flight/sql/odbc/odbc_impl/type_fwd.h" namespace arrow::flight::sql::odbc { @@ -42,8 +43,6 @@ struct CaseInsensitiveComparator { // PropertyMap is case-insensitive for keys. typedef std::map PropertyMap; -class Statement; - /// \brief High-level representation of an ODBC connection. class Connection { protected: diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/result_set.h b/cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/result_set.h index 120e6132f19..1832be69436 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/result_set.h +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/result_set.h @@ -23,13 +23,12 @@ #include "arrow/flight/sql/odbc/odbc_impl/platform.h" #include "arrow/flight/sql/odbc/odbc_impl/types.h" +#include "arrow/flight/sql/odbc/odbc_impl/type_fwd.h" #include namespace arrow::flight::sql::odbc { -class ResultSetMetadata; - class ResultSet { protected: ResultSet() = default; diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/statement.h b/cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/statement.h index 7278acd802a..31ff6d60ef6 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/statement.h +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/statement.h @@ -22,11 +22,9 @@ #include #include -namespace arrow::flight::sql::odbc { - -class ResultSet; +#include "arrow/flight/sql/odbc/odbc_impl/type_fwd.h" -class ResultSetMetadata; +namespace arrow::flight::sql::odbc { /// \brief High-level representation of an ODBC statement. class Statement { diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/type_fwd.h b/cpp/src/arrow/flight/sql/odbc/odbc_impl/type_fwd.h new file mode 100644 index 00000000000..a3b834f818c --- /dev/null +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/type_fwd.h @@ -0,0 +1,31 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#pragma once + +namespace arrow::flight::sql::odbc { +class Statement; +class ResultSet; +class ResultSetMetadata; +} + +namespace ODBC { +class ODBCEnvironment; +class ODBCDescriptor; +class ODBCStatement; +class ODBCConnection; +} From df5e8c9842a50c3bec367e1f1900b94db4ff1e47 Mon Sep 17 00:00:00 2001 From: AestheticAkhmad Date: Thu, 18 Dec 2025 21:35:50 +0100 Subject: [PATCH 2/4] Add type_fwd.h to CMakeLists --- cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt index 2fe9c41e3ce..a1042cde97b 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt @@ -107,6 +107,7 @@ add_library(arrow_odbc_spi_impl system_trust_store.cc system_trust_store.h types.h + type_fwd.h type_utilities.h util.cc util.h) From 873f788ac09c3139f33f30e3843a27e51dd6115f Mon Sep 17 00:00:00 2001 From: AestheticAkhmad Date: Sun, 11 Jan 2026 15:43:53 +0100 Subject: [PATCH 3/4] Add TODO referencing issue #48083 --- cpp/src/arrow/flight/sql/odbc/odbc_impl/type_fwd.h | 1 + 1 file changed, 1 insertion(+) diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/type_fwd.h b/cpp/src/arrow/flight/sql/odbc/odbc_impl/type_fwd.h index a3b834f818c..dbec55d301e 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/type_fwd.h +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/type_fwd.h @@ -23,6 +23,7 @@ class ResultSet; class ResultSetMetadata; } +// TODO: Replace ODBC namespace with namespace arrow::flight::sql::odbc #48083 namespace ODBC { class ODBCEnvironment; class ODBCDescriptor; From 6856612e6e771eed09ccd91c1b79dc1141e0c084 Mon Sep 17 00:00:00 2001 From: AestheticAkhmad Date: Tue, 13 Jan 2026 20:01:55 +0100 Subject: [PATCH 4/4] Fix lint errors --- cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/connection.h | 2 +- cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/result_set.h | 2 +- cpp/src/arrow/flight/sql/odbc/odbc_impl/type_fwd.h | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/connection.h b/cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/connection.h index 6feb5f208a4..54184891693 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/connection.h +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/connection.h @@ -26,8 +26,8 @@ #include #include "arrow/flight/sql/odbc/odbc_impl/diagnostics.h" -#include "arrow/flight/sql/odbc/odbc_impl/types.h" #include "arrow/flight/sql/odbc/odbc_impl/type_fwd.h" +#include "arrow/flight/sql/odbc/odbc_impl/types.h" namespace arrow::flight::sql::odbc { diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/result_set.h b/cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/result_set.h index 1832be69436..b4a3994ca3c 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/result_set.h +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/spi/result_set.h @@ -22,8 +22,8 @@ #include "arrow/flight/sql/odbc/odbc_impl/platform.h" -#include "arrow/flight/sql/odbc/odbc_impl/types.h" #include "arrow/flight/sql/odbc/odbc_impl/type_fwd.h" +#include "arrow/flight/sql/odbc/odbc_impl/types.h" #include diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/type_fwd.h b/cpp/src/arrow/flight/sql/odbc/odbc_impl/type_fwd.h index dbec55d301e..ad9ff893475 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/type_fwd.h +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/type_fwd.h @@ -21,12 +21,12 @@ namespace arrow::flight::sql::odbc { class Statement; class ResultSet; class ResultSetMetadata; -} +} // namespace arrow::flight::sql::odbc -// TODO: Replace ODBC namespace with namespace arrow::flight::sql::odbc #48083 +// GH-48083 TODO: Replace ODBC namespace with namespace arrow::flight::sql::odbc namespace ODBC { class ODBCEnvironment; class ODBCDescriptor; class ODBCStatement; class ODBCConnection; -} +} // namespace ODBC