This is an automated email from the ASF dual-hosted git repository. kou pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/arrow.git
commit b8dc87af2a50c64dba50aeb478bfa4529dce80a5 Author: Wes McKinney <[email protected]> AuthorDate: Sun Oct 7 04:36:12 2018 -0400 ARROW-3420: [C++] include-what-you-use cleanups for most of src/arrow, add "iwyu" target to top level docker-compose You can run IWYU now with `docker-compose run iwyu`. I fixed most of the obvious issues in src/arrow. There are some I couldn't quite figure out. I will leave cleaning src/parquet for a follow up patch. IWYU makes some spurious reports thinking that certain headers can be removed when they cannot. Not sure what's going on there. Author: Wes McKinney <[email protected]> Author: Krisztián Szűcs <[email protected]> Closes #2713 from wesm/ARROW-3420 and squashes the following commits: 5f1ddb6f0 <Krisztián Szűcs> check-format c34b707e9 <Wes McKinney> MSVC fixes 7e25eaeec <Wes McKinney> Fix more IWYU issues d2b4a6668 <Wes McKinney> more IWYU b14d90488 <Wes McKinney> Port IWYU setup to docker-compose, initial pass over src/arrow --- cpp/build-support/iwyu/mappings/arrow-misc.imp | 5 +++++ cpp/cmake_modules/SetupCxxFlags.cmake | 5 ++++- cpp/src/arrow/api.h | 26 ++++++++++++------------- cpp/src/arrow/array-test.cc | 13 +++++++++++-- cpp/src/arrow/array.cc | 3 +-- cpp/src/arrow/array.h | 12 ++++++------ cpp/src/arrow/buffer-test.cc | 2 ++ cpp/src/arrow/buffer.h | 1 + cpp/src/arrow/builder.cc | 3 +-- cpp/src/arrow/builder.h | 14 ++++++------- cpp/src/arrow/compare.cc | 8 +++++++- cpp/src/arrow/compare.h | 1 - cpp/src/arrow/compute/api.h | 8 ++++---- cpp/src/arrow/compute/compute-test.cc | 15 +++++++------- cpp/src/arrow/compute/context.h | 5 ++++- cpp/src/arrow/compute/kernel.h | 2 +- cpp/src/arrow/compute/kernels/boolean.cc | 10 ++++++++-- cpp/src/arrow/compute/kernels/boolean.h | 13 +++---------- cpp/src/arrow/compute/kernels/cast.cc | 4 +--- cpp/src/arrow/compute/kernels/cast.h | 8 ++++---- cpp/src/arrow/compute/kernels/hash.cc | 14 ++++++++++++- cpp/src/arrow/compute/kernels/hash.h | 7 +++++-- cpp/src/arrow/compute/kernels/util-internal.cc | 3 ++- cpp/src/arrow/compute/kernels/util-internal.h | 4 +++- cpp/src/arrow/csv/chunker.cc | 6 +++--- cpp/src/arrow/csv/chunker.h | 2 +- cpp/src/arrow/csv/column-builder.cc | 15 +++++++++++++- cpp/src/arrow/csv/converter.cc | 13 ++++++++----- cpp/src/arrow/csv/converter.h | 7 +++++-- cpp/src/arrow/csv/csv-chunker-test.cc | 9 ++++----- cpp/src/arrow/csv/csv-column-builder-test.cc | 13 +++++++++---- cpp/src/arrow/csv/csv-converter-test.cc | 10 ++++++++-- cpp/src/arrow/csv/csv-parser-test.cc | 7 +++++-- cpp/src/arrow/csv/parser.cc | 7 ++++--- cpp/src/arrow/csv/parser.h | 2 ++ cpp/src/arrow/csv/reader.cc | 23 +++++++++++++++++----- cpp/src/arrow/csv/reader.h | 2 +- cpp/src/arrow/io/buffered.h | 2 +- cpp/src/arrow/io/file.cc | 10 +++++----- cpp/src/arrow/io/hdfs.cc | 8 +++++++- cpp/src/arrow/io/io-buffered-test.cc | 12 ++++++++++++ cpp/src/arrow/io/io-file-test.cc | 6 +++++- cpp/src/arrow/io/io-memory-test.cc | 1 - cpp/src/arrow/io/io-readahead-test.cc | 6 ++++++ cpp/src/arrow/io/memory.h | 1 - cpp/src/arrow/io/readahead.cc | 11 +++++++---- cpp/src/arrow/io/readahead.h | 6 ++++-- cpp/src/arrow/ipc/feather-test.cc | 15 ++++++++------ cpp/src/arrow/ipc/feather.cc | 4 ++-- cpp/src/arrow/ipc/ipc-json-test.cc | 5 ++--- cpp/src/arrow/ipc/ipc-read-write-test.cc | 20 +++++++++++-------- cpp/src/arrow/ipc/json-integration-test.cc | 3 +++ cpp/src/arrow/ipc/json-internal.cc | 7 ++++++- cpp/src/arrow/ipc/json-internal.h | 20 ++++++++++++++----- cpp/src/arrow/ipc/message.cc | 3 ++- cpp/src/arrow/ipc/metadata-internal.cc | 10 ++-------- cpp/src/arrow/ipc/metadata-internal.h | 12 +++++++++--- cpp/src/arrow/ipc/reader.cc | 4 +--- cpp/src/arrow/ipc/stream-to-file.cc | 4 +--- cpp/src/arrow/ipc/writer.cc | 3 ++- cpp/src/arrow/ipc/writer.h | 3 --- cpp/src/arrow/memory_pool-test.cc | 1 + cpp/src/arrow/pretty_print-test.cc | 8 ++++---- cpp/src/arrow/pretty_print.cc | 6 ++++-- cpp/src/arrow/public-api-test.cc | 6 +++--- cpp/src/arrow/python/arrow_to_pandas.cc | 10 +++++----- cpp/src/arrow/python/numpy_interop.h | 10 +++++----- cpp/src/arrow/python/platform.h | 2 +- cpp/src/arrow/record_batch.h | 4 ++-- cpp/src/arrow/stl-test.cc | 8 +++++++- cpp/src/arrow/table-test.cc | 4 ++-- cpp/src/arrow/table.h | 2 +- cpp/src/arrow/table_builder-test.cc | 9 ++++++--- cpp/src/arrow/table_builder.cc | 4 ---- cpp/src/arrow/table_builder.h | 5 ++--- cpp/src/arrow/tensor-test.cc | 1 - cpp/src/arrow/tensor.cc | 1 - cpp/src/arrow/type-test.cc | 2 -- cpp/src/arrow/type.cc | 3 ++- cpp/src/arrow/type.h | 8 ++++++-- cpp/src/arrow/util/bit-util-test.cc | 1 - cpp/src/arrow/util/bit-util.cc | 6 +++++- cpp/src/arrow/util/checked-cast-test.cc | 1 + cpp/src/arrow/util/compression_zlib.cc | 1 + cpp/src/arrow/util/decimal-test.cc | 4 ++++ cpp/src/arrow/util/decimal.cc | 8 ++++++-- cpp/src/arrow/util/hash.cc | 2 ++ cpp/src/arrow/util/io-util.cc | 7 +++++-- cpp/src/arrow/util/key_value_metadata.cc | 5 +++++ cpp/src/arrow/util/lazy-test.cc | 3 +++ cpp/src/arrow/util/logging-test.cc | 5 +++-- cpp/src/arrow/util/parsing-util-test.cc | 8 ++++---- cpp/src/arrow/util/task-group-test.cc | 11 +++++------ cpp/src/arrow/util/task-group.cc | 7 +++++-- cpp/src/arrow/util/task-group.h | 1 + cpp/src/arrow/util/thread-pool-test.cc | 8 ++++++++ cpp/src/arrow/util/thread-pool.cc | 6 ++++-- cpp/src/arrow/util/thread-pool.h | 6 ++++-- cpp/src/gandiva/arrow.h | 1 + cpp/src/parquet/arrow/reader.cc | 16 +++++++++------ cpp/src/parquet/arrow/reader.h | 11 +++++++++-- cpp/src/parquet/arrow/record_reader.cc | 18 ++++++++++++----- cpp/src/parquet/arrow/record_reader.h | 22 +++++++++++---------- cpp/src/parquet/arrow/schema.h | 10 ++++++++-- cpp/src/parquet/bloom_filter-test.cc | 10 +++++++++- cpp/src/parquet/file-deserialize-test.cc | 9 +++------ cpp/src/parquet/public-api-test.cc | 8 ++++---- cpp/src/parquet/thrift.h | 2 +- dev/docker_common/Dockerfile.xenial.base | 9 ++++++++- dev/docker_common/install_clang_tools_xenial.sh | 24 +++++++++++++++++++++++ dev/iwyu/Dockerfile | 6 +++--- dev/iwyu/run_iwyu.sh | 16 ++++++++++----- docker-compose.yml | 9 +++++++++ python/manylinux1/README.md | 1 - 114 files changed, 549 insertions(+), 285 deletions(-) diff --git a/cpp/build-support/iwyu/mappings/arrow-misc.imp b/cpp/build-support/iwyu/mappings/arrow-misc.imp index cbe5bd1..8bb65e6 100644 --- a/cpp/build-support/iwyu/mappings/arrow-misc.imp +++ b/cpp/build-support/iwyu/mappings/arrow-misc.imp @@ -15,6 +15,7 @@ # specific language governing permissions and limitations # under the License. [ + { include: ["<ext/new_allocator.h>", private, "<cstddef>", public ] }, { include: ["<ext/alloc_traits.h>", private, "<memory>", public ] }, { include: ["<ext/alloc_traits.h>", private, "<condition_variable>", public ] }, { include: ["<ext/alloc_traits.h>", private, "<deque>", public ] }, @@ -29,6 +30,7 @@ { include: ["<bits/stdint-intn.h>", private, "<cstdint>", public ] }, { include: ["<bits/stdint-uintn.h>", private, "<cstdint>", public ] }, { include: ["<bits/shared_ptr.h>", private, "<memory>", public ] }, + { include: ["<initializer_list>", public, "<vector>", public ] }, { symbol: ["bool", private, "<cstdint>", public ] }, { symbol: ["false", private, "<cstdint>", public ] }, { symbol: ["true", private, "<cstdint>", public ] }, @@ -40,6 +42,9 @@ { symbol: ["uint16_t", private, "<cstdint>", public ] }, { symbol: ["uint32_t", private, "<cstdint>", public ] }, { symbol: ["uint64_t", private, "<cstdint>", public ] }, + { symbol: ["size_t", private, "<cstddef>", public ] }, + { symbol: ["variant", private, "\"arrow/compute/kernel.h\"", public ] }, + { symbol: ["Array", private, "\"arrow/type_fwd.h\"", public ] }, { symbol: ["make_shared", private, "<memory>", public ] }, { symbol: ["shared_ptr", private, "<memory>", public ] }, { symbol: ["_Node_const_iterator", private, "<flatbuffers/flatbuffers.h>", public ] }, diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake b/cpp/cmake_modules/SetupCxxFlags.cmake index 7ebb033..0d2fd33 100644 --- a/cpp/cmake_modules/SetupCxxFlags.cmake +++ b/cpp/cmake_modules/SetupCxxFlags.cmake @@ -173,9 +173,12 @@ else() endif() endif() -# Disable annoying "performance warning" about int-to-bool conversion if ("${COMPILER_FAMILY}" STREQUAL "msvc") + # Disable annoying "performance warning" about int-to-bool conversion set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} /wd4800") + + # Disable unchecked iterator warnings, equivalent to /D_SCL_SECURE_NO_WARNINGS + set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} /wd4996") endif() if ("${COMPILER_FAMILY}" STREQUAL "gcc" AND diff --git a/cpp/src/arrow/api.h b/cpp/src/arrow/api.h index 7cae841..103a2b2 100644 --- a/cpp/src/arrow/api.h +++ b/cpp/src/arrow/api.h @@ -20,19 +20,19 @@ #ifndef ARROW_API_H #define ARROW_API_H -#include "arrow/array.h" -#include "arrow/buffer.h" -#include "arrow/builder.h" -#include "arrow/compare.h" -#include "arrow/memory_pool.h" -#include "arrow/pretty_print.h" -#include "arrow/record_batch.h" -#include "arrow/status.h" -#include "arrow/table.h" -#include "arrow/table_builder.h" -#include "arrow/tensor.h" -#include "arrow/type.h" -#include "arrow/visitor.h" +#include "arrow/array.h" // IYWU pragma: export +#include "arrow/buffer.h" // IYWU pragma: export +#include "arrow/builder.h" // IYWU pragma: export +#include "arrow/compare.h" // IYWU pragma: export +#include "arrow/memory_pool.h" // IYWU pragma: export +#include "arrow/pretty_print.h" // IYWU pragma: export +#include "arrow/record_batch.h" // IYWU pragma: export +#include "arrow/status.h" // IYWU pragma: export +#include "arrow/table.h" // IYWU pragma: export +#include "arrow/table_builder.h" // IYWU pragma: export +#include "arrow/tensor.h" // IYWU pragma: export +#include "arrow/type.h" // IYWU pragma: export +#include "arrow/visitor.h" // IYWU pragma: export /// \brief Top-level namespace for Apache Arrow C++ API namespace arrow {} diff --git a/cpp/src/arrow/array-test.cc b/cpp/src/arrow/array-test.cc index f5153aa..a0be049 100644 --- a/cpp/src/arrow/array-test.cc +++ b/cpp/src/arrow/array-test.cc @@ -15,24 +15,33 @@ // specific language governing permissions and limitations // under the License. +#include <algorithm> +#include <array> #include <cstdint> -#include <cstdlib> +#include <cstring> +#include <iterator> +#include <limits> #include <memory> #include <numeric> +#include <ostream> +#include <string> +#include <type_traits> #include <vector> -#include "gtest/gtest.h" +#include <gtest/gtest.h> #include "arrow/array.h" #include "arrow/buffer.h" #include "arrow/builder.h" #include "arrow/ipc/test-common.h" #include "arrow/memory_pool.h" +#include "arrow/record_batch.h" #include "arrow/status.h" #include "arrow/test-common.h" #include "arrow/test-util.h" #include "arrow/type.h" #include "arrow/type_traits.h" +#include "arrow/util/bit-util.h" #include "arrow/util/checked_cast.h" #include "arrow/util/decimal.h" #include "arrow/util/lazy.h" diff --git a/cpp/src/arrow/array.cc b/cpp/src/arrow/array.cc index 26abc33..3d88618 100644 --- a/cpp/src/arrow/array.cc +++ b/cpp/src/arrow/array.cc @@ -19,9 +19,7 @@ #include <algorithm> #include <cstdint> -#include <cstring> #include <limits> -#include <set> #include <sstream> #include <utility> @@ -29,6 +27,7 @@ #include "arrow/compare.h" #include "arrow/pretty_print.h" #include "arrow/status.h" +#include "arrow/type.h" #include "arrow/type_traits.h" #include "arrow/util/bit-util.h" #include "arrow/util/checked_cast.h" diff --git a/cpp/src/arrow/array.h b/cpp/src/arrow/array.h index 70ceb8a..8c5e0a5 100644 --- a/cpp/src/arrow/array.h +++ b/cpp/src/arrow/array.h @@ -18,25 +18,28 @@ #ifndef ARROW_ARRAY_H #define ARROW_ARRAY_H -#include <cmath> +#include <cstddef> #include <cstdint> +#include <iosfwd> #include <memory> #include <string> +#include <type_traits> #include <utility> #include <vector> #include "arrow/buffer.h" #include "arrow/type.h" -#include "arrow/type_fwd.h" #include "arrow/type_traits.h" #include "arrow/util/bit-util.h" #include "arrow/util/checked_cast.h" #include "arrow/util/macros.h" #include "arrow/util/visibility.h" -#include "arrow/visitor.h" namespace arrow { +class Array; +class ArrayVisitor; + using BufferVector = std::vector<std::shared_ptr<Buffer>>; // When slicing, we do not know the null count of the sliced range without @@ -48,9 +51,6 @@ constexpr int64_t kUnknownNullCount = -1; class MemoryPool; class Status; -template <typename T> -struct Decimal; - // ---------------------------------------------------------------------- // Generic array data container diff --git a/cpp/src/arrow/buffer-test.cc b/cpp/src/arrow/buffer-test.cc index 6ee6076..13ea8a3 100644 --- a/cpp/src/arrow/buffer-test.cc +++ b/cpp/src/arrow/buffer-test.cc @@ -20,6 +20,8 @@ #include <limits> #include <memory> #include <string> +#include <utility> +#include <vector> #include <gtest/gtest.h> diff --git a/cpp/src/arrow/buffer.h b/cpp/src/arrow/buffer.h index d37a336..66c1314 100644 --- a/cpp/src/arrow/buffer.h +++ b/cpp/src/arrow/buffer.h @@ -19,6 +19,7 @@ #define ARROW_BUFFER_H #include <algorithm> +#include <array> #include <cstdint> #include <cstring> #include <memory> diff --git a/cpp/src/arrow/builder.cc b/cpp/src/arrow/builder.cc index 2210dd3..8b1b8b9 100644 --- a/cpp/src/arrow/builder.cc +++ b/cpp/src/arrow/builder.cc @@ -17,9 +17,9 @@ #include "arrow/builder.h" #include <algorithm> +#include <cstddef> #include <cstdint> #include <cstring> -#include <limits> #include <numeric> #include <sstream> #include <utility> @@ -27,7 +27,6 @@ #include "arrow/array.h" #include "arrow/buffer.h" -#include "arrow/compare.h" #include "arrow/status.h" #include "arrow/type.h" #include "arrow/type_traits.h" diff --git a/cpp/src/arrow/builder.h b/cpp/src/arrow/builder.h index 1347cae..cb4b9eb 100644 --- a/cpp/src/arrow/builder.h +++ b/cpp/src/arrow/builder.h @@ -18,13 +18,15 @@ #ifndef ARROW_BUILDER_H #define ARROW_BUILDER_H -#include <algorithm> +#include <algorithm> // IWYU pragma: keep #include <array> #include <cstdint> -#include <functional> +#include <cstring> +#include <iterator> #include <limits> #include <memory> #include <string> +#include <type_traits> #include <vector> #include "arrow/buffer.h" @@ -35,22 +37,18 @@ #include "arrow/util/bit-util.h" #include "arrow/util/hash.h" #include "arrow/util/macros.h" +#include "arrow/util/type_traits.h" #include "arrow/util/visibility.h" namespace arrow { class Array; +struct ArrayData; class Decimal128; constexpr int64_t kBinaryMemoryLimit = std::numeric_limits<int32_t>::max() - 1; constexpr int64_t kListMaximumElements = std::numeric_limits<int32_t>::max() - 1; -namespace internal { - -struct ArrayData; - -} // namespace internal - constexpr int64_t kMinBuilderCapacity = 1 << 5; /// Base class for all data array builders. diff --git a/cpp/src/arrow/compare.cc b/cpp/src/arrow/compare.cc index 9ed202d..2f4f5d1 100644 --- a/cpp/src/arrow/compare.cc +++ b/cpp/src/arrow/compare.cc @@ -19,18 +19,24 @@ #include "arrow/compare.h" +#include <climits> +#include <cmath> #include <cstdint> +#include <cstring> #include <memory> +#include <string> +#include <type_traits> #include <vector> #include "arrow/array.h" +#include "arrow/buffer.h" #include "arrow/status.h" #include "arrow/tensor.h" #include "arrow/type.h" -#include "arrow/type_traits.h" #include "arrow/util/bit-util.h" #include "arrow/util/checked_cast.h" #include "arrow/util/logging.h" +#include "arrow/util/macros.h" #include "arrow/visitor_inline.h" namespace arrow { diff --git a/cpp/src/arrow/compare.h b/cpp/src/arrow/compare.h index 956ae89..21e2fdc 100644 --- a/cpp/src/arrow/compare.h +++ b/cpp/src/arrow/compare.h @@ -28,7 +28,6 @@ namespace arrow { class Array; class DataType; -class Status; class Tensor; /// Returns true if the arrays are exactly equal diff --git a/cpp/src/arrow/compute/api.h b/cpp/src/arrow/compute/api.h index b3700b4..8ef3ea4 100644 --- a/cpp/src/arrow/compute/api.h +++ b/cpp/src/arrow/compute/api.h @@ -18,10 +18,10 @@ #ifndef ARROW_COMPUTE_API_H #define ARROW_COMPUTE_API_H -#include "arrow/compute/context.h" -#include "arrow/compute/kernel.h" +#include "arrow/compute/context.h" // IWYU pragma: export +#include "arrow/compute/kernel.h" // IWYU pragma: export -#include "arrow/compute/kernels/cast.h" -#include "arrow/compute/kernels/hash.h" +#include "arrow/compute/kernels/cast.h" // IWYU pragma: export +#include "arrow/compute/kernels/hash.h" // IWYU pragma: export #endif // ARROW_COMPUTE_API_H diff --git a/cpp/src/arrow/compute/compute-test.cc b/cpp/src/arrow/compute/compute-test.cc index 056fb03..8da3408 100644 --- a/cpp/src/arrow/compute/compute-test.cc +++ b/cpp/src/arrow/compute/compute-test.cc @@ -16,27 +16,26 @@ // under the License. #include <cstdint> -#include <cstdlib> +#include <cstdio> +#include <functional> #include <locale> #include <memory> -#include <numeric> -#include <sstream> +#include <stdexcept> +#include <string> #include <vector> -#include "gtest/gtest.h" +#include <gtest/gtest.h> #include "arrow/array.h" #include "arrow/buffer.h" -#include "arrow/builder.h" -#include "arrow/compare.h" -#include "arrow/ipc/test-common.h" #include "arrow/memory_pool.h" -#include "arrow/pretty_print.h" #include "arrow/status.h" +#include "arrow/table.h" #include "arrow/test-common.h" #include "arrow/test-util.h" #include "arrow/type.h" #include "arrow/type_traits.h" +#include "arrow/util/decimal.h" #include "arrow/compute/context.h" #include "arrow/compute/kernel.h" diff --git a/cpp/src/arrow/compute/context.h b/cpp/src/arrow/compute/context.h index 48dd57f..8ac4700 100644 --- a/cpp/src/arrow/compute/context.h +++ b/cpp/src/arrow/compute/context.h @@ -18,15 +18,18 @@ #ifndef ARROW_COMPUTE_CONTEXT_H #define ARROW_COMPUTE_CONTEXT_H +#include <cstdint> #include <memory> #include "arrow/memory_pool.h" #include "arrow/status.h" -#include "arrow/type_fwd.h" +#include "arrow/util/macros.h" #include "arrow/util/visibility.h" namespace arrow { +class Buffer; + namespace internal { class CpuInfo; } // namespace internal diff --git a/cpp/src/arrow/compute/kernel.h b/cpp/src/arrow/compute/kernel.h index fd596f1..8048fff 100644 --- a/cpp/src/arrow/compute/kernel.h +++ b/cpp/src/arrow/compute/kernel.h @@ -25,7 +25,7 @@ #include "arrow/record_batch.h" #include "arrow/table.h" #include "arrow/util/macros.h" -#include "arrow/util/variant.h" +#include "arrow/util/variant.h" // IWYU pragma: export #include "arrow/util/visibility.h" namespace arrow { diff --git a/cpp/src/arrow/compute/kernels/boolean.cc b/cpp/src/arrow/compute/kernels/boolean.cc index d51b5d4..e1aa166 100644 --- a/cpp/src/arrow/compute/kernels/boolean.cc +++ b/cpp/src/arrow/compute/kernels/boolean.cc @@ -17,12 +17,18 @@ #include "arrow/compute/kernels/boolean.h" +#include <memory> +#include <vector> + +#include "arrow/array.h" +#include "arrow/buffer.h" #include "arrow/compute/context.h" +#include "arrow/compute/kernel.h" #include "arrow/compute/kernels/util-internal.h" +#include "arrow/type_fwd.h" +#include "arrow/util/bit-util.h" #include "arrow/util/logging.h" -#include <vector> - namespace arrow { using internal::BitmapAnd; diff --git a/cpp/src/arrow/compute/kernels/boolean.h b/cpp/src/arrow/compute/kernels/boolean.h index 4c4072c..88f5ad1 100644 --- a/cpp/src/arrow/compute/kernels/boolean.h +++ b/cpp/src/arrow/compute/kernels/boolean.h @@ -18,22 +18,15 @@ #ifndef ARROW_COMPUTE_KERNELS_BOOLEAN_H #define ARROW_COMPUTE_KERNELS_BOOLEAN_H -#include <memory> - #include "arrow/status.h" #include "arrow/util/visibility.h" -#include "arrow/compute/kernel.h" - namespace arrow { - -class Array; -class ChunkedArray; -class Column; -class DataType; - namespace compute { +struct Datum; +class FunctionContext; + /// \brief Invert the values of a boolean datum /// \param[in] context the FunctionContext /// \param[in] value datum to invert diff --git a/cpp/src/arrow/compute/kernels/cast.cc b/cpp/src/arrow/compute/kernels/cast.cc index c9e2bdb..4f124e8 100644 --- a/cpp/src/arrow/compute/kernels/cast.cc +++ b/cpp/src/arrow/compute/kernels/cast.cc @@ -23,7 +23,6 @@ #include <limits> #include <memory> #include <sstream> -#include <string> #include <type_traits> #include <utility> #include <vector> @@ -31,14 +30,13 @@ #include "arrow/array.h" #include "arrow/buffer.h" #include "arrow/builder.h" -#include "arrow/compare.h" #include "arrow/type.h" #include "arrow/type_traits.h" #include "arrow/util/bit-util.h" #include "arrow/util/checked_cast.h" #include "arrow/util/logging.h" #include "arrow/util/macros.h" -#include "arrow/util/parsing.h" +#include "arrow/util/parsing.h" // IWYU pragma: keep #include "arrow/compute/context.h" #include "arrow/compute/kernel.h" diff --git a/cpp/src/arrow/compute/kernels/cast.h b/cpp/src/arrow/compute/kernels/cast.h index 49b12b9..65c70bf 100644 --- a/cpp/src/arrow/compute/kernels/cast.h +++ b/cpp/src/arrow/compute/kernels/cast.h @@ -23,17 +23,17 @@ #include "arrow/status.h" #include "arrow/util/visibility.h" -#include "arrow/compute/kernel.h" - namespace arrow { class Array; -class ChunkedArray; -class Column; class DataType; namespace compute { +struct Datum; +class FunctionContext; +class UnaryKernel; + struct ARROW_EXPORT CastOptions { CastOptions() : allow_int_overflow(false), diff --git a/cpp/src/arrow/compute/kernels/hash.cc b/cpp/src/arrow/compute/kernels/hash.cc index 51e0a08..fc95a37 100644 --- a/cpp/src/arrow/compute/kernels/hash.cc +++ b/cpp/src/arrow/compute/kernels/hash.cc @@ -17,25 +17,37 @@ #include "arrow/compute/kernels/hash.h" +#include <algorithm> +#include <cstdint> +#include <cstring> #include <exception> -#include <limits> #include <memory> #include <mutex> #include <sstream> #include <string> +#include <type_traits> #include <utility> #include <vector> +#include "arrow/array.h" +#include "arrow/buffer.h" #include "arrow/builder.h" #include "arrow/compute/context.h" #include "arrow/compute/kernel.h" #include "arrow/compute/kernels/util-internal.h" +#include "arrow/type.h" +#include "arrow/type_traits.h" +#include "arrow/util/bit-util.h" #include "arrow/util/checked_cast.h" #include "arrow/util/hash-util.h" #include "arrow/util/hash.h" +#include "arrow/util/logging.h" +#include "arrow/util/macros.h" namespace arrow { +class MemoryPool; + using internal::checked_cast; namespace compute { diff --git a/cpp/src/arrow/compute/kernels/hash.h b/cpp/src/arrow/compute/kernels/hash.h index 05f2429..9e556c6 100644 --- a/cpp/src/arrow/compute/kernels/hash.h +++ b/cpp/src/arrow/compute/kernels/hash.h @@ -19,14 +19,17 @@ #define ARROW_COMPUTE_KERNELS_HASH_H #include <memory> -#include <vector> #include "arrow/compute/kernel.h" #include "arrow/status.h" -#include "arrow/type_fwd.h" #include "arrow/util/visibility.h" namespace arrow { + +class Array; +class DataType; +struct ArrayData; + namespace compute { class FunctionContext; diff --git a/cpp/src/arrow/compute/kernels/util-internal.cc b/cpp/src/arrow/compute/kernels/util-internal.cc index c16e7aa..81fafcb 100644 --- a/cpp/src/arrow/compute/kernels/util-internal.cc +++ b/cpp/src/arrow/compute/kernels/util-internal.cc @@ -18,14 +18,15 @@ #include "arrow/compute/kernels/util-internal.h" #include <algorithm> +#include <cstdint> #include <memory> #include <vector> #include "arrow/array.h" #include "arrow/status.h" +#include "arrow/table.h" #include "arrow/util/logging.h" -#include "arrow/compute/context.h" #include "arrow/compute/kernel.h" namespace arrow { diff --git a/cpp/src/arrow/compute/kernels/util-internal.h b/cpp/src/arrow/compute/kernels/util-internal.h index 78ef662..95dfed9 100644 --- a/cpp/src/arrow/compute/kernels/util-internal.h +++ b/cpp/src/arrow/compute/kernels/util-internal.h @@ -21,8 +21,10 @@ #include <memory> #include <vector> +#include "arrow/array.h" +#include "arrow/buffer.h" #include "arrow/compute/kernel.h" -#include "arrow/type_fwd.h" +#include "arrow/status.h" #include "arrow/util/visibility.h" namespace arrow { diff --git a/cpp/src/arrow/csv/chunker.cc b/cpp/src/arrow/csv/chunker.cc index 2394ce2..92ccbbc 100644 --- a/cpp/src/arrow/csv/chunker.cc +++ b/cpp/src/arrow/csv/chunker.cc @@ -16,12 +16,12 @@ // under the License. #include "arrow/csv/chunker.h" + +#include <cstdint> + #include "arrow/status.h" #include "arrow/util/logging.h" -#include <sstream> -#include <string> - namespace arrow { namespace csv { diff --git a/cpp/src/arrow/csv/chunker.h b/cpp/src/arrow/csv/chunker.h index 7d5ba3a..6c61632 100644 --- a/cpp/src/arrow/csv/chunker.h +++ b/cpp/src/arrow/csv/chunker.h @@ -19,10 +19,10 @@ #define ARROW_CSV_CHUNKER_H #include <cstdint> -#include <vector> #include "arrow/csv/options.h" #include "arrow/status.h" +#include "arrow/util/macros.h" #include "arrow/util/visibility.h" namespace arrow { diff --git a/cpp/src/arrow/csv/column-builder.cc b/cpp/src/arrow/csv/column-builder.cc index 4f04f6e..b7610a5 100644 --- a/cpp/src/arrow/csv/column-builder.cc +++ b/cpp/src/arrow/csv/column-builder.cc @@ -15,16 +15,29 @@ // specific language governing permissions and limitations // under the License. +#include <cstddef> +#include <cstdint> +#include <memory> #include <mutex> #include <utility> +#include <vector> +#include "arrow/array.h" #include "arrow/csv/column-builder.h" +#include "arrow/csv/converter.h" +#include "arrow/csv/options.h" +#include "arrow/memory_pool.h" +#include "arrow/status.h" +#include "arrow/table.h" +#include "arrow/type.h" #include "arrow/util/logging.h" -#include "arrow/util/macros.h" +#include "arrow/util/task-group.h" namespace arrow { namespace csv { +class BlockParser; + using internal::TaskGroup; void ColumnBuilder::SetTaskGroup(const std::shared_ptr<internal::TaskGroup>& task_group) { diff --git a/cpp/src/arrow/csv/converter.cc b/cpp/src/arrow/csv/converter.cc index d8ea0c6..19cf1eb 100644 --- a/cpp/src/arrow/csv/converter.cc +++ b/cpp/src/arrow/csv/converter.cc @@ -16,16 +16,19 @@ // under the License. #include "arrow/csv/converter.h" -#include "arrow/builder.h" -#include "arrow/status.h" -#include "arrow/type.h" -#include "arrow/type_traits.h" -#include "arrow/util/parsing.h" #include <cstring> #include <sstream> #include <string> +#include "arrow/builder.h" +#include "arrow/csv/parser.h" +#include "arrow/memory_pool.h" +#include "arrow/status.h" +#include "arrow/type.h" +#include "arrow/type_traits.h" +#include "arrow/util/parsing.h" // IWYU pragma: keep + namespace arrow { namespace csv { diff --git a/cpp/src/arrow/csv/converter.h b/cpp/src/arrow/csv/converter.h index 959ec71..52f8934 100644 --- a/cpp/src/arrow/csv/converter.h +++ b/cpp/src/arrow/csv/converter.h @@ -18,21 +18,24 @@ #ifndef ARROW_CSV_CONVERTER_H #define ARROW_CSV_CONVERTER_H +#include <cstdint> #include <memory> #include "arrow/csv/options.h" -#include "arrow/csv/parser.h" -#include "arrow/memory_pool.h" +#include "arrow/util/macros.h" #include "arrow/util/visibility.h" namespace arrow { class Array; class DataType; +class MemoryPool; class Status; namespace csv { +class BlockParser; + class ARROW_EXPORT Converter { public: Converter(const std::shared_ptr<DataType>& type, ConvertOptions options, diff --git a/cpp/src/arrow/csv/csv-chunker-test.cc b/cpp/src/arrow/csv/csv-chunker-test.cc index 1fb4199..7eff3e4 100644 --- a/cpp/src/arrow/csv/csv-chunker-test.cc +++ b/cpp/src/arrow/csv/csv-chunker-test.cc @@ -15,16 +15,15 @@ // specific language governing permissions and limitations // under the License. -#include <gtest/gtest.h> - -#include <algorithm> +#include <cstdint> #include <numeric> #include <string> -#include <vector> + +#include <gtest/gtest.h> #include "arrow/csv/chunker.h" +#include "arrow/csv/options.h" #include "arrow/csv/test-common.h" -#include "arrow/status.h" #include "arrow/test-util.h" namespace arrow { diff --git a/cpp/src/arrow/csv/csv-column-builder-test.cc b/cpp/src/arrow/csv/csv-column-builder-test.cc index 9de6d7d..a4dc236 100644 --- a/cpp/src/arrow/csv/csv-column-builder-test.cc +++ b/cpp/src/arrow/csv/csv-column-builder-test.cc @@ -15,21 +15,26 @@ // specific language governing permissions and limitations // under the License. -#include <gtest/gtest.h> - +#include <memory> #include <string> #include <vector> -#include "arrow/array.h" +#include <gtest/gtest.h> + #include "arrow/csv/column-builder.h" +#include "arrow/csv/options.h" #include "arrow/csv/test-common.h" -#include "arrow/status.h" +#include "arrow/table.h" #include "arrow/test-util.h" +#include "arrow/type.h" +#include "arrow/util/task-group.h" #include "arrow/util/thread-pool.h" namespace arrow { namespace csv { +class BlockParser; + using internal::GetCpuThreadPool; using internal::TaskGroup; diff --git a/cpp/src/arrow/csv/csv-converter-test.cc b/cpp/src/arrow/csv/csv-converter-test.cc index 1cf668d..2958615 100644 --- a/cpp/src/arrow/csv/csv-converter-test.cc +++ b/cpp/src/arrow/csv/csv-converter-test.cc @@ -15,20 +15,26 @@ // specific language governing permissions and limitations // under the License. -#include <gtest/gtest.h> - +#include <cstdint> +#include <memory> #include <string> #include <vector> +#include <gtest/gtest.h> + #include "arrow/array.h" #include "arrow/csv/converter.h" +#include "arrow/csv/options.h" #include "arrow/csv/test-common.h" #include "arrow/status.h" #include "arrow/test-util.h" +#include "arrow/type.h" namespace arrow { namespace csv { +class BlockParser; + // All recognized (non-empty) null values std::vector<std::string> AllNulls() { return {"#N/A\n", "#N/A N/A\n", "#NA\n", "-1.#IND\n", "-1.#QNAN\n", "-NaN\n", diff --git a/cpp/src/arrow/csv/csv-parser-test.cc b/cpp/src/arrow/csv/csv-parser-test.cc index 1e8162f..55c69fb 100644 --- a/cpp/src/arrow/csv/csv-parser-test.cc +++ b/cpp/src/arrow/csv/csv-parser-test.cc @@ -15,11 +15,14 @@ // specific language governing permissions and limitations // under the License. -#include <gtest/gtest.h> - +#include <cstdint> #include <string> +#include <utility> #include <vector> +#include <gtest/gtest.h> + +#include "arrow/csv/options.h" #include "arrow/csv/parser.h" #include "arrow/csv/test-common.h" #include "arrow/status.h" diff --git a/cpp/src/arrow/csv/parser.cc b/cpp/src/arrow/csv/parser.cc index 83ff758..240b1f8 100644 --- a/cpp/src/arrow/csv/parser.cc +++ b/cpp/src/arrow/csv/parser.cc @@ -16,11 +16,12 @@ // under the License. #include "arrow/csv/parser.h" -#include "arrow/status.h" -#include "arrow/util/logging.h" +#include <cstdio> #include <sstream> -#include <string> + +#include "arrow/status.h" +#include "arrow/util/logging.h" namespace arrow { namespace csv { diff --git a/cpp/src/arrow/csv/parser.h b/cpp/src/arrow/csv/parser.h index fc70891..46991b4 100644 --- a/cpp/src/arrow/csv/parser.h +++ b/cpp/src/arrow/csv/parser.h @@ -19,10 +19,12 @@ #define ARROW_CSV_PARSER_H #include <cstdint> +#include <memory> #include <vector> #include "arrow/csv/options.h" #include "arrow/status.h" +#include "arrow/util/macros.h" #include "arrow/util/visibility.h" namespace arrow { diff --git a/cpp/src/arrow/csv/reader.cc b/cpp/src/arrow/csv/reader.cc index 6cbda75..730abe4 100644 --- a/cpp/src/arrow/csv/reader.cc +++ b/cpp/src/arrow/csv/reader.cc @@ -15,27 +15,40 @@ // specific language governing permissions and limitations // under the License. +#include "arrow/csv/reader.h" + +#include <cstdint> #include <cstring> #include <limits> +#include <memory> #include <sstream> #include <string> #include <vector> +#include "arrow/buffer.h" #include "arrow/csv/chunker.h" #include "arrow/csv/column-builder.h" +#include "arrow/csv/options.h" #include "arrow/csv/parser.h" -#include "arrow/csv/reader.h" -#include "arrow/io/interfaces.h" #include "arrow/io/readahead.h" -#include "arrow/memory_pool.h" -#include "arrow/record_batch.h" #include "arrow/status.h" +#include "arrow/table.h" +#include "arrow/type.h" #include "arrow/util/logging.h" +#include "arrow/util/macros.h" #include "arrow/util/task-group.h" #include "arrow/util/thread-pool.h" -#include "arrow/util/visibility.h" namespace arrow { + +class MemoryPool; + +namespace io { + +class InputStream; + +} // namespace io + namespace csv { using internal::GetCpuThreadPool; diff --git a/cpp/src/arrow/csv/reader.h b/cpp/src/arrow/csv/reader.h index f64aa77..edf6f11 100644 --- a/cpp/src/arrow/csv/reader.h +++ b/cpp/src/arrow/csv/reader.h @@ -20,7 +20,7 @@ #include <memory> -#include "arrow/csv/options.h" +#include "arrow/csv/options.h" // IWYU pragma: keep #include "arrow/status.h" #include "arrow/util/visibility.h" diff --git a/cpp/src/arrow/io/buffered.h b/cpp/src/arrow/io/buffered.h index 4d4dd25..10070c0 100644 --- a/cpp/src/arrow/io/buffered.h +++ b/cpp/src/arrow/io/buffered.h @@ -20,8 +20,8 @@ #ifndef ARROW_IO_BUFFERED_H #define ARROW_IO_BUFFERED_H +#include <cstdint> #include <memory> -#include <string> #include "arrow/io/interfaces.h" #include "arrow/util/visibility.h" diff --git a/cpp/src/arrow/io/file.cc b/cpp/src/arrow/io/file.cc index a5f51b2..240fac9 100644 --- a/cpp/src/arrow/io/file.cc +++ b/cpp/src/arrow/io/file.cc @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -#include "arrow/util/windows_compatibility.h" +#include "arrow/util/windows_compatibility.h" // IWYU pragma: keep // sys/mman.h not present in Visual Studio or Cygwin #ifdef _WIN32 @@ -27,17 +27,17 @@ #undef Free #else #include <sys/mman.h> -#include <unistd.h> +#include <unistd.h> // IWYU pragma: keep #endif -#include <string.h> - #include <algorithm> #include <cerrno> #include <cstdint> #include <cstring> +#include <memory> #include <mutex> #include <sstream> +#include <string> // ---------------------------------------------------------------------- // Other Arrow includes @@ -549,7 +549,7 @@ Status MemoryMappedFile::ReadAt(int64_t position, int64_t nbytes, int64_t* bytes std::lock_guard<std::mutex> resize_guard(memory_map_->resize_lock()); nbytes = std::max<int64_t>(0, std::min(nbytes, memory_map_->size() - position)); if (nbytes > 0) { - std::memcpy(out, memory_map_->data() + position, static_cast<size_t>(nbytes)); + memcpy(out, memory_map_->data() + position, static_cast<size_t>(nbytes)); } *bytes_read = nbytes; return Status::OK(); diff --git a/cpp/src/arrow/io/hdfs.cc b/cpp/src/arrow/io/hdfs.cc index 09f3b8d..3bf577b 100644 --- a/cpp/src/arrow/io/hdfs.cc +++ b/cpp/src/arrow/io/hdfs.cc @@ -17,17 +17,23 @@ #include <hdfs.h> +#include <errno.h> #include <algorithm> #include <cerrno> -#include <cstddef> #include <cstdint> +#include <cstring> +#include <memory> #include <mutex> #include <sstream> #include <string> +#include <unordered_map> +#include <utility> +#include <vector> #include "arrow/buffer.h" #include "arrow/io/hdfs-internal.h" #include "arrow/io/hdfs.h" +#include "arrow/io/interfaces.h" #include "arrow/memory_pool.h" #include "arrow/status.h" #include "arrow/util/logging.h" diff --git a/cpp/src/arrow/io/io-buffered-test.cc b/cpp/src/arrow/io/io-buffered-test.cc index efa2301..03856dc 100644 --- a/cpp/src/arrow/io/io-buffered-test.cc +++ b/cpp/src/arrow/io/io-buffered-test.cc @@ -15,10 +15,22 @@ // specific language governing permissions and limitations // under the License. +#ifndef _WIN32 +#include <fcntl.h> // IWYU pragma: keep +#include <unistd.h> +#endif + +#include <algorithm> +#include <cstdint> +#include <cstdio> +#include <functional> +#include <iterator> #include <memory> #include <random> #include <string> +#include <utility> #include <valarray> +#include <vector> #include <gtest/gtest.h> diff --git a/cpp/src/arrow/io/io-file-test.cc b/cpp/src/arrow/io/io-file-test.cc index 22d5947..a5d1997 100644 --- a/cpp/src/arrow/io/io-file-test.cc +++ b/cpp/src/arrow/io/io-file-test.cc @@ -15,8 +15,12 @@ // specific language governing permissions and limitations // under the License. +#ifndef _WIN32 +#include <fcntl.h> // IWYU pragma: keep +#include <unistd.h> +#endif + #include <atomic> -#include <cerrno> #include <cstdint> #include <cstdio> #include <cstdlib> diff --git a/cpp/src/arrow/io/io-memory-test.cc b/cpp/src/arrow/io/io-memory-test.cc index db536ad..fa90c1f 100644 --- a/cpp/src/arrow/io/io-memory-test.cc +++ b/cpp/src/arrow/io/io-memory-test.cc @@ -26,7 +26,6 @@ #include "arrow/buffer.h" #include "arrow/io/interfaces.h" #include "arrow/io/memory.h" -#include "arrow/memory_pool.h" #include "arrow/status.h" #include "arrow/test-util.h" #include "arrow/util/checked_cast.h" diff --git a/cpp/src/arrow/io/io-readahead-test.cc b/cpp/src/arrow/io/io-readahead-test.cc index b1b7b43..1e5d02a 100644 --- a/cpp/src/arrow/io/io-readahead-test.cc +++ b/cpp/src/arrow/io/io-readahead-test.cc @@ -15,10 +15,16 @@ // specific language governing permissions and limitations // under the License. +#include <algorithm> #include <chrono> +#include <cstdint> +#include <cstring> +#include <functional> #include <memory> +#include <set> #include <string> #include <thread> +#include <utility> #include <vector> #include <gtest/gtest.h> diff --git a/cpp/src/arrow/io/memory.h b/cpp/src/arrow/io/memory.h index 0bff985..e2db05c 100644 --- a/cpp/src/arrow/io/memory.h +++ b/cpp/src/arrow/io/memory.h @@ -30,7 +30,6 @@ namespace arrow { class Buffer; -class MemoryPool; class ResizableBuffer; class Status; diff --git a/cpp/src/arrow/io/readahead.cc b/cpp/src/arrow/io/readahead.cc index c21e45d..89db6a6 100644 --- a/cpp/src/arrow/io/readahead.cc +++ b/cpp/src/arrow/io/readahead.cc @@ -16,19 +16,22 @@ // under the License. #include "arrow/io/readahead.h" -#include "arrow/buffer.h" -#include "arrow/status.h" -#include "arrow/util/logging.h" #include <condition_variable> #include <cstring> #include <deque> #include <memory> #include <mutex> -#include <string> #include <thread> #include <utility> +#include "arrow/buffer.h" +#include "arrow/io/interfaces.h" +#include "arrow/memory_pool.h" +#include "arrow/status.h" +#include "arrow/util/logging.h" +#include "arrow/util/macros.h" + namespace arrow { namespace io { namespace internal { diff --git a/cpp/src/arrow/io/readahead.h b/cpp/src/arrow/io/readahead.h index d7ac509..950520b 100644 --- a/cpp/src/arrow/io/readahead.h +++ b/cpp/src/arrow/io/readahead.h @@ -18,10 +18,9 @@ #ifndef ARROW_IO_READAHEAD_H #define ARROW_IO_READAHEAD_H +#include <cstdint> #include <memory> -#include <string> -#include "arrow/io/interfaces.h" #include "arrow/util/visibility.h" namespace arrow { @@ -31,6 +30,9 @@ class ResizableBuffer; class Status; namespace io { + +class InputStream; + namespace internal { struct ARROW_EXPORT ReadaheadBuffer { diff --git a/cpp/src/arrow/ipc/feather-test.cc b/cpp/src/arrow/ipc/feather-test.cc index 1ee36d7..ded0a8b 100644 --- a/cpp/src/arrow/ipc/feather-test.cc +++ b/cpp/src/arrow/ipc/feather-test.cc @@ -15,26 +15,29 @@ // specific language governing permissions and limitations // under the License. -#include <cstdint> #include <memory> -#include <random> #include <sstream> #include <string> -#include <vector> -#include "gtest/gtest.h" +#include <gtest/gtest.h> +#include "arrow/array.h" #include "arrow/io/memory.h" #include "arrow/ipc/feather-internal.h" -#include "arrow/ipc/feather.h" +#include "arrow/ipc/feather_generated.h" #include "arrow/ipc/test-common.h" +#include "arrow/memory_pool.h" #include "arrow/pretty_print.h" -#include "arrow/table.h" +#include "arrow/record_batch.h" +#include "arrow/status.h" #include "arrow/test-util.h" +#include "arrow/type.h" #include "arrow/util/checked_cast.h" namespace arrow { +class Buffer; + using internal::checked_cast; namespace ipc { diff --git a/cpp/src/arrow/ipc/feather.cc b/cpp/src/arrow/ipc/feather.cc index eb7e19e..71ca14f 100644 --- a/cpp/src/arrow/ipc/feather.cc +++ b/cpp/src/arrow/ipc/feather.cc @@ -33,10 +33,10 @@ #include "arrow/ipc/feather-internal.h" #include "arrow/ipc/feather_generated.h" #include "arrow/ipc/util.h" // IWYU pragma: keep -#include "arrow/record_batch.h" #include "arrow/status.h" -#include "arrow/table.h" +#include "arrow/table.h" // IWYU pragma: keep #include "arrow/type.h" +#include "arrow/type_traits.h" #include "arrow/util/bit-util.h" #include "arrow/util/checked_cast.h" #include "arrow/util/logging.h" diff --git a/cpp/src/arrow/ipc/ipc-json-test.cc b/cpp/src/arrow/ipc/ipc-json-test.cc index 26d396d..47a0a29 100644 --- a/cpp/src/arrow/ipc/ipc-json-test.cc +++ b/cpp/src/arrow/ipc/ipc-json-test.cc @@ -18,21 +18,20 @@ #include <cstdint> #include <cstdio> #include <cstring> -#include <iostream> #include <memory> #include <string> #include <vector> -#include "gtest/gtest.h" +#include <gtest/gtest.h> #include "arrow/array.h" +#include "arrow/buffer.h" #include "arrow/builder.h" #include "arrow/ipc/json-internal.h" #include "arrow/ipc/json.h" #include "arrow/ipc/test-common.h" #include "arrow/memory_pool.h" #include "arrow/record_batch.h" -#include "arrow/status.h" #include "arrow/test-util.h" #include "arrow/type.h" #include "arrow/type_traits.h" diff --git a/cpp/src/arrow/ipc/ipc-read-write-test.cc b/cpp/src/arrow/ipc/ipc-read-write-test.cc index 55c5f40..31a9d47 100644 --- a/cpp/src/arrow/ipc/ipc-read-write-test.cc +++ b/cpp/src/arrow/ipc/ipc-read-write-test.cc @@ -16,28 +16,32 @@ // under the License. #include <cstdint> -#include <cstdio> -#include <cstring> +#include <limits> #include <memory> +#include <ostream> #include <string> -#include <vector> -#include "gtest/gtest.h" +#include <flatbuffers/flatbuffers.h> +#include <gtest/gtest.h> #include "arrow/array.h" #include "arrow/buffer.h" +#include "arrow/builder.h" +#include "arrow/io/file.h" #include "arrow/io/memory.h" #include "arrow/io/test-common.h" -#include "arrow/ipc/Message_generated.h" -#include "arrow/ipc/api.h" +#include "arrow/ipc/Message_generated.h" // IWYU pragma: keep +#include "arrow/ipc/message.h" #include "arrow/ipc/metadata-internal.h" +#include "arrow/ipc/reader.h" #include "arrow/ipc/test-common.h" -#include "arrow/ipc/util.h" +#include "arrow/ipc/writer.h" #include "arrow/memory_pool.h" -#include "arrow/pretty_print.h" +#include "arrow/record_batch.h" #include "arrow/status.h" #include "arrow/tensor.h" #include "arrow/test-util.h" +#include "arrow/type.h" #include "arrow/util/bit-util.h" #include "arrow/util/checked_cast.h" diff --git a/cpp/src/arrow/ipc/json-integration-test.cc b/cpp/src/arrow/ipc/json-integration-test.cc index 37778fa..09cfa2e 100644 --- a/cpp/src/arrow/ipc/json-integration-test.cc +++ b/cpp/src/arrow/ipc/json-integration-test.cc @@ -50,6 +50,9 @@ DEFINE_bool(verbose, true, "Verbose output"); namespace fs = boost::filesystem; namespace arrow { + +class Buffer; + namespace ipc { bool file_exists(const char* path) { diff --git a/cpp/src/arrow/ipc/json-internal.cc b/cpp/src/arrow/ipc/json-internal.cc index c235fd2..d5a5dd9 100644 --- a/cpp/src/arrow/ipc/json-internal.cc +++ b/cpp/src/arrow/ipc/json-internal.cc @@ -23,10 +23,13 @@ #include <sstream> #include <string> #include <type_traits> +#include <unordered_map> +#include <utility> #include <vector> #include "arrow/array.h" -#include "arrow/builder.h" +#include "arrow/buffer.h" +#include "arrow/builder.h" // IWYU pragma: keep #include "arrow/ipc/dictionary.h" #include "arrow/record_batch.h" #include "arrow/status.h" @@ -41,6 +44,8 @@ namespace arrow { +class MemoryPool; + using internal::checked_cast; namespace ipc { diff --git a/cpp/src/arrow/ipc/json-internal.h b/cpp/src/arrow/ipc/json-internal.h index 8becee6..8807a56 100644 --- a/cpp/src/arrow/ipc/json-internal.h +++ b/cpp/src/arrow/ipc/json-internal.h @@ -22,18 +22,28 @@ #define RAPIDJSON_HAS_CXX11_RVALUE_REFS 1 #define RAPIDJSON_HAS_CXX11_RANGE_FOR 1 +#define RAPIDJSON_NAMESPACE arrow::rapidjson +#define RAPIDJSON_NAMESPACE_BEGIN \ + namespace arrow { \ + namespace rapidjson { +#define RAPIDJSON_NAMESPACE_END \ + } \ + } + #include <memory> #include <sstream> #include <string> -#include "rapidjson/document.h" -#include "rapidjson/stringbuffer.h" -#include "rapidjson/writer.h" +#include "rapidjson/document.h" // IWYU pragma: export +#include "rapidjson/encodings.h" // IWYU pragma: export +#include "rapidjson/stringbuffer.h" // IWYU pragma: export +#include "rapidjson/writer.h" // IWYU pragma: export -#include "arrow/type_fwd.h" // IWYU pragma: export +#include "arrow/status.h" // IWYU pragma: export +#include "arrow/type_fwd.h" // IWYU pragma: keep #include "arrow/util/visibility.h" -namespace rj = rapidjson; +namespace rj = arrow::rapidjson; using RjWriter = rj::Writer<rj::StringBuffer>; using RjArray = rj::Value::ConstArray; using RjObject = rj::Value::ConstObject; diff --git a/cpp/src/arrow/ipc/message.cc b/cpp/src/arrow/ipc/message.cc index 797a490..724e625 100644 --- a/cpp/src/arrow/ipc/message.cc +++ b/cpp/src/arrow/ipc/message.cc @@ -23,10 +23,11 @@ #include <sstream> #include <string> +#include <flatbuffers/flatbuffers.h> + #include "arrow/buffer.h" #include "arrow/io/interfaces.h" #include "arrow/ipc/Message_generated.h" -#include "arrow/ipc/Schema_generated.h" #include "arrow/ipc/metadata-internal.h" #include "arrow/ipc/util.h" #include "arrow/status.h" diff --git a/cpp/src/arrow/ipc/metadata-internal.cc b/cpp/src/arrow/ipc/metadata-internal.cc index 5ac0735..ef189c8 100644 --- a/cpp/src/arrow/ipc/metadata-internal.cc +++ b/cpp/src/arrow/ipc/metadata-internal.cc @@ -18,29 +18,23 @@ #include "arrow/ipc/metadata-internal.h" #include <cstdint> -#include <cstring> #include <memory> #include <sstream> -#include <string> #include <utility> #include <flatbuffers/flatbuffers.h> #include "arrow/array.h" -#include "arrow/buffer.h" #include "arrow/io/interfaces.h" -#include "arrow/ipc/File_generated.h" +#include "arrow/ipc/File_generated.h" // IWYU pragma: keep #include "arrow/ipc/Message_generated.h" -#include "arrow/ipc/Tensor_generated.h" -#include "arrow/ipc/dictionary.h" +#include "arrow/ipc/Tensor_generated.h" // IWYU pragma: keep #include "arrow/ipc/message.h" #include "arrow/ipc/util.h" #include "arrow/status.h" #include "arrow/tensor.h" #include "arrow/type.h" -#include "arrow/util/bit-util.h" #include "arrow/util/checked_cast.h" -#include "arrow/util/key_value_metadata.h" #include "arrow/util/logging.h" namespace arrow { diff --git a/cpp/src/arrow/ipc/metadata-internal.h b/cpp/src/arrow/ipc/metadata-internal.h index 0683b8f..152ca13 100644 --- a/cpp/src/arrow/ipc/metadata-internal.h +++ b/cpp/src/arrow/ipc/metadata-internal.h @@ -21,21 +21,24 @@ #define ARROW_IPC_METADATA_INTERNAL_H #include <cstdint> +#include <cstring> #include <memory> #include <string> #include <vector> +#include <flatbuffers/flatbuffers.h> + #include "arrow/buffer.h" #include "arrow/ipc/Schema_generated.h" -#include "arrow/ipc/dictionary.h" +#include "arrow/ipc/dictionary.h" // IYWU pragma: keep #include "arrow/ipc/message.h" +#include "arrow/memory_pool.h" +#include "arrow/status.h" namespace arrow { -class Buffer; class DataType; class Schema; -class Status; class Tensor; namespace flatbuf = org::apache::arrow::flatbuf; @@ -47,6 +50,9 @@ class OutputStream; } // namespace io namespace ipc { + +class DictionaryMemo; + namespace internal { static constexpr flatbuf::MetadataVersion kCurrentMetadataVersion = diff --git a/cpp/src/arrow/ipc/reader.cc b/cpp/src/arrow/ipc/reader.cc index ba83229..65f5d96 100644 --- a/cpp/src/arrow/ipc/reader.cc +++ b/cpp/src/arrow/ipc/reader.cc @@ -31,18 +31,16 @@ #include "arrow/buffer.h" #include "arrow/io/interfaces.h" #include "arrow/io/memory.h" -#include "arrow/ipc/File_generated.h" +#include "arrow/ipc/File_generated.h" // IWYU pragma: export #include "arrow/ipc/Message_generated.h" #include "arrow/ipc/Schema_generated.h" #include "arrow/ipc/dictionary.h" #include "arrow/ipc/message.h" #include "arrow/ipc/metadata-internal.h" -#include "arrow/ipc/util.h" #include "arrow/record_batch.h" #include "arrow/status.h" #include "arrow/tensor.h" #include "arrow/type.h" -#include "arrow/util/bit-util.h" #include "arrow/util/logging.h" #include "arrow/visitor_inline.h" diff --git a/cpp/src/arrow/ipc/stream-to-file.cc b/cpp/src/arrow/ipc/stream-to-file.cc index 859969b..9ebe582 100644 --- a/cpp/src/arrow/ipc/stream-to-file.cc +++ b/cpp/src/arrow/ipc/stream-to-file.cc @@ -21,14 +21,12 @@ #include "arrow/ipc/reader.h" #include "arrow/ipc/writer.h" +#include "arrow/record_batch.h" #include "arrow/status.h" #include "arrow/util/io-util.h" namespace arrow { - -class RecordBatch; - namespace ipc { // Converts a stream from stdin to a file written to standard out. diff --git a/cpp/src/arrow/ipc/writer.cc b/cpp/src/arrow/ipc/writer.cc index 5fcc2b0..8225cce 100644 --- a/cpp/src/arrow/ipc/writer.cc +++ b/cpp/src/arrow/ipc/writer.cc @@ -21,13 +21,13 @@ #include <cstdint> #include <cstring> #include <limits> -#include <sstream> #include <vector> #include "arrow/array.h" #include "arrow/buffer.h" #include "arrow/io/interfaces.h" #include "arrow/io/memory.h" +#include "arrow/ipc/dictionary.h" #include "arrow/ipc/message.h" #include "arrow/ipc/metadata-internal.h" #include "arrow/ipc/util.h" @@ -40,6 +40,7 @@ #include "arrow/util/bit-util.h" #include "arrow/util/checked_cast.h" #include "arrow/util/logging.h" +#include "arrow/visitor.h" namespace arrow { diff --git a/cpp/src/arrow/ipc/writer.h b/cpp/src/arrow/ipc/writer.h index 9843126..a1c7111 100644 --- a/cpp/src/arrow/ipc/writer.h +++ b/cpp/src/arrow/ipc/writer.h @@ -21,7 +21,6 @@ #define ARROW_IPC_WRITER_H #include <cstdint> -#include <functional> #include <memory> #include <vector> @@ -30,9 +29,7 @@ namespace arrow { -class Array; class Buffer; -class Field; class MemoryPool; class RecordBatch; class Schema; diff --git a/cpp/src/arrow/memory_pool-test.cc b/cpp/src/arrow/memory_pool-test.cc index c2c8146..ad60a93 100644 --- a/cpp/src/arrow/memory_pool-test.cc +++ b/cpp/src/arrow/memory_pool-test.cc @@ -22,6 +22,7 @@ #include "arrow/memory_pool-test.h" #include "arrow/memory_pool.h" #include "arrow/status.h" +#include "arrow/test-util.h" namespace arrow { diff --git a/cpp/src/arrow/pretty_print-test.cc b/cpp/src/arrow/pretty_print-test.cc index 9724b8e..eebb9a9 100644 --- a/cpp/src/arrow/pretty_print-test.cc +++ b/cpp/src/arrow/pretty_print-test.cc @@ -16,21 +16,21 @@ // under the License. #include <cstdint> -#include <cstdio> -#include <cstdlib> #include <cstring> #include <memory> #include <sstream> +#include <string> #include <vector> -#include "gtest/gtest.h" +#include <gtest/gtest.h> #include "arrow/array.h" #include "arrow/builder.h" +#include "arrow/memory_pool.h" #include "arrow/pretty_print.h" +#include "arrow/table.h" #include "arrow/test-util.h" #include "arrow/type.h" -#include "arrow/type_traits.h" #include "arrow/util/decimal.h" namespace arrow { diff --git a/cpp/src/arrow/pretty_print.cc b/cpp/src/arrow/pretty_print.cc index 09d8edf..73908bf 100644 --- a/cpp/src/arrow/pretty_print.cc +++ b/cpp/src/arrow/pretty_print.cc @@ -15,10 +15,13 @@ // specific language governing permissions and limitations // under the License. +#include <cstddef> +#include <cstdint> +#include <iostream> #include <memory> -#include <ostream> #include <sstream> #include <string> +#include <type_traits> #include <vector> #include "arrow/array.h" @@ -29,7 +32,6 @@ #include "arrow/type.h" #include "arrow/type_traits.h" #include "arrow/util/checked_cast.h" -#include "arrow/util/logging.h" #include "arrow/util/string.h" #include "arrow/visitor_inline.h" diff --git a/cpp/src/arrow/public-api-test.cc b/cpp/src/arrow/public-api-test.cc index 088da3f..2009c2e 100644 --- a/cpp/src/arrow/public-api-test.cc +++ b/cpp/src/arrow/public-api-test.cc @@ -15,9 +15,9 @@ // specific language governing permissions and limitations // under the License. -#include "arrow/api.h" -#include "arrow/io/api.h" -#include "arrow/ipc/api.h" +#include "arrow/api.h" // IWYU pragma: keep +#include "arrow/io/api.h" // IWYU pragma: keep +#include "arrow/ipc/api.h" // IWYU pragma: keep #ifdef DCHECK #error "DCHECK should not be visible from Arrow public headers." diff --git a/cpp/src/arrow/python/arrow_to_pandas.cc b/cpp/src/arrow/python/arrow_to_pandas.cc index be6e9b1..67510c4 100644 --- a/cpp/src/arrow/python/arrow_to_pandas.cc +++ b/cpp/src/arrow/python/arrow_to_pandas.cc @@ -17,11 +17,10 @@ // Functions for pandas conversion via NumPy -#include "arrow/python/numpy_interop.h" +#include "arrow/python/numpy_interop.h" // IWYU pragma: expand #include "arrow/python/arrow_to_pandas.h" -#include <algorithm> #include <cmath> #include <cstdint> #include <memory> @@ -31,13 +30,12 @@ #include <vector> #include "arrow/array.h" +#include "arrow/buffer.h" #include "arrow/status.h" #include "arrow/table.h" -#include "arrow/type_fwd.h" +#include "arrow/type.h" #include "arrow/type_traits.h" -#include "arrow/util/bit-util.h" #include "arrow/util/checked_cast.h" -#include "arrow/util/decimal.h" #include "arrow/util/logging.h" #include "arrow/util/macros.h" #include "arrow/util/parallel.h" @@ -57,6 +55,8 @@ namespace arrow { +class MemoryPool; + using internal::checked_cast; using internal::ParallelFor; diff --git a/cpp/src/arrow/python/numpy_interop.h b/cpp/src/arrow/python/numpy_interop.h index b62c4e6..094c321 100644 --- a/cpp/src/arrow/python/numpy_interop.h +++ b/cpp/src/arrow/python/numpy_interop.h @@ -18,9 +18,9 @@ #ifndef PYARROW_NUMPY_INTEROP_H #define PYARROW_NUMPY_INTEROP_H -#include "arrow/python/platform.h" +#include "arrow/python/platform.h" // IWYU pragma: export -#include <numpy/numpyconfig.h> +#include <numpy/numpyconfig.h> // IWYU pragma: export // Don't use the deprecated Numpy functions #ifdef NPY_1_7_API_VERSION @@ -39,9 +39,9 @@ #define NO_IMPORT_ARRAY #endif -#include <numpy/arrayobject.h> -#include <numpy/arrayscalars.h> -#include <numpy/ufuncobject.h> +#include <numpy/arrayobject.h> // IWYU pragma: export +#include <numpy/arrayscalars.h> // IWYU pragma: export +#include <numpy/ufuncobject.h> // IWYU pragma: export // A bit subtle. Numpy has 5 canonical integer types: // (or, rather, type pairs: signed and unsigned) diff --git a/cpp/src/arrow/python/platform.h b/cpp/src/arrow/python/platform.h index ae39469..4dc944e 100644 --- a/cpp/src/arrow/python/platform.h +++ b/cpp/src/arrow/python/platform.h @@ -22,7 +22,7 @@ #define ARROW_PYTHON_PLATFORM_H #include <iostream> -#include <Python.h> +#include <Python.h> // IWYU pragma: export #include <datetime.h> // Work around C2528 error diff --git a/cpp/src/arrow/record_batch.h b/cpp/src/arrow/record_batch.h index 6fb747c..f6538f9 100644 --- a/cpp/src/arrow/record_batch.h +++ b/cpp/src/arrow/record_batch.h @@ -23,14 +23,14 @@ #include <string> #include <vector> -#include "arrow/array.h" #include "arrow/type.h" #include "arrow/util/macros.h" #include "arrow/util/visibility.h" namespace arrow { -class KeyValueMetadata; +class Array; +struct ArrayData; class Status; /// \class RecordBatch diff --git a/cpp/src/arrow/stl-test.cc b/cpp/src/arrow/stl-test.cc index c85baa3..6c33098 100644 --- a/cpp/src/arrow/stl-test.cc +++ b/cpp/src/arrow/stl-test.cc @@ -15,9 +15,15 @@ // specific language governing permissions and limitations // under the License. -#include "gtest/gtest.h" +#include <cstdint> +#include <memory> +#include <string> +#include <vector> + +#include <gtest/gtest.h> #include "arrow/stl.h" +#include "arrow/type.h" namespace arrow { namespace stl { diff --git a/cpp/src/arrow/table-test.cc b/cpp/src/arrow/table-test.cc index dfd8b63..178619b 100644 --- a/cpp/src/arrow/table-test.cc +++ b/cpp/src/arrow/table-test.cc @@ -15,11 +15,11 @@ // specific language governing permissions and limitations // under the License. +#include <cstdint> #include <memory> -#include <string> #include <vector> -#include "gtest/gtest.h" +#include <gtest/gtest.h> #include "arrow/array.h" #include "arrow/record_batch.h" diff --git a/cpp/src/arrow/table.h b/cpp/src/arrow/table.h index f80cf29..119e4e4 100644 --- a/cpp/src/arrow/table.h +++ b/cpp/src/arrow/table.h @@ -31,7 +31,7 @@ namespace arrow { -class KeyValueMetadata; +class MemoryPool; class Status; /// \class ChunkedArray diff --git a/cpp/src/arrow/table_builder-test.cc b/cpp/src/arrow/table_builder-test.cc index 74f5ce0..3341acd 100644 --- a/cpp/src/arrow/table_builder-test.cc +++ b/cpp/src/arrow/table_builder-test.cc @@ -15,16 +15,17 @@ // specific language governing permissions and limitations // under the License. +#include <cstddef> +#include <cstdint> #include <memory> #include <string> #include <vector> -#include "gtest/gtest.h" +#include <gtest/gtest.h> -#include "arrow/array.h" +#include "arrow/builder.h" #include "arrow/record_batch.h" #include "arrow/status.h" -#include "arrow/table.h" #include "arrow/table_builder.h" #include "arrow/test-common.h" #include "arrow/test-util.h" @@ -33,6 +34,8 @@ namespace arrow { +class Array; + using internal::checked_cast; class TestRecordBatchBuilder : public TestBase { diff --git a/cpp/src/arrow/table_builder.cc b/cpp/src/arrow/table_builder.cc index ef39d57..21d158f 100644 --- a/cpp/src/arrow/table_builder.cc +++ b/cpp/src/arrow/table_builder.cc @@ -17,17 +17,13 @@ #include "arrow/table_builder.h" -#include <algorithm> -#include <cstdlib> #include <memory> -#include <sstream> #include <utility> #include "arrow/array.h" #include "arrow/builder.h" #include "arrow/record_batch.h" #include "arrow/status.h" -#include "arrow/table.h" #include "arrow/type.h" #include "arrow/util/logging.h" diff --git a/cpp/src/arrow/table_builder.h b/cpp/src/arrow/table_builder.h index bd6b32b..8e7dfc1 100644 --- a/cpp/src/arrow/table_builder.h +++ b/cpp/src/arrow/table_builder.h @@ -20,20 +20,19 @@ #include <cstdint> #include <memory> -#include <string> #include <vector> +#include "arrow/builder.h" #include "arrow/status.h" #include "arrow/type.h" #include "arrow/util/checked_cast.h" +#include "arrow/util/macros.h" #include "arrow/util/visibility.h" namespace arrow { -class ArrayBuilder; class MemoryPool; class RecordBatch; -class Schema; /// \class RecordBatchBuilder /// \brief Helper class for creating record batches iteratively given a known diff --git a/cpp/src/arrow/tensor-test.cc b/cpp/src/arrow/tensor-test.cc index 196841c..ee82051 100644 --- a/cpp/src/arrow/tensor-test.cc +++ b/cpp/src/arrow/tensor-test.cc @@ -25,7 +25,6 @@ #include <gtest/gtest.h> #include "arrow/buffer.h" -#include "arrow/memory_pool.h" #include "arrow/tensor.h" #include "arrow/test-util.h" #include "arrow/type.h" diff --git a/cpp/src/arrow/tensor.cc b/cpp/src/arrow/tensor.cc index 7de7558..5b44a03 100644 --- a/cpp/src/arrow/tensor.cc +++ b/cpp/src/arrow/tensor.cc @@ -25,7 +25,6 @@ #include <vector> #include "arrow/compare.h" -#include "arrow/status.h" #include "arrow/type.h" #include "arrow/util/checked_cast.h" #include "arrow/util/logging.h" diff --git a/cpp/src/arrow/type-test.cc b/cpp/src/arrow/type-test.cc index 6291cf6..e0a1069 100644 --- a/cpp/src/arrow/type-test.cc +++ b/cpp/src/arrow/type-test.cc @@ -24,10 +24,8 @@ #include <gtest/gtest.h> -#include "arrow/test-util.h" #include "arrow/type.h" #include "arrow/util/checked_cast.h" -#include "arrow/util/key_value_metadata.h" using std::shared_ptr; using std::vector; diff --git a/cpp/src/arrow/type.cc b/cpp/src/arrow/type.cc index 21df342..5f1ca8d 100644 --- a/cpp/src/arrow/type.cc +++ b/cpp/src/arrow/type.cc @@ -18,7 +18,8 @@ #include "arrow/type.h" #include <climits> -#include <sstream> +#include <cstddef> +#include <sstream> // IWYU pragma: keep #include <string> #include <utility> #include <vector> diff --git a/cpp/src/arrow/type.h b/cpp/src/arrow/type.h index 8688c2a..63f0e2d 100644 --- a/cpp/src/arrow/type.h +++ b/cpp/src/arrow/type.h @@ -23,19 +23,23 @@ #include <memory> #include <ostream> #include <string> +#include <type_traits> #include <unordered_map> #include <vector> #include "arrow/status.h" #include "arrow/type_fwd.h" // IWYU pragma: export #include "arrow/util/checked_cast.h" -#include "arrow/util/key_value_metadata.h" +#include "arrow/util/key_value_metadata.h" // IWYU pragma: export #include "arrow/util/macros.h" #include "arrow/util/visibility.h" -#include "arrow/visitor.h" +#include "arrow/visitor.h" // IWYU pragma: keep namespace arrow { +class Array; +class Field; + /// \brief Main data type enumeration /// /// This enumeration provides a quick way to interrogate the category diff --git a/cpp/src/arrow/util/bit-util-test.cc b/cpp/src/arrow/util/bit-util-test.cc index 86c4933..b3ee19f 100644 --- a/cpp/src/arrow/util/bit-util-test.cc +++ b/cpp/src/arrow/util/bit-util-test.cc @@ -19,7 +19,6 @@ #include <cstdint> #include <cstring> #include <functional> -#include <initializer_list> #include <limits> #include <memory> #include <valarray> diff --git a/cpp/src/arrow/util/bit-util.cc b/cpp/src/arrow/util/bit-util.cc index a28d27f..7b7a726 100644 --- a/cpp/src/arrow/util/bit-util.cc +++ b/cpp/src/arrow/util/bit-util.cc @@ -24,17 +24,21 @@ #endif #include <algorithm> +#include <cstdint> #include <cstring> #include <functional> +#include <memory> #include <vector> #include "arrow/buffer.h" -#include "arrow/memory_pool.h" #include "arrow/status.h" #include "arrow/util/bit-util.h" #include "arrow/util/logging.h" namespace arrow { + +class MemoryPool; + namespace BitUtil { namespace { diff --git a/cpp/src/arrow/util/checked-cast-test.cc b/cpp/src/arrow/util/checked-cast-test.cc index 1045038..b50a859 100644 --- a/cpp/src/arrow/util/checked-cast-test.cc +++ b/cpp/src/arrow/util/checked-cast-test.cc @@ -16,6 +16,7 @@ // under the License. #include <type_traits> +#include <typeinfo> #include <gtest/gtest.h> diff --git a/cpp/src/arrow/util/compression_zlib.cc b/cpp/src/arrow/util/compression_zlib.cc index f1e9fb1..883b8fe 100644 --- a/cpp/src/arrow/util/compression_zlib.cc +++ b/cpp/src/arrow/util/compression_zlib.cc @@ -28,6 +28,7 @@ #include "arrow/status.h" #include "arrow/util/logging.h" +#include "arrow/util/macros.h" namespace arrow { namespace util { diff --git a/cpp/src/arrow/util/decimal-test.cc b/cpp/src/arrow/util/decimal-test.cc index 61884a1..94c2702 100644 --- a/cpp/src/arrow/util/decimal-test.cc +++ b/cpp/src/arrow/util/decimal-test.cc @@ -15,6 +15,9 @@ // specific language governing permissions and limitations // under the License. +#include <algorithm> +#include <array> +#include <cmath> #include <cstdint> #include <string> #include <tuple> @@ -24,6 +27,7 @@ #include "arrow/status.h" #include "arrow/test-util.h" #include "arrow/util/decimal.h" +#include "arrow/util/macros.h" namespace arrow { diff --git a/cpp/src/arrow/util/decimal.cc b/cpp/src/arrow/util/decimal.cc index 5d83653..9d22e00 100644 --- a/cpp/src/arrow/util/decimal.cc +++ b/cpp/src/arrow/util/decimal.cc @@ -16,17 +16,21 @@ // under the License. #include <algorithm> -#include <cctype> +#include <array> #include <climits> -#include <cmath> +#include <cstdint> +#include <cstdlib> #include <cstring> #include <iomanip> #include <limits> #include <sstream> +#include <string> +#include "arrow/status.h" #include "arrow/util/bit-util.h" #include "arrow/util/decimal.h" #include "arrow/util/logging.h" +#include "arrow/util/macros.h" namespace arrow { diff --git a/cpp/src/arrow/util/hash.cc b/cpp/src/arrow/util/hash.cc index bd28b2f..ce79710 100644 --- a/cpp/src/arrow/util/hash.cc +++ b/cpp/src/arrow/util/hash.cc @@ -17,6 +17,8 @@ #include "arrow/util/hash.h" +#include <algorithm> + #include "arrow/buffer.h" #include "arrow/status.h" diff --git a/cpp/src/arrow/util/io-util.cc b/cpp/src/arrow/util/io-util.cc index ddffce3..8db5db4 100644 --- a/cpp/src/arrow/util/io-util.cc +++ b/cpp/src/arrow/util/io-util.cc @@ -22,15 +22,17 @@ #define _FILE_OFFSET_BITS 64 -#include "arrow/util/windows_compatibility.h" +#include "arrow/util/windows_compatibility.h" // IWYU pragma: keep #include <algorithm> #include <cerrno> +#include <cstdint> +#include <cstring> #include <sstream> +#include <string> #include <fcntl.h> #include <stdlib.h> -#include <string.h> #include <sys/stat.h> #include <sys/types.h> // IWYU pragma: keep @@ -90,6 +92,7 @@ #endif +#include "arrow/status.h" #include "arrow/util/io-util.h" namespace arrow { diff --git a/cpp/src/arrow/util/key_value_metadata.cc b/cpp/src/arrow/util/key_value_metadata.cc index 04a4d62..0ab467f 100644 --- a/cpp/src/arrow/util/key_value_metadata.cc +++ b/cpp/src/arrow/util/key_value_metadata.cc @@ -17,8 +17,13 @@ #include <algorithm> #include <cstddef> +#include <cstdint> +#include <memory> #include <sstream> +#include <string> +#include <unordered_map> #include <utility> +#include <vector> #include "arrow/util/key_value_metadata.h" #include "arrow/util/logging.h" diff --git a/cpp/src/arrow/util/lazy-test.cc b/cpp/src/arrow/util/lazy-test.cc index af8a9ec..2f38e8e 100644 --- a/cpp/src/arrow/util/lazy-test.cc +++ b/cpp/src/arrow/util/lazy-test.cc @@ -16,6 +16,9 @@ // under the License. #include <algorithm> +#include <cstddef> +#include <cstdint> +#include <vector> #include <gtest/gtest.h> diff --git a/cpp/src/arrow/util/logging-test.cc b/cpp/src/arrow/util/logging-test.cc index 98efc4a..e604de7 100644 --- a/cpp/src/arrow/util/logging-test.cc +++ b/cpp/src/arrow/util/logging-test.cc @@ -16,11 +16,12 @@ // under the License. #include <chrono> -#include <cstdlib> +#include <cstdint> #include <iostream> +#include <gtest/gtest.h> + #include "arrow/util/logging.h" -#include "gtest/gtest.h" // This code is adapted from // https://github.com/ray-project/ray/blob/master/src/ray/util/logging_test.cc. diff --git a/cpp/src/arrow/util/parsing-util-test.cc b/cpp/src/arrow/util/parsing-util-test.cc index 9fa5ffb..7637a71 100644 --- a/cpp/src/arrow/util/parsing-util-test.cc +++ b/cpp/src/arrow/util/parsing-util-test.cc @@ -15,13 +15,13 @@ // specific language governing permissions and limitations // under the License. -#include <gtest/gtest.h> - #include <locale> +#include <stdexcept> #include <string> -#include "arrow/status.h" -#include "arrow/test-util.h" +#include <gtest/gtest.h> + +#include "arrow/type.h" #include "arrow/util/parsing.h" namespace arrow { diff --git a/cpp/src/arrow/util/task-group-test.cc b/cpp/src/arrow/util/task-group-test.cc index 3bca004..0ede4ff 100644 --- a/cpp/src/arrow/util/task-group-test.cc +++ b/cpp/src/arrow/util/task-group-test.cc @@ -15,20 +15,19 @@ // specific language governing permissions and limitations // under the License. -#ifndef _WIN32 -#include <sys/wait.h> -#include <unistd.h> -#endif - #include <atomic> #include <chrono> +#include <cstdint> +#include <functional> #include <memory> #include <random> +#include <thread> #include <vector> +#include <gtest/gtest.h> + #include "arrow/status.h" #include "arrow/test-util.h" -#include "arrow/util/macros.h" #include "arrow/util/task-group.h" #include "arrow/util/thread-pool.h" diff --git a/cpp/src/arrow/util/task-group.cc b/cpp/src/arrow/util/task-group.cc index dd551fa..3ea63fc 100644 --- a/cpp/src/arrow/util/task-group.cc +++ b/cpp/src/arrow/util/task-group.cc @@ -16,11 +16,14 @@ // under the License. #include "arrow/util/task-group.h" -#include "arrow/util/logging.h" -#include "arrow/util/thread-pool.h" +#include <condition_variable> +#include <cstdint> #include <mutex> +#include "arrow/util/logging.h" +#include "arrow/util/thread-pool.h" + namespace arrow { namespace internal { diff --git a/cpp/src/arrow/util/task-group.h b/cpp/src/arrow/util/task-group.h index 693432f..450b6da 100644 --- a/cpp/src/arrow/util/task-group.h +++ b/cpp/src/arrow/util/task-group.h @@ -24,6 +24,7 @@ #include "arrow/status.h" #include "arrow/util/macros.h" +#include "arrow/util/visibility.h" namespace arrow { namespace internal { diff --git a/cpp/src/arrow/util/thread-pool-test.cc b/cpp/src/arrow/util/thread-pool-test.cc index 99d4de2..6d7b9e2 100644 --- a/cpp/src/arrow/util/thread-pool-test.cc +++ b/cpp/src/arrow/util/thread-pool-test.cc @@ -22,11 +22,19 @@ #include <algorithm> #include <chrono> +#include <cstdint> +#include <cstdio> #include <cstdlib> #include <functional> +#include <future> +#include <memory> +#include <string> #include <thread> #include <vector> +#include <gtest/gtest.h> + +#include "arrow/status.h" #include "arrow/test-util.h" #include "arrow/util/io-util.h" #include "arrow/util/macros.h" diff --git a/cpp/src/arrow/util/thread-pool.cc b/cpp/src/arrow/util/thread-pool.cc index f3b05fd..751b264 100644 --- a/cpp/src/arrow/util/thread-pool.cc +++ b/cpp/src/arrow/util/thread-pool.cc @@ -16,8 +16,6 @@ // under the License. #include "arrow/util/thread-pool.h" -#include "arrow/util/io-util.h" -#include "arrow/util/logging.h" #include <algorithm> #include <condition_variable> @@ -25,6 +23,10 @@ #include <mutex> #include <string> #include <thread> +#include <vector> + +#include "arrow/util/io-util.h" +#include "arrow/util/logging.h" namespace arrow { namespace internal { diff --git a/cpp/src/arrow/util/thread-pool.h b/cpp/src/arrow/util/thread-pool.h index 4cc746d..f18cfeb 100644 --- a/cpp/src/arrow/util/thread-pool.h +++ b/cpp/src/arrow/util/thread-pool.h @@ -22,18 +22,20 @@ #include <unistd.h> #endif -#include <exception> +#include <cstdlib> #include <functional> #include <future> #include <iostream> #include <list> #include <memory> +#include <string> +#include <thread> #include <type_traits> #include <utility> -#include <vector> #include "arrow/status.h" #include "arrow/util/macros.h" +#include "arrow/util/visibility.h" namespace arrow { diff --git a/cpp/src/gandiva/arrow.h b/cpp/src/gandiva/arrow.h index cebcfb3..34cf517 100644 --- a/cpp/src/gandiva/arrow.h +++ b/cpp/src/gandiva/arrow.h @@ -21,6 +21,7 @@ #include <memory> #include <vector> +#include <arrow/array.h> #include <arrow/builder.h> #include <arrow/record_batch.h> #include <arrow/type.h> diff --git a/cpp/src/parquet/arrow/reader.cc b/cpp/src/parquet/arrow/reader.cc index da6061d..2006025 100644 --- a/cpp/src/parquet/arrow/reader.cc +++ b/cpp/src/parquet/arrow/reader.cc @@ -18,26 +18,30 @@ #include "parquet/arrow/reader.h" #include <algorithm> -#include <atomic> -#include <chrono> -#include <mutex> -#include <queue> +#include <climits> +#include <cstring> +#include <future> +#include <ostream> #include <string> -#include <thread> #include <type_traits> #include <utility> #include <vector> #include "arrow/api.h" #include "arrow/util/bit-util.h" -#include "arrow/util/decimal.h" #include "arrow/util/logging.h" #include "arrow/util/thread-pool.h" #include "parquet/arrow/record_reader.h" #include "parquet/arrow/schema.h" #include "parquet/column_reader.h" +#include "parquet/exception.h" +#include "parquet/file_reader.h" +#include "parquet/metadata.h" +#include "parquet/properties.h" #include "parquet/schema.h" +#include "parquet/types.h" +#include "parquet/util/memory.h" #include "parquet/util/schema-util.h" using arrow::Array; diff --git a/cpp/src/parquet/arrow/reader.h b/cpp/src/parquet/arrow/reader.h index 6eee0f6..2cd94ca 100644 --- a/cpp/src/parquet/arrow/reader.h +++ b/cpp/src/parquet/arrow/reader.h @@ -18,25 +18,32 @@ #ifndef PARQUET_ARROW_READER_H #define PARQUET_ARROW_READER_H +#include <cstdint> #include <memory> #include <vector> -#include "parquet/api/reader.h" -#include "parquet/api/schema.h" +#include "parquet/util/visibility.h" #include "arrow/io/interfaces.h" +#include "arrow/util/macros.h" namespace arrow { class Array; class MemoryPool; class RecordBatchReader; +class Schema; class Status; class Table; + } // namespace arrow namespace parquet { +class FileMetaData; +class ParquetFileReader; +class ReaderProperties; + namespace arrow { class ColumnChunkReader; diff --git a/cpp/src/parquet/arrow/record_reader.cc b/cpp/src/parquet/arrow/record_reader.cc index 3fbdfd5..ce6fa2a 100644 --- a/cpp/src/parquet/arrow/record_reader.cc +++ b/cpp/src/parquet/arrow/record_reader.cc @@ -19,21 +19,29 @@ #include <algorithm> #include <cstdint> +#include <cstring> #include <memory> #include <sstream> +#include <unordered_map> #include <utility> -#include <arrow/buffer.h> -#include <arrow/memory_pool.h> -#include <arrow/status.h> -#include <arrow/util/bit-util.h> -#include <arrow/util/rle-encoding.h> +#include "arrow/buffer.h" +#include "arrow/builder.h" +#include "arrow/memory_pool.h" +#include "arrow/status.h" +#include "arrow/type.h" +#include "arrow/util/bit-util.h" +#include "arrow/util/logging.h" +#include "arrow/util/rle-encoding.h" #include "parquet/column_page.h" #include "parquet/column_reader.h" #include "parquet/encoding-internal.h" +#include "parquet/encoding.h" #include "parquet/exception.h" #include "parquet/properties.h" +#include "parquet/schema.h" +#include "parquet/types.h" using arrow::MemoryPool; diff --git a/cpp/src/parquet/arrow/record_reader.h b/cpp/src/parquet/arrow/record_reader.h index 4935713..8da0709 100644 --- a/cpp/src/parquet/arrow/record_reader.h +++ b/cpp/src/parquet/arrow/record_reader.h @@ -19,22 +19,24 @@ #define PARQUET_RECORD_READER_H #include <cstdint> -#include <cstring> -#include <iostream> #include <memory> -#include <unordered_map> -#include <vector> -#include <arrow/buffer.h> -#include <arrow/builder.h> -#include <arrow/memory_pool.h> -#include <arrow/util/bit-util.h> +#include "arrow/memory_pool.h" -#include "parquet/column_reader.h" -#include "parquet/schema.h" #include "parquet/util/macros.h" +#include "parquet/util/memory.h" + +namespace arrow { + +class ArrayBuilder; + +} // namespace arrow namespace parquet { + +class ColumnDescriptor; +class PageReader; + namespace internal { /// \brief Stateful column reader that delimits semantic records for both flat diff --git a/cpp/src/parquet/arrow/schema.h b/cpp/src/parquet/arrow/schema.h index 3b212da..8e92085 100644 --- a/cpp/src/parquet/arrow/schema.h +++ b/cpp/src/parquet/arrow/schema.h @@ -18,14 +18,16 @@ #ifndef PARQUET_ARROW_SCHEMA_H #define PARQUET_ARROW_SCHEMA_H +#include <cstdint> #include <memory> #include <vector> #include "arrow/api.h" -#include "parquet/api/schema.h" -#include "parquet/api/writer.h" #include "parquet/arrow/writer.h" +#include "parquet/metadata.h" +#include "parquet/schema.h" +#include "parquet/util/visibility.h" namespace arrow { @@ -35,8 +37,12 @@ class Status; namespace parquet { +class WriterProperties; + namespace arrow { +class ArrowWriterProperties; + PARQUET_EXPORT ::arrow::Status NodeToField(const schema::Node& node, std::shared_ptr<::arrow::Field>* out); diff --git a/cpp/src/parquet/bloom_filter-test.cc b/cpp/src/parquet/bloom_filter-test.cc index 96d2e06..945f80b 100644 --- a/cpp/src/parquet/bloom_filter-test.cc +++ b/cpp/src/parquet/bloom_filter-test.cc @@ -17,13 +17,21 @@ #include <gtest/gtest.h> -#include <algorithm> +#include <cstdint> +#include <limits> +#include <memory> #include <random> #include <string> +#include <vector> +#include "arrow/buffer.h" #include "arrow/io/file.h" +#include "arrow/status.h" + #include "parquet/bloom_filter.h" +#include "parquet/exception.h" #include "parquet/murmur3.h" +#include "parquet/types.h" #include "parquet/util/memory.h" #include "parquet/util/test-common.h" diff --git a/cpp/src/parquet/file-deserialize-test.cc b/cpp/src/parquet/file-deserialize-test.cc index 31acbf1..17dfe38 100644 --- a/cpp/src/parquet/file-deserialize-test.cc +++ b/cpp/src/parquet/file-deserialize-test.cc @@ -17,16 +17,11 @@ #include <gtest/gtest.h> -#include <algorithm> #include <cstdint> -#include <cstdlib> #include <cstring> -#include <exception> #include <memory> -#include <string> -#include <vector> -#include "parquet/column_reader.h" +#include "parquet/column_page.h" #include "parquet/exception.h" #include "parquet/file_reader.h" #include "parquet/thrift.h" @@ -34,6 +29,8 @@ #include "parquet/util/memory.h" #include "parquet/util/test-common.h" +#include "arrow/io/memory.h" +#include "arrow/status.h" #include "arrow/util/compression.h" namespace parquet { diff --git a/cpp/src/parquet/public-api-test.cc b/cpp/src/parquet/public-api-test.cc index 958e970..c0ef97a 100644 --- a/cpp/src/parquet/public-api-test.cc +++ b/cpp/src/parquet/public-api-test.cc @@ -17,10 +17,10 @@ #include <gtest/gtest.h> -#include "parquet/api/io.h" -#include "parquet/api/reader.h" -#include "parquet/api/schema.h" -#include "parquet/api/writer.h" +#include "parquet/api/io.h" // IWYU pragma: keep +#include "parquet/api/reader.h" // IWYU pragma: keep +#include "parquet/api/schema.h" // IWYU pragma: keep +#include "parquet/api/writer.h" // IWYU pragma: keep TEST(TestPublicAPI, DoesNotIncludeThrift) { #ifdef _THRIFT_THRIFT_H_ diff --git a/cpp/src/parquet/thrift.h b/cpp/src/parquet/thrift.h index 217cc76..9c665ac 100644 --- a/cpp/src/parquet/thrift.h +++ b/cpp/src/parquet/thrift.h @@ -44,7 +44,7 @@ #include "parquet/exception.h" #include "parquet/util/memory.h" -#include "parquet/parquet_types.h" +#include "parquet/parquet_types.h" // IYWU pragma: export namespace parquet { diff --git a/dev/docker_common/Dockerfile.xenial.base b/dev/docker_common/Dockerfile.xenial.base index b2589de..49d9fd7 100644 --- a/dev/docker_common/Dockerfile.xenial.base +++ b/dev/docker_common/Dockerfile.xenial.base @@ -45,6 +45,7 @@ RUN wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh - pandas \ pytest \ cmake \ + double-conversion \ flatbuffers \ rapidjson \ boost-cpp \ @@ -52,10 +53,16 @@ RUN wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh - snappy \ zlib \ gflags \ + glog \ + gtest \ + re2 \ brotli \ jemalloc \ lz4-c \ zstd \ setuptools \ setuptools_scm \ - && conda clean --all \ No newline at end of file + && conda clean --all + +ADD docker_common/install_clang_tools_xenial.sh / +RUN /install_clang_tools_xenial.sh diff --git a/dev/docker_common/install_clang_tools_xenial.sh b/dev/docker_common/install_clang_tools_xenial.sh new file mode 100755 index 0000000..e35e3dc --- /dev/null +++ b/dev/docker_common/install_clang_tools_xenial.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +# 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. + +wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key|apt-key add - +apt-add-repository -y \ + "deb http://llvm.org/apt/xenial/ llvm-toolchain-xenial-6.0 main" +apt-get update -qq +apt-get install -y -q libclang-6.0-dev clang-6.0 clang-format-6.0 clang-tidy-6.0 diff --git a/dev/iwyu/Dockerfile b/dev/iwyu/Dockerfile index 3d93f90..8174720 100644 --- a/dev/iwyu/Dockerfile +++ b/dev/iwyu/Dockerfile @@ -17,7 +17,7 @@ FROM arrow_integration_xenial_base -ADD . /apache-arrow -WORKDIR /apache-arrow +ADD dev/iwyu/run_iwyu.sh /run_iwyu.sh -CMD arrow/dev/iwyu/run_iwyu.sh +WORKDIR /tmp +CMD /run_iwyu.sh \ No newline at end of file diff --git a/dev/iwyu/run_iwyu.sh b/dev/iwyu/run_iwyu.sh index ae0f761..9e2bd7e 100755 --- a/dev/iwyu/run_iwyu.sh +++ b/dev/iwyu/run_iwyu.sh @@ -18,8 +18,8 @@ # Set up environment and working directory CLANG_VERSION=6.0 -IWYU_BUILD_DIR=`pwd`/arrow/cpp/docker-iwyu -IWYU_SH=`pwd`/arrow/cpp/build-support/iwyu/iwyu.sh +IWYU_BUILD_DIR=/arrow/cpp/docker-iwyu +IWYU_SH=/arrow/cpp/build-support/iwyu/iwyu.sh IWYU_URL=https://github.com/include-what-you-use/include-what-you-use/archive/clang_$CLANG_VERSION.tar.gz rm -rf $IWYU_BUILD_DIR @@ -49,6 +49,8 @@ pushd iwyu-build # iwyu needs this apt-get install -y zlib1g-dev +source activate pyarrow-dev + cmake -G "Unix Makefiles" -DIWYU_LLVM_ROOT_PATH=/usr/lib/llvm-$CLANG_VERSION $IWYU_SRC make -j4 popd @@ -56,11 +58,15 @@ popd # Add iwyu and iwyu_tool.py to path export PATH=$IWYU_BUILD_DIR/iwyu-build:$PATH -conda activate pyarrow-dev +export ARROW_BUILD_TOOLCHAIN=$CONDA_PREFIX -cmake -GNinja -DARROW_PYTHON=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. +cmake -GNinja \ + -DARROW_PARQUET=ON \ + -DARROW_PYTHON=ON \ + -DCMAKE_CXX_FLAGS='-D_GLIBCXX_USE_CXX11_ABI=0' \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. # Make so that vendored bits are built -ninja +ninja arrow_shared $IWYU_SH all diff --git a/docker-compose.yml b/docker-compose.yml index e407e6e..62c3003 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -120,6 +120,15 @@ services: volumes: - .:/arrow:delegated + # Depends on xenial base image, see dev/README.md + iwyu: + image: arrow:iwyu + build: + context: . + dockerfile: dev/iwyu/Dockerfile + volumes: + - .:/arrow:delegated + clang-format: image: arrow:lint shm_size: 2G diff --git a/python/manylinux1/README.md b/python/manylinux1/README.md index 580aea3..de99f1c 100644 --- a/python/manylinux1/README.md +++ b/python/manylinux1/README.md @@ -39,7 +39,6 @@ ls -l dist/ ``` ### Updating the build environment - The base docker image is less often updated. In the case we want to update a dependency to a new version, we also need to adjust it. You can rebuild this image using
