This is an automated email from the ASF dual-hosted git repository.
apitrou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new cd67e5195a ARROW-17517: [C++] Test engine API in public API test
(#13965)
cd67e5195a is described below
commit cd67e5195aee78748e2b646a15a4e9f8b791a776
Author: Antoine Pitrou <[email protected]>
AuthorDate: Tue Sep 20 09:10:39 2022 +0200
ARROW-17517: [C++] Test engine API in public API test (#13965)
Also some assorted header inclusion cleanups.
Followup to PR #13965.
Authored-by: Antoine Pitrou <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
---
cpp/cmake_modules/DefineOptions.cmake | 4 +--
cpp/src/arrow/compute/exec.h | 4 +--
cpp/src/arrow/compute/exec/aggregate.cc | 1 +
cpp/src/arrow/compute/exec/exec_plan.cc | 1 +
cpp/src/arrow/compute/exec/exec_plan.h | 3 --
cpp/src/arrow/compute/exec/tpch_node.cc | 25 +++++++++-------
cpp/src/arrow/compute/type_fwd.h | 4 +++
cpp/src/arrow/public_api_test.cc | 52 ++++++++++++++++++++++++---------
cpp/src/arrow/util/config.h.cmake | 2 ++
r/src/compute-exec.cpp | 1 +
10 files changed, 65 insertions(+), 32 deletions(-)
diff --git a/cpp/cmake_modules/DefineOptions.cmake
b/cpp/cmake_modules/DefineOptions.cmake
index 8a1271dfcd..6b77e36db7 100644
--- a/cpp/cmake_modules/DefineOptions.cmake
+++ b/cpp/cmake_modules/DefineOptions.cmake
@@ -239,8 +239,6 @@ takes precedence over ccache if a storage backend is
configured" ON)
define_option(ARROW_DATASET "Build the Arrow Dataset Modules" OFF)
- define_option(ARROW_SUBSTRAIT "Build the Arrow Substrait Consumer Module"
OFF)
-
define_option(ARROW_FILESYSTEM "Build the Arrow Filesystem Layer" OFF)
define_option(ARROW_FLIGHT
@@ -285,6 +283,8 @@ takes precedence over ccache if a storage backend is
configured" ON)
define_option(ARROW_SKYHOOK "Build the Skyhook libraries" OFF)
+ define_option(ARROW_SUBSTRAIT "Build the Arrow Substrait Consumer Module"
OFF)
+
define_option(ARROW_TENSORFLOW "Build Arrow with TensorFlow support enabled"
OFF)
define_option(ARROW_TESTING "Build the Arrow testing libraries" OFF)
diff --git a/cpp/src/arrow/compute/exec.h b/cpp/src/arrow/compute/exec.h
index 12cce42038..2731c39aba 100644
--- a/cpp/src/arrow/compute/exec.h
+++ b/cpp/src/arrow/compute/exec.h
@@ -30,8 +30,8 @@
#include "arrow/array/data.h"
#include "arrow/compute/exec/expression.h"
+#include "arrow/compute/type_fwd.h"
#include "arrow/datum.h"
-#include "arrow/memory_pool.h"
#include "arrow/result.h"
#include "arrow/type_fwd.h"
#include "arrow/util/macros.h"
@@ -127,8 +127,6 @@ class ARROW_EXPORT ExecContext {
bool use_threads_ = true;
};
-ARROW_EXPORT ExecContext* default_exec_context();
-
// TODO: Consider standardizing on uint16 selection vectors and only use them
// when we can ensure that each value is 64K length or smaller
diff --git a/cpp/src/arrow/compute/exec/aggregate.cc
b/cpp/src/arrow/compute/exec/aggregate.cc
index 95f85317c8..180cfacf3d 100644
--- a/cpp/src/arrow/compute/exec/aggregate.cc
+++ b/cpp/src/arrow/compute/exec/aggregate.cc
@@ -19,6 +19,7 @@
#include <mutex>
#include <thread>
+#include <unordered_map>
#include "arrow/compute/exec_internal.h"
#include "arrow/compute/registry.h"
diff --git a/cpp/src/arrow/compute/exec/exec_plan.cc
b/cpp/src/arrow/compute/exec/exec_plan.cc
index 8d9b214a72..6b02b76916 100644
--- a/cpp/src/arrow/compute/exec/exec_plan.cc
+++ b/cpp/src/arrow/compute/exec/exec_plan.cc
@@ -34,6 +34,7 @@
#include "arrow/result.h"
#include "arrow/util/async_generator.h"
#include "arrow/util/checked_cast.h"
+#include "arrow/util/key_value_metadata.h"
#include "arrow/util/logging.h"
#include "arrow/util/tracing_internal.h"
diff --git a/cpp/src/arrow/compute/exec/exec_plan.h
b/cpp/src/arrow/compute/exec/exec_plan.h
index f82afb604a..e9af46be26 100644
--- a/cpp/src/arrow/compute/exec/exec_plan.h
+++ b/cpp/src/arrow/compute/exec/exec_plan.h
@@ -26,12 +26,9 @@
#include <utility>
#include <vector>
-#include "arrow/compute/exec.h"
#include "arrow/compute/type_fwd.h"
#include "arrow/type_fwd.h"
-#include "arrow/util/cancel.h"
#include "arrow/util/future.h"
-#include "arrow/util/key_value_metadata.h"
#include "arrow/util/macros.h"
#include "arrow/util/tracing.h"
#include "arrow/util/type_fwd.h"
diff --git a/cpp/src/arrow/compute/exec/tpch_node.cc
b/cpp/src/arrow/compute/exec/tpch_node.cc
index 13fbef2bd5..0cd33313b0 100644
--- a/cpp/src/arrow/compute/exec/tpch_node.cc
+++ b/cpp/src/arrow/compute/exec/tpch_node.cc
@@ -16,16 +16,6 @@
// under the License.
#include "arrow/compute/exec/tpch_node.h"
-#include "arrow/buffer.h"
-#include "arrow/compute/exec/exec_plan.h"
-#include "arrow/util/async_util.h"
-#include "arrow/util/formatting.h"
-#include "arrow/util/future.h"
-#include "arrow/util/io_util.h"
-#include "arrow/util/logging.h"
-#include "arrow/util/make_unique.h"
-#include "arrow/util/pcg_random.h"
-#include "arrow/util/unreachable.h"
#include <algorithm>
#include <bitset>
@@ -34,10 +24,25 @@
#include <mutex>
#include <queue>
#include <random>
+#include <unordered_map>
#include <unordered_set>
#include <vector>
+#include "arrow/buffer.h"
+#include "arrow/compute/exec.h"
+#include "arrow/compute/exec/exec_plan.h"
+#include "arrow/datum.h"
+#include "arrow/util/async_util.h"
+#include "arrow/util/formatting.h"
+#include "arrow/util/future.h"
+#include "arrow/util/io_util.h"
+#include "arrow/util/logging.h"
+#include "arrow/util/make_unique.h"
+#include "arrow/util/pcg_random.h"
+#include "arrow/util/unreachable.h"
+
namespace arrow {
+
using internal::checked_cast;
using internal::GetRandomSeed;
diff --git a/cpp/src/arrow/compute/type_fwd.h b/cpp/src/arrow/compute/type_fwd.h
index 1494d3e1d1..11c45fde09 100644
--- a/cpp/src/arrow/compute/type_fwd.h
+++ b/cpp/src/arrow/compute/type_fwd.h
@@ -17,6 +17,8 @@
#pragma once
+#include "arrow/util/visibility.h"
+
namespace arrow {
struct Datum;
@@ -49,5 +51,7 @@ class ExecFactoryRegistry;
class SinkNodeConsumer;
+ARROW_EXPORT ExecContext* default_exec_context();
+
} // namespace compute
} // namespace arrow
diff --git a/cpp/src/arrow/public_api_test.cc b/cpp/src/arrow/public_api_test.cc
index a611dd7920..9abff22950 100644
--- a/cpp/src/arrow/public_api_test.cc
+++ b/cpp/src/arrow/public_api_test.cc
@@ -46,45 +46,69 @@
#include "arrow/flight/api.h" // IWYU pragma: keep
#endif
+#ifdef ARROW_FLIGHT_SQL
+#include "arrow/flight/sql/api.h" // IWYU pragma: keep
+#endif
+
#ifdef ARROW_JSON
#include "arrow/json/api.h" // IWYU pragma: keep
#endif
+#ifdef ARROW_SUBSTRAIT
+#include "arrow/engine/api.h" // IWYU pragma: keep
+#include "arrow/engine/substrait/api.h" // IWYU pragma: keep
+#endif
+
+#include <gmock/gmock-matchers.h>
+#include <gtest/gtest.h>
+
+#include "arrow/testing/gtest_util.h"
+#include "arrow/testing/util.h"
+
+namespace arrow {
+
+TEST(InternalHeaders, DCheckExposed) {
#ifdef DCHECK
-#error "DCHECK should not be visible from Arrow public headers."
+ FAIL() << "DCHECK should not be visible from Arrow public headers.";
#endif
+}
+TEST(InternalHeaders, AssignOrRaiseExposed) {
#ifdef ASSIGN_OR_RAISE
-#error "ASSIGN_OR_RAISE should not be visible from Arrow public headers."
+ FAIL() << "ASSIGN_OR_RAISE should not be visible from Arrow public headers.";
#endif
+}
+TEST(InternalDependencies, OpenTelemetryExposed) {
#ifdef OPENTELEMETRY_VERSION
-#error "OpenTelemetry should not be visible from Arrow public headers."
+ FAIL() << "OpenTelemetry should not be visible from Arrow public headers.";
#endif
+}
+TEST(InternalDependencies, XSimdExposed) {
#ifdef XSIMD_VERSION_MAJOR
-#error "xsimd should not be visible from Arrow public headers."
+ FAIL() << "xsimd should not be visible from Arrow public headers.";
#endif
+}
+TEST(InternalDependencies, DateLibraryExposed) {
#ifdef HAS_CHRONO_ROUNDING
-#error "arrow::vendored::date should not be visible from Arrow public headers."
+ FAIL() << "arrow::vendored::date should not be visible from Arrow public
headers.";
#endif
+}
+TEST(InternalDependencies, ProtobufExposed) {
#ifdef PROTOBUF_EXPORT
-#error "Protocol Buffers should not be visible from Arrow public headers."
+ FAIL() << "Protocol Buffers should not be visible from Arrow public
headers.";
#endif
+}
+TEST(TransitiveDependencies, WindowsHeadersExposed) {
#if defined(SendMessage) || defined(GetObject) ||
defined(ERROR_INVALID_HANDLE) || \
defined(FILE_SHARE_READ) || defined(WAIT_TIMEOUT)
-#error "Windows.h should not be included by Arrow public headers"
+ FAIL() << "Windows.h should not be included by Arrow public headers";
#endif
-
-#include <gmock/gmock-matchers.h>
-#include <gtest/gtest.h>
-#include "arrow/testing/gtest_util.h"
-#include "arrow/testing/util.h"
-
-namespace arrow {
+}
TEST(Misc, BuildInfo) {
const auto& info = GetBuildInfo();
diff --git a/cpp/src/arrow/util/config.h.cmake
b/cpp/src/arrow/util/config.h.cmake
index 9948c1e358..f6fad2016a 100644
--- a/cpp/src/arrow/util/config.h.cmake
+++ b/cpp/src/arrow/util/config.h.cmake
@@ -42,12 +42,14 @@
#cmakedefine ARROW_DATASET
#cmakedefine ARROW_FILESYSTEM
#cmakedefine ARROW_FLIGHT
+#cmakedefine ARROW_FLIGHT_SQL
#cmakedefine ARROW_IPC
#cmakedefine ARROW_JEMALLOC
#cmakedefine ARROW_JEMALLOC_VENDORED
#cmakedefine ARROW_JSON
#cmakedefine ARROW_ORC
#cmakedefine ARROW_PARQUET
+#cmakedefine ARROW_SUBSTRAIT
#cmakedefine ARROW_GCS
#cmakedefine ARROW_S3
diff --git a/r/src/compute-exec.cpp b/r/src/compute-exec.cpp
index 71dc6d8b2e..5af6450050 100644
--- a/r/src/compute-exec.cpp
+++ b/r/src/compute-exec.cpp
@@ -18,6 +18,7 @@
#include "./arrow_types.h"
#include "./safe-call-into-r.h"
+#include <arrow/buffer.h>
#include <arrow/compute/api.h>
#include <arrow/compute/exec/exec_plan.h>
#include <arrow/compute/exec/expression.h>