This is an automated email from the ASF dual-hosted git repository.

apitrou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new df9dbbc985 GH-48588 [C++] Migrate to stdlib span (#49492)
df9dbbc985 is described below

commit df9dbbc9858fcdc5b5f52545fcedc2c0f492173c
Author: PaweÅ‚ Biegun <[email protected]>
AuthorDate: Tue Mar 24 04:47:30 2026 -0700

    GH-48588 [C++] Migrate to stdlib span (#49492)
    
    ### Rationale for this change
    C++ 20 already includes a span implementation so there is no reason to 
maintain a custom one in utils as described in #48588
    
    ### What changes are included in this PR?
    arrow::utils::span definition and tests are removed and usages are replaced 
with std::span. Some span comparisons in tests are replaced from ASSERT_EQ to 
ASSERT_TRUE(std::ranges::equal(span1, span2)) because ASSERT_EQ inernally 
relies on == operator which is not defined for some types that we used to 
compare.
    
    ### Are these changes tested?
    Yes
    
    ### Are there any user-facing changes?
    No
    * GitHub Issue: #48588
    
    Lead-authored-by: PaweÅ‚ Biegun <[email protected]>
    Co-authored-by: Will Ayd <[email protected]>
    Signed-off-by: Antoine Pitrou <[email protected]>
---
 cpp/src/arrow/array/concatenate.cc                 |   3 +-
 cpp/src/arrow/array/data.cc                        |   7 +-
 cpp/src/arrow/array/data.h                         |  12 +-
 cpp/src/arrow/array/util.cc                        |   2 +-
 cpp/src/arrow/array/validate.cc                    |   9 +-
 cpp/src/arrow/buffer.h                             |  10 +-
 cpp/src/arrow/c/bridge.cc                          |   3 +-
 cpp/src/arrow/c/bridge_test.cc                     |   5 +-
 cpp/src/arrow/chunk_resolver.cc                    |  11 +-
 cpp/src/arrow/chunk_resolver.h                     |   4 +-
 cpp/src/arrow/compute/kernels/aggregate_pivot.cc   |   1 -
 cpp/src/arrow/compute/kernels/chunked_internal.cc  |   3 +-
 cpp/src/arrow/compute/kernels/chunked_internal.h   |  12 +-
 cpp/src/arrow/compute/kernels/hash_aggregate.cc    |   2 -
 .../compute/kernels/hash_aggregate_numeric.cc      |   1 -
 .../arrow/compute/kernels/hash_aggregate_pivot.cc  |  10 +-
 cpp/src/arrow/compute/kernels/pivot_internal.cc    |   2 -
 cpp/src/arrow/compute/kernels/vector_rank.cc       |   5 +-
 cpp/src/arrow/compute/kernels/vector_sort.cc       |   8 +-
 .../arrow/compute/kernels/vector_sort_internal.h   |   3 +-
 cpp/src/arrow/integration/json_internal.cc         |   9 +-
 cpp/src/arrow/util/CMakeLists.txt                  |   1 -
 cpp/src/arrow/util/binary_view_util.h              |   1 -
 cpp/src/arrow/util/bitmap.h                        |   8 +-
 cpp/src/arrow/util/bitmap_builders.cc              |   5 +-
 cpp/src/arrow/util/bitmap_builders.h               |   4 +-
 cpp/src/arrow/util/float16_test.cc                 |  14 +-
 cpp/src/arrow/util/meson.build                     |   2 -
 cpp/src/arrow/util/rle_encoding_test.cc            |   8 +-
 cpp/src/arrow/util/secure_string.cc                |   7 +-
 cpp/src/arrow/util/secure_string.h                 |   6 +-
 cpp/src/arrow/util/secure_string_test.cc           |  12 +-
 cpp/src/arrow/util/span.h                          | 132 -------------
 cpp/src/arrow/util/span_test.cc                    | 204 ---------------------
 cpp/src/parquet/column_writer.cc                   |   3 +-
 cpp/src/parquet/encoding_test.cc                   |  39 ++--
 cpp/src/parquet/encryption/encryption.h            |   3 +-
 cpp/src/parquet/encryption/encryption_internal.cc  | 112 +++++------
 cpp/src/parquet/encryption/encryption_internal.h   |  23 +--
 .../encryption/encryption_internal_nossl.cc        |  26 +--
 .../parquet/encryption/encryption_internal_test.cc |   4 +-
 .../parquet/encryption/internal_file_decryptor.cc  |   6 +-
 .../parquet/encryption/internal_file_decryptor.h   |   4 +-
 .../parquet/encryption/internal_file_encryptor.cc  |   8 +-
 .../parquet/encryption/internal_file_encryptor.h   |   4 +-
 cpp/src/parquet/encryption/key_toolkit_internal.cc |   6 +-
 cpp/src/parquet/geospatial/util_internal.cc        |   7 +-
 cpp/src/parquet/geospatial/util_internal.h         |  13 +-
 cpp/src/parquet/metadata.cc                        |  14 +-
 cpp/src/parquet/size_statistics.cc                 |   7 +-
 cpp/src/parquet/size_statistics.h                  |   5 +-
 cpp/src/parquet/size_statistics_test.cc            |   1 -
 cpp/src/parquet/stream_writer.h                    |   5 +-
 cpp/src/parquet/thrift_internal.h                  |   6 +-
 54 files changed, 246 insertions(+), 576 deletions(-)

diff --git a/cpp/src/arrow/array/concatenate.cc 
b/cpp/src/arrow/array/concatenate.cc
index 2b832b977f..999cbd1c87 100644
--- a/cpp/src/arrow/array/concatenate.cc
+++ b/cpp/src/arrow/array/concatenate.cc
@@ -22,6 +22,7 @@
 #include <cstdint>
 #include <limits>
 #include <memory>
+#include <span>
 #include <utility>
 #include <vector>
 
@@ -424,7 +425,7 @@ class ConcatenateImpl {
     out_->buffers.resize(2);
 
     for (const auto& in_data : in_) {
-      for (const auto& buf : util::span(in_data->buffers).subspan(2)) {
+      for (const auto& buf : std::span(in_data->buffers).subspan(2)) {
         out_->buffers.push_back(buf);
       }
     }
diff --git a/cpp/src/arrow/array/data.cc b/cpp/src/arrow/array/data.cc
index 1c56a48506..cb7959174a 100644
--- a/cpp/src/arrow/array/data.cc
+++ b/cpp/src/arrow/array/data.cc
@@ -21,6 +21,7 @@
 #include <cstddef>
 #include <cstdint>
 #include <memory>
+#include <span>
 #include <string>
 #include <utility>
 #include <vector>
@@ -102,7 +103,7 @@ bool DictionaryMayHaveLogicalNulls(const ArrayData& data) {
 
 namespace {
 
-BufferSpan PackVariadicBuffers(util::span<const std::shared_ptr<Buffer>> 
buffers) {
+BufferSpan PackVariadicBuffers(std::span<const std::shared_ptr<Buffer>> 
buffers) {
   return {const_cast<uint8_t*>(reinterpret_cast<const 
uint8_t*>(buffers.data())),
           static_cast<int64_t>(buffers.size() * 
sizeof(std::shared_ptr<Buffer>))};
 }
@@ -322,7 +323,7 @@ void ArraySpan::SetMembers(const ArrayData& data) {
 
   if (type_id == Type::STRING_VIEW || type_id == Type::BINARY_VIEW) {
     // store the span of data buffers in the third buffer
-    this->buffers[2] = 
internal::PackVariadicBuffers(util::span(data.buffers).subspan(2));
+    this->buffers[2] = 
internal::PackVariadicBuffers(std::span(data.buffers).subspan(2));
   }
 
   if (type_id == Type::DICTIONARY) {
@@ -679,7 +680,7 @@ std::shared_ptr<ArrayData> ArraySpan::ToArrayData() const {
   return result;
 }
 
-util::span<const std::shared_ptr<Buffer>> ArraySpan::GetVariadicBuffers() 
const {
+std::span<const std::shared_ptr<Buffer>> ArraySpan::GetVariadicBuffers() const 
{
   DCHECK(HasVariadicBuffers());
   return {buffers[2].data_as<std::shared_ptr<Buffer>>(),
           static_cast<size_t>(buffers[2].size) / 
sizeof(std::shared_ptr<Buffer>)};
diff --git a/cpp/src/arrow/array/data.h b/cpp/src/arrow/array/data.h
index c6636df9bb..52d303f5c6 100644
--- a/cpp/src/arrow/array/data.h
+++ b/cpp/src/arrow/array/data.h
@@ -21,6 +21,7 @@
 #include <cassert>
 #include <cstdint>
 #include <memory>
+#include <span>
 #include <utility>
 #include <vector>
 
@@ -31,7 +32,6 @@
 #include "arrow/type_fwd.h"
 #include "arrow/util/bit_util.h"
 #include "arrow/util/macros.h"
-#include "arrow/util/span.h"
 #include "arrow/util/visibility.h"
 
 namespace arrow {
@@ -577,11 +577,11 @@ struct ARROW_EXPORT ArraySpan {
   /// this array type
   /// \return A span<const T> of the requested length
   template <typename T>
-  util::span<const T> GetSpan(int i, int64_t length) const {
+  std::span<const T> GetSpan(int i, int64_t length) const {
     const int64_t buffer_length = buffers[i].size / 
static_cast<int64_t>(sizeof(T));
     assert(i > 0 && length + offset <= buffer_length);
     ARROW_UNUSED(buffer_length);
-    return util::span<const T>(buffers[i].data_as<T>() + this->offset, length);
+    return std::span<const T>(buffers[i].data_as<T>() + this->offset, length);
   }
 
   /// \brief Access a buffer's data as a span
@@ -593,11 +593,11 @@ struct ARROW_EXPORT ArraySpan {
   /// this array type
   /// \return A span<T> of the requested length
   template <typename T>
-  util::span<T> GetSpan(int i, int64_t length) {
+  std::span<T> GetSpan(int i, int64_t length) {
     const int64_t buffer_length = buffers[i].size / 
static_cast<int64_t>(sizeof(T));
     assert(i > 0 && length + offset <= buffer_length);
     ARROW_UNUSED(buffer_length);
-    return util::span<T>(buffers[i].mutable_data_as<T>() + this->offset, 
length);
+    return std::span<T>(buffers[i].mutable_data_as<T>() + this->offset, 
length);
   }
 
   inline bool IsNull(int64_t i) const { return !IsValid(i); }
@@ -709,7 +709,7 @@ struct ARROW_EXPORT ArraySpan {
   /// sizeof(shared_ptr<Buffer>).
   ///
   /// \see HasVariadicBuffers
-  util::span<const std::shared_ptr<Buffer>> GetVariadicBuffers() const;
+  std::span<const std::shared_ptr<Buffer>> GetVariadicBuffers() const;
   bool HasVariadicBuffers() const;
 
  private:
diff --git a/cpp/src/arrow/array/util.cc b/cpp/src/arrow/array/util.cc
index 03d8c32c4e..1c19bd5a54 100644
--- a/cpp/src/arrow/array/util.cc
+++ b/cpp/src/arrow/array/util.cc
@@ -23,6 +23,7 @@
 #include <cstring>
 #include <limits>
 #include <memory>
+#include <span>
 #include <type_traits>
 #include <utility>
 #include <vector>
@@ -44,7 +45,6 @@
 #include "arrow/util/endian.h"
 #include "arrow/util/logging_internal.h"
 #include "arrow/util/sort_internal.h"
-#include "arrow/util/span.h"
 #include "arrow/visit_data_inline.h"
 #include "arrow/visit_type_inline.h"
 
diff --git a/cpp/src/arrow/array/validate.cc b/cpp/src/arrow/array/validate.cc
index bd0d00126d..c1d96375bf 100644
--- a/cpp/src/arrow/array/validate.cc
+++ b/cpp/src/arrow/array/validate.cc
@@ -17,6 +17,7 @@
 
 #include "arrow/array/validate.h"
 
+#include <span>
 #include <vector>
 
 #include "arrow/array.h"  // IWYU pragma: keep
@@ -650,9 +651,9 @@ struct ValidateArrayImpl {
                              HexEncode(data, BinaryViewType::kPrefixSize));
     };
 
-    util::span views(data.GetValues<BinaryViewType::c_type>(1),
-                     static_cast<size_t>(data.length));
-    util::span data_buffers(data.buffers.data() + 2, data.buffers.size() - 2);
+    std::span views(data.GetValues<BinaryViewType::c_type>(1),
+                    static_cast<size_t>(data.length));
+    std::span data_buffers(data.buffers.data() + 2, data.buffers.size() - 2);
 
     for (size_t i = 0; i < static_cast<size_t>(data.length); ++i) {
       if (data.IsNull(i)) continue;
@@ -663,7 +664,7 @@ struct ValidateArrayImpl {
       }
 
       if (views[i].is_inline()) {
-        auto padding_bytes = 
util::span(views[i].inlined.data).subspan(views[i].size());
+        auto padding_bytes = 
std::span(views[i].inlined.data).subspan(views[i].size());
         for (auto padding_byte : padding_bytes) {
           if (padding_byte != 0) {
             return Status::Invalid("View at slot ", i, " was inline with size 
",
diff --git a/cpp/src/arrow/buffer.h b/cpp/src/arrow/buffer.h
index ce909a3ea1..a2c8412082 100644
--- a/cpp/src/arrow/buffer.h
+++ b/cpp/src/arrow/buffer.h
@@ -21,6 +21,7 @@
 #include <cstring>
 #include <memory>
 #include <optional>
+#include <span>
 #include <string>
 #include <string_view>
 #include <utility>
@@ -30,7 +31,6 @@
 #include "arrow/status.h"
 #include "arrow/type_fwd.h"
 #include "arrow/util/macros.h"
-#include "arrow/util/span.h"
 #include "arrow/util/visibility.h"
 
 namespace arrow {
@@ -236,8 +236,8 @@ class ARROW_EXPORT Buffer {
 
   /// \brief Return the buffer's data as a span
   template <typename T>
-  util::span<const T> span_as() const {
-    return util::span(data_as<T>(), static_cast<size_t>(size() / sizeof(T)));
+  std::span<const T> span_as() const {
+    return std::span(data_as<T>(), static_cast<size_t>(size() / sizeof(T)));
   }
 
   /// \brief Return a writable pointer to the buffer's data
@@ -269,8 +269,8 @@ class ARROW_EXPORT Buffer {
 
   /// \brief Return the buffer's mutable data as a span
   template <typename T>
-  util::span<T> mutable_span_as() {
-    return util::span(mutable_data_as<T>(), static_cast<size_t>(size() / 
sizeof(T)));
+  std::span<T> mutable_span_as() {
+    return std::span(mutable_data_as<T>(), static_cast<size_t>(size() / 
sizeof(T)));
   }
 
   /// \brief Return the device address of the buffer's data
diff --git a/cpp/src/arrow/c/bridge.cc b/cpp/src/arrow/c/bridge.cc
index dd25ed299d..82e74098d2 100644
--- a/cpp/src/arrow/c/bridge.cc
+++ b/cpp/src/arrow/c/bridge.cc
@@ -24,6 +24,7 @@
 #include <memory>
 #include <mutex>
 #include <queue>
+#include <span>
 #include <string>
 #include <string_view>
 #include <utility>
@@ -603,7 +604,7 @@ struct ArrayExporter {
                    });
 
     if (need_variadic_buffer_sizes) {
-      auto variadic_buffers = util::span(data->buffers).subspan(2);
+      auto variadic_buffers = std::span(data->buffers).subspan(2);
       export_.variadic_buffer_sizes_.resize(variadic_buffers.size());
       size_t i = 0;
       for (const auto& buf : variadic_buffers) {
diff --git a/cpp/src/arrow/c/bridge_test.cc b/cpp/src/arrow/c/bridge_test.cc
index c6a5e01e03..cb204806f9 100644
--- a/cpp/src/arrow/c/bridge_test.cc
+++ b/cpp/src/arrow/c/bridge_test.cc
@@ -18,6 +18,7 @@
 #include <cerrno>
 #include <deque>
 #include <functional>
+#include <span>
 #include <string>
 #include <string_view>
 #include <type_traits>
@@ -592,8 +593,8 @@ struct ArrayExportChecker {
       ASSERT_EQ(c_export->buffers[i], expected_ptr);
     }
     if (has_variadic_buffer_sizes) {
-      auto variadic_buffers = util::span(expected_data.buffers).subspan(2);
-      auto variadic_buffer_sizes = util::span(
+      auto variadic_buffers = std::span(expected_data.buffers).subspan(2);
+      auto variadic_buffer_sizes = std::span(
           static_cast<const int64_t*>(c_export->buffers[c_export->n_buffers - 
1]),
           variadic_buffers.size());
       for (auto [buf, size] : Zip(variadic_buffers, variadic_buffer_sizes)) {
diff --git a/cpp/src/arrow/chunk_resolver.cc b/cpp/src/arrow/chunk_resolver.cc
index 7fc259f38c..07ad807be6 100644
--- a/cpp/src/arrow/chunk_resolver.cc
+++ b/cpp/src/arrow/chunk_resolver.cc
@@ -21,6 +21,7 @@
 #include <cstdint>
 #include <limits>
 #include <memory>
+#include <span>
 #include <vector>
 
 #include "arrow/array.h"
@@ -28,8 +29,6 @@
 
 namespace arrow {
 
-using util::span;
-
 namespace {
 template <typename T>
 int64_t GetLength(const T& array) {
@@ -44,7 +43,7 @@ int64_t GetLength<std::shared_ptr<RecordBatch>>(
 }
 
 template <typename T>
-inline std::vector<int64_t> MakeChunksOffsets(span<T> chunks) {
+inline std::vector<int64_t> MakeChunksOffsets(std::span<T> chunks) {
   std::vector<int64_t> offsets(chunks.size() + 1);
   int64_t offset = 0;
   std::transform(chunks.begin(), chunks.end(), offsets.begin(),
@@ -114,13 +113,13 @@ void ResolveManyInline(uint32_t num_offsets, const 
int64_t* signed_offsets,
 }  // namespace
 
 ChunkResolver::ChunkResolver(const ArrayVector& chunks) noexcept
-    : offsets_(MakeChunksOffsets(span(chunks))), cached_chunk_(0) {}
+    : offsets_(MakeChunksOffsets(std::span(chunks))), cached_chunk_(0) {}
 
-ChunkResolver::ChunkResolver(span<const Array* const> chunks) noexcept
+ChunkResolver::ChunkResolver(std::span<const Array* const> chunks) noexcept
     : offsets_(MakeChunksOffsets(chunks)), cached_chunk_(0) {}
 
 ChunkResolver::ChunkResolver(const RecordBatchVector& batches) noexcept
-    : offsets_(MakeChunksOffsets(span(batches))), cached_chunk_(0) {}
+    : offsets_(MakeChunksOffsets(std::span(batches))), cached_chunk_(0) {}
 
 ChunkResolver::ChunkResolver(ChunkResolver&& other) noexcept
     : offsets_(std::move(other.offsets_)),
diff --git a/cpp/src/arrow/chunk_resolver.h b/cpp/src/arrow/chunk_resolver.h
index 3d6458167f..fbf84876e3 100644
--- a/cpp/src/arrow/chunk_resolver.h
+++ b/cpp/src/arrow/chunk_resolver.h
@@ -21,12 +21,12 @@
 #include <cassert>
 #include <cstdint>
 #include <limits>
+#include <span>
 #include <type_traits>
 #include <vector>
 
 #include "arrow/type_fwd.h"
 #include "arrow/util/macros.h"
-#include "arrow/util/span.h"
 
 namespace arrow {
 
@@ -77,7 +77,7 @@ class ARROW_EXPORT ChunkResolver {
 
  public:
   explicit ChunkResolver(const ArrayVector& chunks) noexcept;
-  explicit ChunkResolver(util::span<const Array* const> chunks) noexcept;
+  explicit ChunkResolver(std::span<const Array* const> chunks) noexcept;
   explicit ChunkResolver(const RecordBatchVector& batches) noexcept;
 
   /// \brief Construct a ChunkResolver from a vector of chunks.size() + 1 
offsets.
diff --git a/cpp/src/arrow/compute/kernels/aggregate_pivot.cc 
b/cpp/src/arrow/compute/kernels/aggregate_pivot.cc
index 504c7cdd26..50047f5ef1 100644
--- a/cpp/src/arrow/compute/kernels/aggregate_pivot.cc
+++ b/cpp/src/arrow/compute/kernels/aggregate_pivot.cc
@@ -29,7 +29,6 @@ namespace arrow::compute::internal {
 namespace {
 
 using arrow::internal::VisitSetBitRunsVoid;
-using arrow::util::span;
 
 struct PivotImpl : public ScalarAggregator {
   Status Init(const PivotWiderOptions& options, const std::vector<TypeHolder>& 
in_types,
diff --git a/cpp/src/arrow/compute/kernels/chunked_internal.cc 
b/cpp/src/arrow/compute/kernels/chunked_internal.cc
index bf574fcafd..39495ea0e6 100644
--- a/cpp/src/arrow/compute/kernels/chunked_internal.cc
+++ b/cpp/src/arrow/compute/kernels/chunked_internal.cc
@@ -18,6 +18,7 @@
 #include "arrow/compute/kernels/chunked_internal.h"
 
 #include <algorithm>
+#include <span>
 
 #include "arrow/record_batch.h"
 #include "arrow/util/logging_internal.h"
@@ -32,7 +33,7 @@ std::vector<const Array*> GetArrayPointers(const ArrayVector& 
arrays) {
 }
 
 std::vector<int64_t> ChunkedIndexMapper::GetChunkLengths(
-    util::span<const Array* const> chunks) {
+    std::span<const Array* const> chunks) {
   std::vector<int64_t> chunk_lengths(chunks.size());
   for (int64_t i = 0; i < static_cast<int64_t>(chunks.size()); ++i) {
     chunk_lengths[i] = chunks[i]->length();
diff --git a/cpp/src/arrow/compute/kernels/chunked_internal.h 
b/cpp/src/arrow/compute/kernels/chunked_internal.h
index 330bd185f2..2dcfa0047e 100644
--- a/cpp/src/arrow/compute/kernels/chunked_internal.h
+++ b/cpp/src/arrow/compute/kernels/chunked_internal.h
@@ -20,13 +20,13 @@
 #include <algorithm>
 #include <cstdint>
 #include <memory>
+#include <span>
 #include <utility>
 #include <vector>
 
 #include "arrow/array.h"
 #include "arrow/chunk_resolver.h"
 #include "arrow/compute/kernels/codegen_internal.h"
-#include "arrow/util/span.h"
 #include "arrow/util/visibility.h"
 
 namespace arrow::compute::internal {
@@ -92,13 +92,13 @@ static_assert(sizeof(uint64_t) == 
sizeof(CompressedChunkLocation));
 class ChunkedArrayResolver {
  private:
   ChunkResolver resolver_;
-  util::span<const Array* const> chunks_;
+  std::span<const Array* const> chunks_;
   std::vector<const Array*> owned_chunks_;
 
  public:
   explicit ChunkedArrayResolver(std::vector<const Array*>&& chunks)
       : resolver_(chunks), chunks_(chunks), owned_chunks_(std::move(chunks)) {}
-  explicit ChunkedArrayResolver(util::span<const Array* const> chunks)
+  explicit ChunkedArrayResolver(std::span<const Array* const> chunks)
       : resolver_(chunks), chunks_(chunks) {}
 
   ARROW_DEFAULT_MOVE_AND_ASSIGN(ChunkedArrayResolver);
@@ -129,8 +129,8 @@ class ARROW_EXPORT ChunkedIndexMapper {
  public:
   ChunkedIndexMapper(const std::vector<const Array*>& chunks, uint64_t* 
indices_begin,
                      uint64_t* indices_end)
-      : ChunkedIndexMapper(util::span(chunks), indices_begin, indices_end) {}
-  ChunkedIndexMapper(util::span<const Array* const> chunks, uint64_t* 
indices_begin,
+      : ChunkedIndexMapper(std::span(chunks), indices_begin, indices_end) {}
+  ChunkedIndexMapper(std::span<const Array* const> chunks, uint64_t* 
indices_begin,
                      uint64_t* indices_end)
       : chunk_lengths_(GetChunkLengths(chunks)),
         indices_begin_(indices_begin),
@@ -154,7 +154,7 @@ class ARROW_EXPORT ChunkedIndexMapper {
   Status PhysicalToLogical();
 
  private:
-  static std::vector<int64_t> GetChunkLengths(util::span<const Array* const> 
chunks);
+  static std::vector<int64_t> GetChunkLengths(std::span<const Array* const> 
chunks);
   static std::vector<int64_t> GetChunkLengths(const RecordBatchVector& chunks);
 
   std::vector<int64_t> chunk_lengths_;
diff --git a/cpp/src/arrow/compute/kernels/hash_aggregate.cc 
b/cpp/src/arrow/compute/kernels/hash_aggregate.cc
index 3ab7ff065b..73ae31f7ea 100644
--- a/cpp/src/arrow/compute/kernels/hash_aggregate.cc
+++ b/cpp/src/arrow/compute/kernels/hash_aggregate.cc
@@ -45,14 +45,12 @@
 #include "arrow/util/checked_cast.h"
 #include "arrow/util/int_util_overflow.h"
 #include "arrow/util/ree_util.h"
-#include "arrow/util/span.h"
 #include "arrow/visit_type_inline.h"
 
 namespace arrow::compute::internal {
 
 using ::arrow::internal::checked_cast;
 using ::arrow::internal::FirstTimeBitmapWriter;
-using ::arrow::util::span;
 
 namespace {
 
diff --git a/cpp/src/arrow/compute/kernels/hash_aggregate_numeric.cc 
b/cpp/src/arrow/compute/kernels/hash_aggregate_numeric.cc
index aa231430aa..30504ba87b 100644
--- a/cpp/src/arrow/compute/kernels/hash_aggregate_numeric.cc
+++ b/cpp/src/arrow/compute/kernels/hash_aggregate_numeric.cc
@@ -32,7 +32,6 @@
 #include "arrow/compute/row/grouper.h"
 #include "arrow/util/checked_cast.h"
 #include "arrow/util/int128_internal.h"
-#include "arrow/util/span.h"
 #include "arrow/util/tdigest_internal.h"
 #include "arrow/visit_type_inline.h"
 
diff --git a/cpp/src/arrow/compute/kernels/hash_aggregate_pivot.cc 
b/cpp/src/arrow/compute/kernels/hash_aggregate_pivot.cc
index f60aa367ca..030a862afc 100644
--- a/cpp/src/arrow/compute/kernels/hash_aggregate_pivot.cc
+++ b/cpp/src/arrow/compute/kernels/hash_aggregate_pivot.cc
@@ -18,6 +18,7 @@
 #include <cmath>
 #include <functional>
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
@@ -33,13 +34,10 @@
 #include "arrow/util/bit_block_counter.h"
 #include "arrow/util/checked_cast.h"
 #include "arrow/util/logging_internal.h"
-#include "arrow/util/span.h"
 #include "arrow/visit_type_inline.h"
 
 namespace arrow::compute::internal {
 
-using ::arrow::util::span;
-
 namespace {
 
 // ----------------------------------------------------------------------
@@ -57,7 +55,7 @@ struct GroupedPivotAccumulator {
     return Status::OK();
   }
 
-  Status Consume(span<const uint32_t> groups, const 
std::shared_ptr<ArrayData>& keys,
+  Status Consume(std::span<const uint32_t> groups, const 
std::shared_ptr<ArrayData>& keys,
                  const ArraySpan& values) {
     // To dispatch the values into the right (group, key) coordinates,
     // we first compute a vector of take indices for each output column.
@@ -178,8 +176,8 @@ struct GroupedPivotAccumulator {
     return MergeColumns(std::move(new_columns));
   }
 
-  Status Consume(span<const uint32_t> groups, 
std::optional<PivotWiderKeyIndex> maybe_key,
-                 const ArraySpan& values) {
+  Status Consume(std::span<const uint32_t> groups,
+                 std::optional<PivotWiderKeyIndex> maybe_key, const ArraySpan& 
values) {
     if (!maybe_key.has_value()) {
       // Nothing to update
       return Status::OK();
diff --git a/cpp/src/arrow/compute/kernels/pivot_internal.cc 
b/cpp/src/arrow/compute/kernels/pivot_internal.cc
index e9065152d7..c9ccc7d607 100644
--- a/cpp/src/arrow/compute/kernels/pivot_internal.cc
+++ b/cpp/src/arrow/compute/kernels/pivot_internal.cc
@@ -37,8 +37,6 @@
 
 namespace arrow::compute::internal {
 
-using ::arrow::util::span;
-
 struct ConcretePivotWiderKeyMapper : public PivotWiderKeyMapper {
   Status Init(const DataType& key_type, const PivotWiderOptions* options,
               ExecContext* ctx) {
diff --git a/cpp/src/arrow/compute/kernels/vector_rank.cc 
b/cpp/src/arrow/compute/kernels/vector_rank.cc
index ef7419ea7c..adac794902 100644
--- a/cpp/src/arrow/compute/kernels/vector_rank.cc
+++ b/cpp/src/arrow/compute/kernels/vector_rank.cc
@@ -27,8 +27,6 @@
 
 namespace arrow::compute::internal {
 
-using ::arrow::util::span;
-
 namespace {
 
 // ----------------------------------------------------------------------
@@ -103,7 +101,8 @@ Result<NullPartitionResult> DoSortAndMarkDuplicate(
                                          physical_chunks, order, 
null_placement));
   if (needs_duplicates) {
     const auto arrays = GetArrayPointers(physical_chunks);
-    auto value_selector = [resolver = 
ChunkedArrayResolver(span(arrays))](int64_t index) {
+    auto value_selector = [resolver =
+                               
ChunkedArrayResolver(std::span(arrays))](int64_t index) {
       return resolver.Resolve(index).Value<ArrowType>();
     };
     MarkDuplicates(sorted, value_selector);
diff --git a/cpp/src/arrow/compute/kernels/vector_sort.cc 
b/cpp/src/arrow/compute/kernels/vector_sort.cc
index 41cb0a357a..3befb7a144 100644
--- a/cpp/src/arrow/compute/kernels/vector_sort.cc
+++ b/cpp/src/arrow/compute/kernels/vector_sort.cc
@@ -15,6 +15,7 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <span>
 #include <unordered_set>
 
 #include "arrow/compute/function.h"
@@ -26,7 +27,6 @@
 namespace arrow {
 
 using internal::checked_cast;
-using util::span;
 
 namespace compute {
 namespace internal {
@@ -177,7 +177,8 @@ class ChunkedArraySorter : public TypeVisitor {
   template <typename ArrayType>
   void MergeNonNulls(CompressedChunkLocation* range_begin,
                      CompressedChunkLocation* range_middle,
-                     CompressedChunkLocation* range_end, span<const Array* 
const> arrays,
+                     CompressedChunkLocation* range_end,
+                     std::span<const Array* const> arrays,
                      CompressedChunkLocation* temp_indices) {
     using ArrowType = typename ArrayType::TypeClass;
 
@@ -202,7 +203,8 @@ class ChunkedArraySorter : public TypeVisitor {
   }
 
   template <typename ArrowType>
-  auto ChunkValue(span<const Array* const> arrays, CompressedChunkLocation 
loc) const {
+  auto ChunkValue(std::span<const Array* const> arrays,
+                  CompressedChunkLocation loc) const {
     return ResolvedChunk(arrays[loc.chunk_index()],
                          static_cast<int64_t>(loc.index_in_chunk()))
         .template Value<ArrowType>();
diff --git a/cpp/src/arrow/compute/kernels/vector_sort_internal.h 
b/cpp/src/arrow/compute/kernels/vector_sort_internal.h
index 49704ff806..93ff9b1920 100644
--- a/cpp/src/arrow/compute/kernels/vector_sort_internal.h
+++ b/cpp/src/arrow/compute/kernels/vector_sort_internal.h
@@ -21,6 +21,7 @@
 #include <cmath>
 #include <cstdint>
 #include <functional>
+#include <span>
 
 #include "arrow/array.h"
 #include "arrow/compute/api_vector.h"
@@ -272,7 +273,7 @@ NullPartitionResult PartitionNullsOnly(uint64_t* 
indices_begin, uint64_t* indice
 template <typename Partitioner>
 ChunkedNullPartitionResult PartitionNullsOnly(CompressedChunkLocation* 
locations_begin,
                                               CompressedChunkLocation* 
locations_end,
-                                              util::span<const Array* const> 
chunks,
+                                              std::span<const Array* const> 
chunks,
                                               int64_t null_count,
                                               NullPlacement null_placement) {
   if (null_count == 0) {
diff --git a/cpp/src/arrow/integration/json_internal.cc 
b/cpp/src/arrow/integration/json_internal.cc
index 4b0fc69393..2dc6b36118 100644
--- a/cpp/src/arrow/integration/json_internal.cc
+++ b/cpp/src/arrow/integration/json_internal.cc
@@ -22,6 +22,7 @@
 #include <iomanip>
 #include <iostream>
 #include <memory>
+#include <span>
 #include <string>
 #include <type_traits>
 #include <utility>
@@ -48,7 +49,6 @@
 #include "arrow/util/key_value_metadata.h"
 #include "arrow/util/logging_internal.h"
 #include "arrow/util/range.h"
-#include "arrow/util/span.h"
 #include "arrow/util/string.h"
 #include "arrow/util/value_parsing.h"
 #include "arrow/visit_array_inline.h"
@@ -1461,11 +1461,10 @@ class ArrayReader {
                           GetMemberArray(obj_, "VARIADIC_DATA_BUFFERS"));
 
     using internal::Zip;
-    using util::span;
 
     BufferVector buffers;
     buffers.resize(json_variadic_bufs.Size() + 2);
-    for (auto [json_buf, buf] : Zip(json_variadic_bufs, 
span{buffers}.subspan(2))) {
+    for (auto [json_buf, buf] : Zip(json_variadic_bufs, 
std::span{buffers}.subspan(2))) {
       ARROW_ASSIGN_OR_RAISE(auto hex_string, GetStringView(json_buf));
       ARROW_ASSIGN_OR_RAISE(
           buf, AllocateBuffer(static_cast<int64_t>(hex_string.size()) / 2, 
pool_));
@@ -1482,8 +1481,8 @@ class ArrayReader {
     ARROW_ASSIGN_OR_RAISE(
         buffers[1], AllocateBuffer(length_ * sizeof(BinaryViewType::c_type), 
pool_));
 
-    span views{buffers[1]->mutable_data_as<BinaryViewType::c_type>(),
-               static_cast<size_t>(length_)};
+    std::span views{buffers[1]->mutable_data_as<BinaryViewType::c_type>(),
+                    static_cast<size_t>(length_)};
 
     int64_t null_count = 0;
     for (auto [json_view, out_view, is_valid] : Zip(json_views, views, 
is_valid_)) {
diff --git a/cpp/src/arrow/util/CMakeLists.txt 
b/cpp/src/arrow/util/CMakeLists.txt
index a41b63f07b..4352716ebd 100644
--- a/cpp/src/arrow/util/CMakeLists.txt
+++ b/cpp/src/arrow/util/CMakeLists.txt
@@ -74,7 +74,6 @@ add_arrow_test(utility-test
                rows_to_batches_test.cc
                secure_string_test.cc
                small_vector_test.cc
-               span_test.cc
                stl_util_test.cc
                string_test.cc
                tdigest_test.cc
diff --git a/cpp/src/arrow/util/binary_view_util.h 
b/cpp/src/arrow/util/binary_view_util.h
index eb079e2c54..3eae84bd0f 100644
--- a/cpp/src/arrow/util/binary_view_util.h
+++ b/cpp/src/arrow/util/binary_view_util.h
@@ -21,7 +21,6 @@
 #include <utility>
 
 #include "arrow/type.h"
-#include "arrow/util/span.h"
 
 namespace arrow::util {
 
diff --git a/cpp/src/arrow/util/bitmap.h b/cpp/src/arrow/util/bitmap.h
index 141d558c3a..49f319081f 100644
--- a/cpp/src/arrow/util/bitmap.h
+++ b/cpp/src/arrow/util/bitmap.h
@@ -24,6 +24,7 @@
 #include <cstdint>
 #include <cstring>
 #include <memory>
+#include <span>
 #include <string>
 #include <string_view>
 #include <utility>
@@ -36,7 +37,6 @@
 #include "arrow/util/compare.h"
 #include "arrow/util/endian.h"
 #include "arrow/util/functional.h"
-#include "arrow/util/span.h"
 #include "arrow/util/string_util.h"
 #include "arrow/util/visibility.h"
 
@@ -155,7 +155,7 @@ class ARROW_EXPORT Bitmap : public 
util::ToStringOstreamable<Bitmap>,
     Bitmap bitmaps[N];
     int64_t offsets[N];
     int64_t bit_length = BitLength(bitmaps_arg, N);
-    util::span<const Word> words[N];
+    std::span<const Word> words[N];
     for (size_t i = 0; i < N; ++i) {
       bitmaps[i] = bitmaps_arg[i];
       offsets[i] = bitmaps[i].template word_offset<Word>();
@@ -384,7 +384,7 @@ class ARROW_EXPORT Bitmap : public 
util::ToStringOstreamable<Bitmap>,
   int64_t length() const { return length_; }
 
   /// span of all bytes which contain any bit in this Bitmap
-  util::span<const uint8_t> bytes() const {
+  std::span<const uint8_t> bytes() const {
     auto byte_offset = offset_ / 8;
     auto byte_count = bit_util::CeilDiv(offset_ + length_, 8) - byte_offset;
     return {data_ + byte_offset, static_cast<size_t>(byte_count)};
@@ -404,7 +404,7 @@ class ARROW_EXPORT Bitmap : public 
util::ToStringOstreamable<Bitmap>,
   /// \warning The words may contain bytes which lie outside the buffer or are
   /// uninitialized.
   template <typename Word>
-  util::span<const Word> words() const {
+  std::span<const Word> words() const {
     auto bytes_addr = reinterpret_cast<intptr_t>(bytes().data());
     auto words_addr = bytes_addr - bytes_addr % sizeof(Word);
     auto word_byte_count =
diff --git a/cpp/src/arrow/util/bitmap_builders.cc 
b/cpp/src/arrow/util/bitmap_builders.cc
index 000dda718d..5fadddc630 100644
--- a/cpp/src/arrow/util/bitmap_builders.cc
+++ b/cpp/src/arrow/util/bitmap_builders.cc
@@ -20,6 +20,7 @@
 #include <cstdint>
 #include <cstring>
 #include <memory>
+#include <span>
 #include <type_traits>
 #include <utility>
 
@@ -33,7 +34,7 @@ namespace internal {
 
 namespace {
 
-void FillBitsFromBytes(util::span<const uint8_t> bytes, uint8_t* bits) {
+void FillBitsFromBytes(std::span<const uint8_t> bytes, uint8_t* bits) {
   for (size_t i = 0; i < bytes.size(); ++i) {
     if (bytes[i] > 0) {
       bit_util::SetBit(bits, i);
@@ -43,7 +44,7 @@ void FillBitsFromBytes(util::span<const uint8_t> bytes, 
uint8_t* bits) {
 
 }  // namespace
 
-Result<std::shared_ptr<Buffer>> BytesToBits(util::span<const uint8_t> bytes,
+Result<std::shared_ptr<Buffer>> BytesToBits(std::span<const uint8_t> bytes,
                                             MemoryPool* pool) {
   int64_t bit_length = bit_util::BytesForBits(bytes.size());
 
diff --git a/cpp/src/arrow/util/bitmap_builders.h 
b/cpp/src/arrow/util/bitmap_builders.h
index 4bf2edfdcb..ae9ea35047 100644
--- a/cpp/src/arrow/util/bitmap_builders.h
+++ b/cpp/src/arrow/util/bitmap_builders.h
@@ -19,11 +19,11 @@
 
 #include <cstdint>
 #include <memory>
+#include <span>
 #include <vector>
 
 #include "arrow/result.h"
 #include "arrow/type_fwd.h"
-#include "arrow/util/span.h"
 #include "arrow/util/visibility.h"
 
 namespace arrow {
@@ -37,7 +37,7 @@ Result<std::shared_ptr<Buffer>> BitmapAllButOne(MemoryPool* 
pool, int64_t length
 
 /// \brief Convert vector of bytes to bitmap buffer
 ARROW_EXPORT
-Result<std::shared_ptr<Buffer>> BytesToBits(util::span<const uint8_t> bytes,
+Result<std::shared_ptr<Buffer>> BytesToBits(std::span<const uint8_t> bytes,
                                             MemoryPool* pool = 
default_memory_pool());
 
 }  // namespace internal
diff --git a/cpp/src/arrow/util/float16_test.cc 
b/cpp/src/arrow/util/float16_test.cc
index 5918381a26..284bf71883 100644
--- a/cpp/src/arrow/util/float16_test.cc
+++ b/cpp/src/arrow/util/float16_test.cc
@@ -17,6 +17,7 @@
 
 #include <array>
 #include <cmath>
+#include <span>
 #include <utility>
 
 #include <gtest/gtest.h>
@@ -24,7 +25,6 @@
 #include "arrow/testing/gtest_util.h"
 #include "arrow/util/endian.h"
 #include "arrow/util/float16.h"
-#include "arrow/util/span.h"
 #include "arrow/util/ubsan.h"
 
 namespace arrow::util {
@@ -45,7 +45,7 @@ class Float16ConversionTest : public ::testing::Test {
     T output;
   };
 
-  static void TestRoundTrip(span<const RoundTripTestCase> test_cases) {
+  static void TestRoundTrip(std::span<const RoundTripTestCase> test_cases) {
     for (size_t index = 0; index < test_cases.size(); ++index) {
       ARROW_SCOPED_TRACE("i=", index);
       const auto& tc = test_cases[index];
@@ -61,7 +61,7 @@ class Float16ConversionTest : public ::testing::Test {
     }
   }
 
-  static void TestRoundTripFromNaN(span<const T> test_cases) {
+  static void TestRoundTripFromNaN(std::span<const T> test_cases) {
     for (size_t i = 0; i < test_cases.size(); ++i) {
       ARROW_SCOPED_TRACE("i=", i);
       const auto input = test_cases[i];
@@ -143,7 +143,7 @@ void Float16ConversionTest<float>::TestRoundTrip() {
       {Limits<float>::lowest(), 0b1111110000000000u, 
-Limits<float>::infinity()},
   };
 
-  TestRoundTrip(span(test_cases, std::size(test_cases)));
+  TestRoundTrip(std::span(test_cases, std::size(test_cases)));
 }
 
 template <>
@@ -182,7 +182,7 @@ void Float16ConversionTest<double>::TestRoundTrip() {
       {Limits<double>::lowest(), 0b1111110000000000u, 
-Limits<double>::infinity()},
   };
 
-  TestRoundTrip(span(test_cases, std::size(test_cases)));
+  TestRoundTrip(std::span(test_cases, std::size(test_cases)));
 }
 
 template <>
@@ -190,7 +190,7 @@ void Float16ConversionTest<float>::TestRoundTripFromNaN() {
   const float test_cases[] = {
       Limits<float>::quiet_NaN(), F32(0x7f800001u), F32(0xff800001u), 
F32(0x7fc00000u),
       F32(0xffc00000u),           F32(0x7fffffffu), F32(0xffffffffu)};
-  TestRoundTripFromNaN(span(test_cases, std::size(test_cases)));
+  TestRoundTripFromNaN(std::span(test_cases, std::size(test_cases)));
 }
 
 template <>
@@ -199,7 +199,7 @@ void Float16ConversionTest<double>::TestRoundTripFromNaN() {
                                F64(0xfff0000000000001u),    
F64(0x7ff8000000000000u),
                                F64(0xfff8000000000000u),    
F64(0x7fffffffffffffffu),
                                F64(0xffffffffffffffffu)};
-  TestRoundTripFromNaN(span(test_cases, std::size(test_cases)));
+  TestRoundTripFromNaN(std::span(test_cases, std::size(test_cases)));
 }
 
 using NativeFloatTypes = ::testing::Types<float, double>;
diff --git a/cpp/src/arrow/util/meson.build b/cpp/src/arrow/util/meson.build
index ccccd68d1f..e21537b0d4 100644
--- a/cpp/src/arrow/util/meson.build
+++ b/cpp/src/arrow/util/meson.build
@@ -159,7 +159,6 @@ install_headers(
         'rows_to_batches.h',
         'simd.h',
         'small_vector.h',
-        'span.h',
         'string_util.h',
         'string.h',
         'task_group.h',
@@ -210,7 +209,6 @@ utility_test_srcs = [
     'reflection_test.cc',
     'rows_to_batches_test.cc',
     'small_vector_test.cc',
-    'span_test.cc',
     'stl_util_test.cc',
     'string_test.cc',
     'tdigest_test.cc',
diff --git a/cpp/src/arrow/util/rle_encoding_test.cc 
b/cpp/src/arrow/util/rle_encoding_test.cc
index f33c71c0ad..788450c67c 100644
--- a/cpp/src/arrow/util/rle_encoding_test.cc
+++ b/cpp/src/arrow/util/rle_encoding_test.cc
@@ -21,6 +21,7 @@
 #include <cstdint>
 #include <cstring>
 #include <random>
+#include <span>
 #include <vector>
 
 #include <gtest/gtest.h>
@@ -36,7 +37,6 @@
 #include "arrow/util/bit_util.h"
 #include "arrow/util/io_util.h"
 #include "arrow/util/rle_encoding_internal.h"
-#include "arrow/util/span.h"
 
 namespace arrow::util {
 
@@ -463,7 +463,7 @@ void TestRleBitPackedParser(std::vector<uint8_t> bytes, 
rle_size_t bit_width,
   EXPECT_EQ(decoded, expected);
 }
 
-void TestRleBitPackedParserError(span<const uint8_t> bytes, rle_size_t 
bit_width) {
+void TestRleBitPackedParserError(std::span<const uint8_t> bytes, rle_size_t 
bit_width) {
   auto parser =
       RleBitPackedParser(bytes.data(), static_cast<rle_size_t>(bytes.size()), 
bit_width);
   EXPECT_FALSE(parser.exhausted());
@@ -483,7 +483,7 @@ void TestRleBitPackedParserError(span<const uint8_t> bytes, 
rle_size_t bit_width
 
 void TestRleBitPackedParserError(const std::vector<uint8_t>& bytes,
                                  rle_size_t bit_width) {
-  TestRleBitPackedParserError(span(bytes), bit_width);
+  TestRleBitPackedParserError(std::span(bytes), bit_width);
 }
 
 TEST(RleBitPacked, RleBitPackedParser) {
@@ -632,7 +632,7 @@ TEST(RleBitPacked, RleBitPackedParserErrors) {
   // (we pass a span<> on invalid memory, but only the reachable part should 
be read)
   std::vector<uint8_t> bytes = {0x81, 0x80, 0x80, 0x80, 0x02};
   TestRleBitPackedParserError(
-      /* bytes= */ span(bytes.data(), 1ULL << 30),
+      /* bytes= */ std::span(bytes.data(), 1ULL << 30),
       /* bit_width= */ 1);
 }
 
diff --git a/cpp/src/arrow/util/secure_string.cc 
b/cpp/src/arrow/util/secure_string.cc
index bd52c55f31..b3c5abb58f 100644
--- a/cpp/src/arrow/util/secure_string.cc
+++ b/cpp/src/arrow/util/secure_string.cc
@@ -31,9 +31,10 @@
 #  include <windows.h>
 #endif
 
+#include <span>
+
 #include "arrow/util/logging.h"
 #include "arrow/util/secure_string.h"
-#include "arrow/util/span.h"
 
 namespace arrow::util {
 
@@ -181,11 +182,11 @@ std::size_t SecureString::length() const { return 
secret_.length(); }
 
 std::size_t SecureString::capacity() const { return secret_.capacity(); }
 
-span<uint8_t> SecureString::as_span() {
+std::span<uint8_t> SecureString::as_span() {
   return {reinterpret_cast<uint8_t*>(secret_.data()), secret_.size()};
 }
 
-span<const uint8_t> SecureString::as_span() const {
+std::span<const uint8_t> SecureString::as_span() const {
   return {reinterpret_cast<const uint8_t*>(secret_.data()), secret_.size()};
 }
 
diff --git a/cpp/src/arrow/util/secure_string.h 
b/cpp/src/arrow/util/secure_string.h
index 30088c78d4..36602c6a92 100644
--- a/cpp/src/arrow/util/secure_string.h
+++ b/cpp/src/arrow/util/secure_string.h
@@ -18,9 +18,9 @@
 #pragma once
 
 #include <cstdint>
+#include <span>
 #include <string>
 
-#include "arrow/util/span.h"
 #include "arrow/util/visibility.h"
 
 namespace arrow::util {
@@ -56,8 +56,8 @@ class ARROW_EXPORT SecureString {
   [[nodiscard]] std::size_t length() const;
   [[nodiscard]] std::size_t capacity() const;
 
-  [[nodiscard]] span<uint8_t> as_span();
-  [[nodiscard]] span<const uint8_t> as_span() const;
+  [[nodiscard]] std::span<uint8_t> as_span();
+  [[nodiscard]] std::span<const uint8_t> as_span() const;
   [[nodiscard]] std::string_view as_view() const;
 
   void Dispose();
diff --git a/cpp/src/arrow/util/secure_string_test.cc 
b/cpp/src/arrow/util/secure_string_test.cc
index 213a4b11f2..f2dfda5ca6 100644
--- a/cpp/src/arrow/util/secure_string_test.cc
+++ b/cpp/src/arrow/util/secure_string_test.cc
@@ -17,6 +17,7 @@
 
 #include <gtest/gtest.h>
 #include <algorithm>
+#include <span>
 #include <vector>
 
 #include "arrow/util/secure_string.h"
@@ -475,16 +476,17 @@ TEST(TestSecureString, AsSpan) {
   auto mutable_span = secret.as_span();
 
   std::string expected = "hello world";
-  span expected_span = {reinterpret_cast<uint8_t*>(expected.data()), 
expected.size()};
-  ASSERT_EQ(const_span, expected_span);
-  ASSERT_EQ(mutable_span, expected_span);
+  std::span expected_span = {reinterpret_cast<uint8_t*>(expected.data()),
+                             expected.size()};
+  ASSERT_TRUE(std::ranges::equal(const_span, expected_span));
+  ASSERT_TRUE(std::ranges::equal(mutable_span, expected_span));
 
   // modify secret through mutual span
   // the const span shares the same secret, so it is changed as well
   mutable_span[0] = 'H';
   expected_span[0] = 'H';
-  ASSERT_EQ(const_span, expected_span);
-  ASSERT_EQ(mutable_span, expected_span);
+  ASSERT_TRUE(std::ranges::equal(const_span, expected_span));
+  ASSERT_TRUE(std::ranges::equal(mutable_span, expected_span));
 }
 
 TEST(TestSecureString, AsView) {
diff --git a/cpp/src/arrow/util/span.h b/cpp/src/arrow/util/span.h
deleted file mode 100644
index abe8e61beb..0000000000
--- a/cpp/src/arrow/util/span.h
+++ /dev/null
@@ -1,132 +0,0 @@
-// 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
-
-#include <cstddef>
-#include <cstdint>
-#include <cstring>
-#include <iterator>
-#include <type_traits>
-
-namespace arrow::util {
-
-template <class T>
-class span;
-
-/// std::span polyfill.
-///
-/// Does not support static extents.
-template <typename T>
-class span {
-  static_assert(sizeof(T),
-                R"(
-std::span allows contiguous_iterators instead of just pointers, the enforcement
-of which requires T to be a complete type. arrow::util::span does not support
-contiguous_iterators, but T is still required to be a complete type to prevent
-writing code which would break when it is replaced by std::span.)");
-
- public:
-  using element_type = T;
-  using value_type = std::remove_cv_t<T>;
-  using iterator = T*;
-  using const_iterator = const T*;
-
-  span() = default;
-  span(const span&) = default;
-  span& operator=(const span&) = default;
-
-  template <typename M, typename = std::enable_if_t<std::is_same_v<T, const 
M>>>
-  // NOLINTNEXTLINE runtime/explicit
-  constexpr span(span<M> mut) : span{mut.data(), mut.size()} {}
-
-  constexpr span(T* data, size_t count) : data_{data}, size_{count} {}
-
-  constexpr span(T* begin, T* end)
-      : data_{begin}, size_{static_cast<size_t>(end - begin)} {}
-
-  template <typename R, typename RD = decltype(std::data(std::declval<R>())),
-            typename RS = decltype(std::size(std::declval<R>())),
-            typename E = std::enable_if_t<std::is_constructible_v<T*, RD> &&
-                                          std::is_constructible_v<size_t, RS>>>
-  // NOLINTNEXTLINE runtime/explicit, non-const reference
-  constexpr span(R&& range) : data_{std::data(range)}, size_{std::size(range)} 
{}
-
-  constexpr T* begin() const { return data_; }
-  constexpr T* end() const { return data_ + size_; }
-  constexpr T* data() const { return data_; }
-
-  constexpr size_t size() const { return size_; }
-  constexpr size_t size_bytes() const { return size_ * sizeof(T); }
-  constexpr bool empty() const { return size_ == 0; }
-
-  constexpr T& operator[](size_t i) { return data_[i]; }
-  constexpr const T& operator[](size_t i) const { return data_[i]; }
-
-  constexpr span subspan(size_t offset) const {
-    if (offset > size_) return {data_, data_};
-    return {data_ + offset, size_ - offset};
-  }
-
-  constexpr span subspan(size_t offset, size_t count) const {
-    auto out = subspan(offset);
-    if (count < out.size_) {
-      out.size_ = count;
-    }
-    return out;
-  }
-
-  constexpr bool operator==(const span& other) const {
-    if (size_ != other.size_) return false;
-
-    if constexpr (std::is_integral_v<T>) {
-      if (size_ == 0) {
-        return true;  // memcmp does not handle null pointers, even if size_ 
== 0
-      }
-      return std::memcmp(data_, other.data_, size_bytes()) == 0;
-    } else {
-      T* ptr = data_;
-      for (const T& e : other) {
-        if (*ptr++ != e) return false;
-      }
-      return true;
-    }
-  }
-  constexpr bool operator!=(const span& other) const { return !(*this == 
other); }
-
- private:
-  T* data_{};
-  size_t size_{};
-};
-
-template <typename R>
-span(R& range) -> span<std::remove_pointer_t<decltype(std::data(range))>>;
-
-template <typename T>
-span(T*, size_t) -> span<T>;
-
-template <typename T>
-constexpr span<const std::byte> as_bytes(span<T> s) {
-  return {reinterpret_cast<const std::byte*>(s.data()), s.size_bytes()};
-}
-
-template <typename T>
-constexpr span<std::byte> as_writable_bytes(span<T> s) {
-  return {reinterpret_cast<std::byte*>(s.data()), s.size_bytes()};
-}
-
-}  // namespace arrow::util
diff --git a/cpp/src/arrow/util/span_test.cc b/cpp/src/arrow/util/span_test.cc
deleted file mode 100644
index 01460c2bd0..0000000000
--- a/cpp/src/arrow/util/span_test.cc
+++ /dev/null
@@ -1,204 +0,0 @@
-// 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.
-
-#include <cstddef>
-#include <iostream>
-
-#include <gtest/gtest.h>
-
-#include "arrow/testing/gtest_util.h"
-#include "arrow/testing/matchers.h"
-#include "arrow/util/span.h"
-
-using testing::ElementsAre;
-using testing::ElementsAreArray;
-using testing::PrintToString;
-
-namespace arrow::util {
-
-template <typename T>
-std::ostream& operator<<(std::ostream& os, const span<T>& span) {
-  // Inefficient but good enough for testing
-  os << PrintToString(std::vector(span.begin(), span.end()));
-  return os;
-}
-
-TEST(Span, Construction) {
-  // const spans may be constructed from mutable spans
-  static_assert(std::is_constructible_v<span<const int>, span<int>>);
-  // ... but mutable spans may be constructed from const spans
-  static_assert(!std::is_constructible_v<span<int>, span<const int>>);
-
-  int arr[] = {1, 2, 3};
-  constexpr int const_arr[] = {7, 8, 9};
-
-  static_assert(std::is_constructible_v<span<int>, decltype(arr)&>);
-  static_assert(!std::is_constructible_v<span<int>, decltype(const_arr)&>);
-
-  static_assert(std::is_constructible_v<span<const int>, decltype(arr)&>);
-  static_assert(std::is_constructible_v<span<const int>, 
decltype(const_arr)&>);
-
-  static_assert(std::is_constructible_v<span<int>, std::vector<int>&>);
-  static_assert(!std::is_constructible_v<span<int>, const std::vector<int>&>);
-  static_assert(!std::is_constructible_v<span<int>, std::vector<int>&&>);
-
-  static_assert(std::is_constructible_v<span<const int>, std::vector<int>&>);
-  static_assert(std::is_constructible_v<span<const int>, const 
std::vector<int>&>);
-  // const spans may even be constructed from rvalue ranges
-  static_assert(std::is_constructible_v<span<const int>, std::vector<int>&&>);
-
-  EXPECT_THAT(span<const int>(const_arr), ElementsAreArray(const_arr));
-  EXPECT_THAT(span<int>(arr), ElementsAreArray(arr));
-
-  static_assert(!std::is_constructible_v<span<const unsigned>, 
decltype(const_arr)&>);
-  static_assert(!std::is_constructible_v<span<const std::byte>, 
decltype(const_arr)&>);
-}
-
-TEST(Span, TemplateArgumentDeduction) {
-  int arr[3];
-  const int const_arr[] = {1, 2, 3};
-  std::vector<int> vec;
-  const std::vector<int> const_vec;
-  static_assert(std::is_same_v<decltype(span(arr)), span<int>>);
-  static_assert(std::is_same_v<decltype(span(vec)), span<int>>);
-  static_assert(std::is_same_v<decltype(span(const_arr)), span<const int>>);
-  static_assert(std::is_same_v<decltype(span(const_vec)), span<const int>>);
-}
-
-TEST(Span, Size) {
-  int arr[] = {1, 2, 3};
-  EXPECT_EQ(span(arr).size(), 3);
-  EXPECT_EQ(span(arr).size_bytes(), sizeof(int) * 3);
-
-  std::vector<int> vec;
-  EXPECT_TRUE(span(vec).empty());
-  EXPECT_EQ(span(vec).size(), 0);
-  EXPECT_EQ(span(vec).size_bytes(), 0);
-
-  vec.resize(999);
-  EXPECT_FALSE(span(vec).empty());
-  EXPECT_EQ(span(vec).size(), 999);
-  EXPECT_EQ(span(vec).size_bytes(), sizeof(int) * 999);
-}
-
-TEST(Span, Equality) {
-  auto check_eq = [](auto l, auto r) {
-    ARROW_SCOPED_TRACE("l = ", l, ", r = ", r);
-    EXPECT_TRUE(l == r);
-    EXPECT_FALSE(l != r);
-  };
-  auto check_ne = [](auto l, auto r) {
-    ARROW_SCOPED_TRACE("l = ", l, ", r = ", r);
-    EXPECT_TRUE(l != r);
-    EXPECT_FALSE(l == r);
-  };
-
-  {
-    // exercise integral branch with memcmp
-    check_eq(span<int>(), span<int>());
-
-    int arr[] = {1, 2, 3};
-    check_eq(span(arr), span(arr));
-    check_eq(span(arr).subspan(1), span(arr).subspan(1));
-    check_ne(span(arr).subspan(1), span(arr).subspan(2));
-
-    std::vector<int> vec{1, 2, 3};
-    check_eq(span(vec), span(arr));
-    check_eq(span(vec).subspan(1), span(arr).subspan(1));
-
-    vec = {2, 3, 4};
-    check_ne(span(vec), span(arr));
-    check_eq(span(vec).subspan(0, 2), span(arr).subspan(1));
-
-    // 0-sized
-    vec = {};
-    check_ne(span(vec), span(arr));
-    check_eq(span(vec), span(arr).subspan(3));
-  }
-  {
-    // exercise non-integral branch with for loop
-    check_eq(span<std::string>(), span<std::string>());
-
-    std::string arr[] = {"a", "b", "c"};
-    check_eq(span(arr), span(arr));
-    check_eq(span(arr).subspan(1), span(arr).subspan(1));
-
-    std::vector<std::string> vec{"a", "b", "c"};
-    check_eq(span(vec), span(arr));
-    check_eq(span(vec).subspan(1), span(arr).subspan(1));
-
-    vec = {"b", "c", "d"};
-    check_ne(span(vec), span(arr));
-    check_eq(span(vec).subspan(0, 2), span(arr).subspan(1));
-
-    // 0-sized
-    vec = {};
-    check_ne(span(vec), span(arr));
-    check_eq(span(vec), span(arr).subspan(3));
-  }
-}
-
-TEST(Span, SubSpan) {
-  int arr[] = {1, 2, 3};
-  span s(arr);
-
-  auto ExpectIdentical = [](span<int> l, span<int> r) {
-    EXPECT_EQ(l.data(), r.data());
-    EXPECT_EQ(l.size(), r.size());
-  };
-
-  ExpectIdentical(s.subspan(0), s);
-  ExpectIdentical(s.subspan(0, s.size()), s);
-
-  for (size_t offset = 0; offset < s.size(); ++offset) {
-    span expected(arr + offset, s.size() - offset);
-    ExpectIdentical(s.subspan(offset), expected);
-    ExpectIdentical(s.subspan(offset, s.size() * 3), expected);
-  }
-  EXPECT_TRUE(s.subspan(s.size()).empty());
-  EXPECT_TRUE(s.subspan(s.size() * 3).empty());
-
-  for (size_t length = 0; length < s.size(); ++length) {
-    span expected(arr, length);
-    ExpectIdentical(s.subspan(0, length), expected);
-  }
-
-  ExpectIdentical(s.subspan(1, 1), span(arr + 1, 1));
-}
-
-TEST(Span, Mutation) {
-  size_t arr[] = {9, 9, 9, 9, 9};
-
-  span s(arr);
-  for (size_t i = 0; i < s.size(); ++i) {
-    s[i] = i * i;
-  }
-
-  EXPECT_THAT(arr, ElementsAre(0, 1, 4, 9, 16));
-
-  auto set = [](span<size_t> lhs, size_t rhs) {
-    for (size_t& i : lhs) {
-      i = rhs;
-    }
-  };
-  set(span(arr), 0);
-  set(span(arr).subspan(1), 1);
-  set(span(arr).subspan(2, 2), 23);
-  EXPECT_THAT(arr, ElementsAre(0, 1, 23, 23, 1));
-}
-
-}  // namespace arrow::util
diff --git a/cpp/src/parquet/column_writer.cc b/cpp/src/parquet/column_writer.cc
index 797d435e73..1f1197f95a 100644
--- a/cpp/src/parquet/column_writer.cc
+++ b/cpp/src/parquet/column_writer.cc
@@ -22,6 +22,7 @@
 #include <cstring>
 #include <map>
 #include <memory>
+#include <span>
 #include <utility>
 #include <vector>
 
@@ -1791,7 +1792,7 @@ class TypedColumnWriterImpl : public ColumnWriterImpl,
     }
 
     auto add_levels = [](std::vector<int64_t>& level_histogram,
-                         ::arrow::util::span<const int16_t> levels, int16_t 
max_level) {
+                         std::span<const int16_t> levels, int16_t max_level) {
       if (max_level == 0) {
         return;
       }
diff --git a/cpp/src/parquet/encoding_test.cc b/cpp/src/parquet/encoding_test.cc
index 5115516f9f..9c88eb468a 100644
--- a/cpp/src/parquet/encoding_test.cc
+++ b/cpp/src/parquet/encoding_test.cc
@@ -41,7 +41,6 @@
 #include "arrow/util/bitmap_writer.h"
 #include "arrow/util/checked_cast.h"
 #include "arrow/util/endian.h"
-#include "arrow/util/span.h"
 #include "arrow/util/string.h"
 #include "parquet/encoding.h"
 #include "parquet/platform.h"
@@ -52,7 +51,6 @@
 using arrow::default_memory_pool;
 using arrow::MemoryPool;
 using arrow::internal::checked_cast;
-using arrow::util::span;
 
 namespace bit_util = arrow::bit_util;
 
@@ -1507,7 +1505,8 @@ class TestByteStreamSplitEncoding : public 
TestEncodingBase<Type> {
   USING_BASE_MEMBERS();
 
   template <typename U>
-  void CheckDecode(span<const uint8_t> encoded_data, span<const U> 
expected_decoded_data,
+  void CheckDecode(std::span<const uint8_t> encoded_data,
+                   std::span<const U> expected_decoded_data,
                    const ColumnDescriptor* descr = nullptr) {
     static_assert(sizeof(U) == sizeof(c_type));
     static_assert(std::is_same_v<U, FLBA> == std::is_same_v<c_type, FLBA>);
@@ -1525,8 +1524,9 @@ class TestByteStreamSplitEncoding : public 
TestEncodingBase<Type> {
     if constexpr (std::is_same_v<c_type, FLBA>) {
       auto type_length = descr->type_length();
       for (int i = 0; i < num_elements; ++i) {
-        ASSERT_EQ(span<const uint8_t>(expected_decoded_data[i].ptr, 
type_length),
-                  span<const uint8_t>(decoded_data[i].ptr, type_length));
+        ASSERT_TRUE(std::ranges::equal(
+            std::span<const uint8_t>(expected_decoded_data[i].ptr, 
type_length),
+            std::span<const uint8_t>(decoded_data[i].ptr, type_length)));
       }
     } else {
       for (int i = 0; i < num_elements; ++i) {
@@ -1537,7 +1537,8 @@ class TestByteStreamSplitEncoding : public 
TestEncodingBase<Type> {
   }
 
   template <typename U>
-  void CheckEncode(span<const U> data, span<const uint8_t> 
expected_encoded_data,
+  void CheckEncode(std::span<const U> data,
+                   std::span<const uint8_t> expected_encoded_data,
                    const ColumnDescriptor* descr = nullptr) {
     static_assert(sizeof(U) == sizeof(c_type));
     static_assert(std::is_same_v<U, FLBA> == std::is_same_v<c_type, FLBA>);
@@ -1590,7 +1591,8 @@ void TestByteStreamSplitEncoding<Type>::CheckDecode() {
       const std::vector<FLBA> expected_output{
           FLBA{&raw_expected_output[0]}, FLBA{&raw_expected_output[3]},
           FLBA{&raw_expected_output[6]}, FLBA{&raw_expected_output[9]}};
-      CheckDecode(span{data}, span{expected_output}, 
FLBAColumnDescriptor(3).get());
+      CheckDecode(std::span{data}, std::span{expected_output},
+                  FLBAColumnDescriptor(3).get());
     }
     // - type_length = 1
     {
@@ -1599,7 +1601,8 @@ void TestByteStreamSplitEncoding<Type>::CheckDecode() {
       const std::vector<FLBA> expected_output{FLBA{&raw_expected_output[0]},
                                               FLBA{&raw_expected_output[1]},
                                               FLBA{&raw_expected_output[2]}};
-      CheckDecode(span{data}, span{expected_output}, 
FLBAColumnDescriptor(1).get());
+      CheckDecode(std::span{data}, std::span{expected_output},
+                  FLBAColumnDescriptor(1).get());
     }
   } else if constexpr (sizeof(c_type) == 4) {
     // INT32, FLOAT
@@ -1607,14 +1610,14 @@ void TestByteStreamSplitEncoding<Type>::CheckDecode() {
                                     0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC};
     const auto expected_output =
         ToLittleEndian<uint32_t>({0xAA774411U, 0xBB885522U, 0xCC996633U});
-    CheckDecode(span{data}, span{expected_output});
+    CheckDecode(std::span{data}, std::span{expected_output});
   } else {
     // INT64, DOUBLE
     const std::vector<uint8_t> data{0xDE, 0xC0, 0x37, 0x13, 0x11, 0x22, 0x33, 
0x44,
                                     0xAA, 0xBB, 0xCC, 0xDD, 0x55, 0x66, 0x77, 
0x88};
     const auto expected_output =
         ToLittleEndian<uint64_t>({0x7755CCAA331137DEULL, 
0x8866DDBB442213C0ULL});
-    CheckDecode(span{data}, span{expected_output});
+    CheckDecode(std::span{data}, std::span{expected_output});
   }
 }
 
@@ -1630,7 +1633,8 @@ void TestByteStreamSplitEncoding<Type>::CheckEncode() {
                                    FLBA{&raw_data[6]}, FLBA{&raw_data[9]}};
       const std::vector<uint8_t> expected_output{0x11, 0x44, 0x77, 0xAA, 0x22, 
0x55,
                                                  0x88, 0xBB, 0x33, 0x66, 0x99, 
0xCC};
-      CheckEncode(span{data}, span{expected_output}, 
FLBAColumnDescriptor(3).get());
+      CheckEncode(std::span{data}, std::span{expected_output},
+                  FLBAColumnDescriptor(3).get());
     }
     // - type_length = 1
     {
@@ -1638,14 +1642,15 @@ void TestByteStreamSplitEncoding<Type>::CheckEncode() {
       const std::vector<FLBA> data{FLBA{&raw_data[0]}, FLBA{&raw_data[1]},
                                    FLBA{&raw_data[2]}};
       const std::vector<uint8_t> expected_output{0x11, 0x22, 0x33};
-      CheckEncode(span{data}, span{expected_output}, 
FLBAColumnDescriptor(1).get());
+      CheckEncode(std::span{data}, std::span{expected_output},
+                  FLBAColumnDescriptor(1).get());
     }
   } else if constexpr (sizeof(c_type) == 4) {
     // INT32, FLOAT
     const auto data = ToLittleEndian<uint32_t>({0xaabbccddUL, 0x11223344UL});
     const std::vector<uint8_t> expected_output{0xdd, 0x44, 0xcc, 0x33,
                                                0xbb, 0x22, 0xaa, 0x11};
-    CheckEncode(span{data}, span{expected_output});
+    CheckEncode(std::span{data}, std::span{expected_output});
   } else {
     // INT64, DOUBLE
     const auto data = ToLittleEndian<uint64_t>(
@@ -1654,7 +1659,7 @@ void TestByteStreamSplitEncoding<Type>::CheckEncode() {
         0x48, 0x08, 0xb8, 0x47, 0x07, 0xb7, 0x46, 0x06, 0xb6, 0x45, 0x05, 0xb5,
         0x44, 0x04, 0xb4, 0x43, 0x03, 0xb3, 0x42, 0x02, 0xb2, 0x41, 0x01, 0xb1,
     };
-    CheckEncode(span{data}, span{expected_output});
+    CheckEncode(std::span{data}, std::span{expected_output});
   }
 }
 
@@ -2173,7 +2178,7 @@ std::shared_ptr<Buffer> DeltaEncode(std::vector<int32_t> 
lengths) {
   return encoder->FlushValues();
 }
 
-std::shared_ptr<Buffer> DeltaEncode(::arrow::util::span<const int32_t> 
lengths) {
+std::shared_ptr<Buffer> DeltaEncode(std::span<const int32_t> lengths) {
   auto encoder = MakeTypedEncoder<Int32Type>(Encoding::DELTA_BINARY_PACKED);
   encoder->Put(lengths.data(), static_cast<int>(lengths.size()));
   return encoder->FlushValues();
@@ -2181,8 +2186,8 @@ std::shared_ptr<Buffer> 
DeltaEncode(::arrow::util::span<const int32_t> lengths)
 
 std::shared_ptr<Buffer> DeltaEncode(std::shared_ptr<::arrow::Array>& lengths) {
   auto data = ::arrow::internal::checked_pointer_cast<const 
::arrow::Int32Array>(lengths);
-  auto span = ::arrow::util::span<const int32_t>{data->raw_values(),
-                                                 
static_cast<size_t>(lengths->length())};
+  auto span = std::span<const int32_t>{data->raw_values(),
+                                       static_cast<size_t>(lengths->length())};
   return DeltaEncode(span);
 }
 
diff --git a/cpp/src/parquet/encryption/encryption.h 
b/cpp/src/parquet/encryption/encryption.h
index b4634b7047..023a536fd9 100644
--- a/cpp/src/parquet/encryption/encryption.h
+++ b/cpp/src/parquet/encryption/encryption.h
@@ -20,6 +20,7 @@
 #include <cassert>
 #include <map>
 #include <memory>
+#include <span>
 #include <string>
 #include <utility>
 
@@ -95,7 +96,7 @@ class PARQUET_EXPORT KeyAccessDeniedException : public 
ParquetException {
       : ParquetException(columnPath.c_str()) {}
 };
 
-inline ::arrow::util::span<const uint8_t> str2span(const std::string& str) {
+inline std::span<const uint8_t> str2span(const std::string& str) {
   if (str.empty()) {
     return {};
   }
diff --git a/cpp/src/parquet/encryption/encryption_internal.cc 
b/cpp/src/parquet/encryption/encryption_internal.cc
index 9400fae0ad..1eaebb96ca 100644
--- a/cpp/src/parquet/encryption/encryption_internal.cc
+++ b/cpp/src/parquet/encryption/encryption_internal.cc
@@ -26,6 +26,7 @@
 #include <array>
 #include <iostream>
 #include <memory>
+#include <span>
 #include <sstream>
 #include <string>
 #include <vector>
@@ -33,7 +34,6 @@
 #include "parquet/encryption/openssl_internal.h"
 #include "parquet/exception.h"
 
-using ::arrow::util::span;
 using parquet::ParquetException;
 
 namespace parquet::encryption {
@@ -109,12 +109,13 @@ class AesEncryptor::AesEncryptorImpl : public 
AesCryptoContext {
   explicit AesEncryptorImpl(ParquetCipher::type alg_id, int32_t key_len, bool 
metadata,
                             bool write_length);
 
-  int32_t Encrypt(span<const uint8_t> plaintext, span<const uint8_t> key,
-                  span<const uint8_t> aad, span<uint8_t> ciphertext);
+  int32_t Encrypt(std::span<const uint8_t> plaintext, std::span<const uint8_t> 
key,
+                  std::span<const uint8_t> aad, std::span<uint8_t> ciphertext);
 
-  int32_t SignedFooterEncrypt(span<const uint8_t> footer, span<const uint8_t> 
key,
-                              span<const uint8_t> aad, span<const uint8_t> 
nonce,
-                              span<uint8_t> encrypted_footer);
+  int32_t SignedFooterEncrypt(std::span<const uint8_t> footer,
+                              std::span<const uint8_t> key, std::span<const 
uint8_t> aad,
+                              std::span<const uint8_t> nonce,
+                              std::span<uint8_t> encrypted_footer);
 
   [[nodiscard]] int32_t CiphertextLength(int64_t plaintext_len) const {
     if (plaintext_len < 0) {
@@ -135,12 +136,12 @@ class AesEncryptor::AesEncryptorImpl : public 
AesCryptoContext {
  private:
   [[nodiscard]] CipherContext MakeCipherContext() const;
 
-  int32_t GcmEncrypt(span<const uint8_t> plaintext, span<const uint8_t> key,
-                     span<const uint8_t> nonce, span<const uint8_t> aad,
-                     span<uint8_t> ciphertext);
+  int32_t GcmEncrypt(std::span<const uint8_t> plaintext, std::span<const 
uint8_t> key,
+                     std::span<const uint8_t> nonce, std::span<const uint8_t> 
aad,
+                     std::span<uint8_t> ciphertext);
 
-  int32_t CtrEncrypt(span<const uint8_t> plaintext, span<const uint8_t> key,
-                     span<const uint8_t> nonce, span<uint8_t> ciphertext);
+  int32_t CtrEncrypt(std::span<const uint8_t> plaintext, std::span<const 
uint8_t> key,
+                     std::span<const uint8_t> nonce, std::span<uint8_t> 
ciphertext);
 };
 
 AesEncryptor::AesEncryptorImpl::AesEncryptorImpl(ParquetCipher::type alg_id,
@@ -174,8 +175,9 @@ AesCryptoContext::CipherContext 
AesEncryptor::AesEncryptorImpl::MakeCipherContex
 }
 
 int32_t AesEncryptor::AesEncryptorImpl::SignedFooterEncrypt(
-    span<const uint8_t> footer, span<const uint8_t> key, span<const uint8_t> 
aad,
-    span<const uint8_t> nonce, span<uint8_t> encrypted_footer) {
+    std::span<const uint8_t> footer, std::span<const uint8_t> key,
+    std::span<const uint8_t> aad, std::span<const uint8_t> nonce,
+    std::span<uint8_t> encrypted_footer) {
   if (static_cast<size_t>(key_length_) != key.size()) {
     std::stringstream ss;
     ss << "Wrong key length " << key.size() << ". Should be " << key_length_;
@@ -196,10 +198,10 @@ int32_t 
AesEncryptor::AesEncryptorImpl::SignedFooterEncrypt(
   return GcmEncrypt(footer, key, nonce, aad, encrypted_footer);
 }
 
-int32_t AesEncryptor::AesEncryptorImpl::Encrypt(span<const uint8_t> plaintext,
-                                                span<const uint8_t> key,
-                                                span<const uint8_t> aad,
-                                                span<uint8_t> ciphertext) {
+int32_t AesEncryptor::AesEncryptorImpl::Encrypt(std::span<const uint8_t> 
plaintext,
+                                                std::span<const uint8_t> key,
+                                                std::span<const uint8_t> aad,
+                                                std::span<uint8_t> ciphertext) 
{
   if (static_cast<size_t>(key_length_) != key.size()) {
     std::stringstream ss;
     ss << "Wrong key length " << key.size() << ". Should be " << key_length_;
@@ -225,11 +227,11 @@ int32_t 
AesEncryptor::AesEncryptorImpl::Encrypt(span<const uint8_t> plaintext,
   return CtrEncrypt(plaintext, key, nonce, ciphertext);
 }
 
-int32_t AesEncryptor::AesEncryptorImpl::GcmEncrypt(span<const uint8_t> 
plaintext,
-                                                   span<const uint8_t> key,
-                                                   span<const uint8_t> nonce,
-                                                   span<const uint8_t> aad,
-                                                   span<uint8_t> ciphertext) {
+int32_t AesEncryptor::AesEncryptorImpl::GcmEncrypt(std::span<const uint8_t> 
plaintext,
+                                                   std::span<const uint8_t> 
key,
+                                                   std::span<const uint8_t> 
nonce,
+                                                   std::span<const uint8_t> 
aad,
+                                                   std::span<uint8_t> 
ciphertext) {
   int len;
   int32_t ciphertext_len;
 
@@ -304,10 +306,10 @@ int32_t 
AesEncryptor::AesEncryptorImpl::GcmEncrypt(span<const uint8_t> plaintext
   return length_buffer_length_ + buffer_size;
 }
 
-int32_t AesEncryptor::AesEncryptorImpl::CtrEncrypt(span<const uint8_t> 
plaintext,
-                                                   span<const uint8_t> key,
-                                                   span<const uint8_t> nonce,
-                                                   span<uint8_t> ciphertext) {
+int32_t AesEncryptor::AesEncryptorImpl::CtrEncrypt(std::span<const uint8_t> 
plaintext,
+                                                   std::span<const uint8_t> 
key,
+                                                   std::span<const uint8_t> 
nonce,
+                                                   std::span<uint8_t> 
ciphertext) {
   int len;
   int32_t ciphertext_len;
 
@@ -371,11 +373,11 @@ int32_t 
AesEncryptor::AesEncryptorImpl::CtrEncrypt(span<const uint8_t> plaintext
 
 AesEncryptor::~AesEncryptor() = default;
 
-int32_t AesEncryptor::SignedFooterEncrypt(span<const uint8_t> footer,
-                                          span<const uint8_t> key,
-                                          span<const uint8_t> aad,
-                                          span<const uint8_t> nonce,
-                                          span<uint8_t> encrypted_footer) {
+int32_t AesEncryptor::SignedFooterEncrypt(std::span<const uint8_t> footer,
+                                          std::span<const uint8_t> key,
+                                          std::span<const uint8_t> aad,
+                                          std::span<const uint8_t> nonce,
+                                          std::span<uint8_t> encrypted_footer) 
{
   return impl_->SignedFooterEncrypt(footer, key, aad, nonce, encrypted_footer);
 }
 
@@ -383,8 +385,9 @@ int32_t AesEncryptor::CiphertextLength(int64_t 
plaintext_len) const {
   return impl_->CiphertextLength(plaintext_len);
 }
 
-int32_t AesEncryptor::Encrypt(span<const uint8_t> plaintext, span<const 
uint8_t> key,
-                              span<const uint8_t> aad, span<uint8_t> 
ciphertext) {
+int32_t AesEncryptor::Encrypt(std::span<const uint8_t> plaintext,
+                              std::span<const uint8_t> key, std::span<const 
uint8_t> aad,
+                              std::span<uint8_t> ciphertext) {
   return impl_->Encrypt(plaintext, key, aad, ciphertext);
 }
 
@@ -398,8 +401,8 @@ class AesDecryptor::AesDecryptorImpl : AesCryptoContext {
   explicit AesDecryptorImpl(ParquetCipher::type alg_id, int32_t key_len, bool 
metadata,
                             bool contains_length);
 
-  int32_t Decrypt(span<const uint8_t> ciphertext, span<const uint8_t> key,
-                  span<const uint8_t> aad, span<uint8_t> plaintext);
+  int32_t Decrypt(std::span<const uint8_t> ciphertext, std::span<const 
uint8_t> key,
+                  std::span<const uint8_t> aad, std::span<uint8_t> plaintext);
 
   [[nodiscard]] int32_t PlaintextLength(int32_t ciphertext_len) const {
     if (ciphertext_len < ciphertext_size_delta_) {
@@ -431,17 +434,18 @@ class AesDecryptor::AesDecryptorImpl : AesCryptoContext {
 
   /// Get the actual ciphertext length, inclusive of the length buffer length,
   /// and validate that the provided buffer size is large enough.
-  [[nodiscard]] int32_t GetCiphertextLength(span<const uint8_t> ciphertext) 
const;
+  [[nodiscard]] int32_t GetCiphertextLength(std::span<const uint8_t> 
ciphertext) const;
 
-  int32_t GcmDecrypt(span<const uint8_t> ciphertext, span<const uint8_t> key,
-                     span<const uint8_t> aad, span<uint8_t> plaintext);
+  int32_t GcmDecrypt(std::span<const uint8_t> ciphertext, std::span<const 
uint8_t> key,
+                     std::span<const uint8_t> aad, std::span<uint8_t> 
plaintext);
 
-  int32_t CtrDecrypt(span<const uint8_t> ciphertext, span<const uint8_t> key,
-                     span<uint8_t> plaintext);
+  int32_t CtrDecrypt(std::span<const uint8_t> ciphertext, std::span<const 
uint8_t> key,
+                     std::span<uint8_t> plaintext);
 };
 
-int32_t AesDecryptor::Decrypt(span<const uint8_t> ciphertext, span<const 
uint8_t> key,
-                              span<const uint8_t> aad, span<uint8_t> 
plaintext) {
+int32_t AesDecryptor::Decrypt(std::span<const uint8_t> ciphertext,
+                              std::span<const uint8_t> key, std::span<const 
uint8_t> aad,
+                              std::span<uint8_t> plaintext) {
   return impl_->Decrypt(ciphertext, key, aad, plaintext);
 }
 
@@ -502,7 +506,7 @@ int32_t AesDecryptor::CiphertextLength(int32_t 
plaintext_len) const {
 }
 
 int32_t AesDecryptor::AesDecryptorImpl::GetCiphertextLength(
-    span<const uint8_t> ciphertext) const {
+    std::span<const uint8_t> ciphertext) const {
   if (length_buffer_length_ > 0) {
     // Note: length_buffer_length_ must be either 0 or kBufferSizeLength
     if (ciphertext.size() < static_cast<size_t>(kBufferSizeLength)) {
@@ -547,10 +551,10 @@ int32_t 
AesDecryptor::AesDecryptorImpl::GetCiphertextLength(
   }
 }
 
-int32_t AesDecryptor::AesDecryptorImpl::GcmDecrypt(span<const uint8_t> 
ciphertext,
-                                                   span<const uint8_t> key,
-                                                   span<const uint8_t> aad,
-                                                   span<uint8_t> plaintext) {
+int32_t AesDecryptor::AesDecryptorImpl::GcmDecrypt(std::span<const uint8_t> 
ciphertext,
+                                                   std::span<const uint8_t> 
key,
+                                                   std::span<const uint8_t> 
aad,
+                                                   std::span<uint8_t> 
plaintext) {
   int len;
   int32_t plaintext_len;
 
@@ -622,9 +626,9 @@ int32_t 
AesDecryptor::AesDecryptorImpl::GcmDecrypt(span<const uint8_t> ciphertex
   return plaintext_len;
 }
 
-int32_t AesDecryptor::AesDecryptorImpl::CtrDecrypt(span<const uint8_t> 
ciphertext,
-                                                   span<const uint8_t> key,
-                                                   span<uint8_t> plaintext) {
+int32_t AesDecryptor::AesDecryptorImpl::CtrDecrypt(std::span<const uint8_t> 
ciphertext,
+                                                   std::span<const uint8_t> 
key,
+                                                   std::span<uint8_t> 
plaintext) {
   int len;
   int32_t plaintext_len;
 
@@ -681,10 +685,10 @@ int32_t 
AesDecryptor::AesDecryptorImpl::CtrDecrypt(span<const uint8_t> ciphertex
   return plaintext_len;
 }
 
-int32_t AesDecryptor::AesDecryptorImpl::Decrypt(span<const uint8_t> ciphertext,
-                                                span<const uint8_t> key,
-                                                span<const uint8_t> aad,
-                                                span<uint8_t> plaintext) {
+int32_t AesDecryptor::AesDecryptorImpl::Decrypt(std::span<const uint8_t> 
ciphertext,
+                                                std::span<const uint8_t> key,
+                                                std::span<const uint8_t> aad,
+                                                std::span<uint8_t> plaintext) {
   if (static_cast<size_t>(key_length_) != key.size()) {
     std::stringstream ss;
     ss << "Wrong key length " << key.size() << ". Should be " << key_length_;
diff --git a/cpp/src/parquet/encryption/encryption_internal.h 
b/cpp/src/parquet/encryption/encryption_internal.h
index 0625274956..de256809fa 100644
--- a/cpp/src/parquet/encryption/encryption_internal.h
+++ b/cpp/src/parquet/encryption/encryption_internal.h
@@ -18,10 +18,10 @@
 #pragma once
 
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
-#include "arrow/util/span.h"
 #include "parquet/properties.h"
 #include "parquet/types.h"
 
@@ -62,17 +62,14 @@ class PARQUET_EXPORT AesEncryptor {
 
   /// Encrypts plaintext with the key and aad. Key length is passed only for 
validation.
   /// If different from value in constructor, exception will be thrown.
-  int32_t Encrypt(::arrow::util::span<const uint8_t> plaintext,
-                  ::arrow::util::span<const uint8_t> key,
-                  ::arrow::util::span<const uint8_t> aad,
-                  ::arrow::util::span<uint8_t> ciphertext);
+  int32_t Encrypt(std::span<const uint8_t> plaintext, std::span<const uint8_t> 
key,
+                  std::span<const uint8_t> aad, std::span<uint8_t> ciphertext);
 
   /// Encrypts plaintext footer, in order to compute footer signature (tag).
-  int32_t SignedFooterEncrypt(::arrow::util::span<const uint8_t> footer,
-                              ::arrow::util::span<const uint8_t> key,
-                              ::arrow::util::span<const uint8_t> aad,
-                              ::arrow::util::span<const uint8_t> nonce,
-                              ::arrow::util::span<uint8_t> encrypted_footer);
+  int32_t SignedFooterEncrypt(std::span<const uint8_t> footer,
+                              std::span<const uint8_t> key, std::span<const 
uint8_t> aad,
+                              std::span<const uint8_t> nonce,
+                              std::span<uint8_t> encrypted_footer);
 
  private:
   // PIMPL Idiom
@@ -107,10 +104,8 @@ class PARQUET_EXPORT AesDecryptor {
   /// validation. If different from value in constructor, exception will be 
thrown.
   /// The caller is responsible for ensuring that the plaintext buffer is at 
least as
   /// large as PlaintextLength(ciphertext_len).
-  int32_t Decrypt(::arrow::util::span<const uint8_t> ciphertext,
-                  ::arrow::util::span<const uint8_t> key,
-                  ::arrow::util::span<const uint8_t> aad,
-                  ::arrow::util::span<uint8_t> plaintext);
+  int32_t Decrypt(std::span<const uint8_t> ciphertext, std::span<const 
uint8_t> key,
+                  std::span<const uint8_t> aad, std::span<uint8_t> plaintext);
 
  private:
   // PIMPL Idiom
diff --git a/cpp/src/parquet/encryption/encryption_internal_nossl.cc 
b/cpp/src/parquet/encryption/encryption_internal_nossl.cc
index 2450f8654d..74de130cc9 100644
--- a/cpp/src/parquet/encryption/encryption_internal_nossl.cc
+++ b/cpp/src/parquet/encryption/encryption_internal_nossl.cc
@@ -15,6 +15,8 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <span>
+
 #include "parquet/encryption/encryption_internal.h"
 #include "parquet/exception.h"
 
@@ -33,11 +35,11 @@ class AesEncryptor::AesEncryptorImpl {};
 
 AesEncryptor::~AesEncryptor() {}
 
-int32_t AesEncryptor::SignedFooterEncrypt(::arrow::util::span<const uint8_t> 
footer,
-                                          ::arrow::util::span<const uint8_t> 
key,
-                                          ::arrow::util::span<const uint8_t> 
aad,
-                                          ::arrow::util::span<const uint8_t> 
nonce,
-                                          ::arrow::util::span<uint8_t> 
encrypted_footer) {
+int32_t AesEncryptor::SignedFooterEncrypt(std::span<const uint8_t> footer,
+                                          std::span<const uint8_t> key,
+                                          std::span<const uint8_t> aad,
+                                          std::span<const uint8_t> nonce,
+                                          std::span<uint8_t> encrypted_footer) 
{
   ThrowOpenSSLRequiredException();
   return -1;
 }
@@ -47,10 +49,9 @@ int32_t AesEncryptor::CiphertextLength(int64_t 
plaintext_len) const {
   return -1;
 }
 
-int32_t AesEncryptor::Encrypt(::arrow::util::span<const uint8_t> plaintext,
-                              ::arrow::util::span<const uint8_t> key,
-                              ::arrow::util::span<const uint8_t> aad,
-                              ::arrow::util::span<uint8_t> ciphertext) {
+int32_t AesEncryptor::Encrypt(std::span<const uint8_t> plaintext,
+                              std::span<const uint8_t> key, std::span<const 
uint8_t> aad,
+                              std::span<uint8_t> ciphertext) {
   ThrowOpenSSLRequiredException();
   return -1;
 }
@@ -62,10 +63,9 @@ AesEncryptor::AesEncryptor(ParquetCipher::type alg_id, 
int32_t key_len, bool met
 
 class AesDecryptor::AesDecryptorImpl {};
 
-int32_t AesDecryptor::Decrypt(::arrow::util::span<const uint8_t> ciphertext,
-                              ::arrow::util::span<const uint8_t> key,
-                              ::arrow::util::span<const uint8_t> aad,
-                              ::arrow::util::span<uint8_t> plaintext) {
+int32_t AesDecryptor::Decrypt(std::span<const uint8_t> ciphertext,
+                              std::span<const uint8_t> key, std::span<const 
uint8_t> aad,
+                              std::span<uint8_t> plaintext) {
   ThrowOpenSSLRequiredException();
   return -1;
 }
diff --git a/cpp/src/parquet/encryption/encryption_internal_test.cc 
b/cpp/src/parquet/encryption/encryption_internal_test.cc
index bf6607e328..006554a5cb 100644
--- a/cpp/src/parquet/encryption/encryption_internal_test.cc
+++ b/cpp/src/parquet/encryption/encryption_internal_test.cc
@@ -16,6 +16,7 @@
 // under the License.
 
 #include <gtest/gtest.h>
+#include <span>
 
 #include "parquet/encryption/encryption_internal.h"
 
@@ -97,8 +98,7 @@ class TestAesEncryption : public ::testing::Test {
     int32_t expected_plaintext_length = 
decryptor.PlaintextLength(ciphertext_length);
     std::vector<uint8_t> decrypted_text(expected_plaintext_length, '\0');
 
-    ::arrow::util::span<uint8_t> truncated_ciphertext(ciphertext.data(),
-                                                      ciphertext_length - 1);
+    std::span<uint8_t> truncated_ciphertext(ciphertext.data(), 
ciphertext_length - 1);
     EXPECT_THROW(decryptor.Decrypt(truncated_ciphertext, str2span(key_), 
str2span(aad_),
                                    decrypted_text),
                  ParquetException);
diff --git a/cpp/src/parquet/encryption/internal_file_decryptor.cc 
b/cpp/src/parquet/encryption/internal_file_decryptor.cc
index b90d315855..11e3b4e54b 100644
--- a/cpp/src/parquet/encryption/internal_file_decryptor.cc
+++ b/cpp/src/parquet/encryption/internal_file_decryptor.cc
@@ -15,6 +15,8 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <span>
+
 #include "parquet/encryption/internal_file_decryptor.h"
 
 #include "arrow/util/logging.h"
@@ -47,8 +49,8 @@ int32_t Decryptor::CiphertextLength(int32_t plaintext_len) 
const {
   return aes_decryptor_->CiphertextLength(plaintext_len);
 }
 
-int32_t Decryptor::Decrypt(::arrow::util::span<const uint8_t> ciphertext,
-                           ::arrow::util::span<uint8_t> plaintext) {
+int32_t Decryptor::Decrypt(std::span<const uint8_t> ciphertext,
+                           std::span<uint8_t> plaintext) {
   return aes_decryptor_->Decrypt(ciphertext, key_.as_span(), str2span(aad_), 
plaintext);
 }
 
diff --git a/cpp/src/parquet/encryption/internal_file_decryptor.h 
b/cpp/src/parquet/encryption/internal_file_decryptor.h
index a365b4df4b..1343769ef3 100644
--- a/cpp/src/parquet/encryption/internal_file_decryptor.h
+++ b/cpp/src/parquet/encryption/internal_file_decryptor.h
@@ -19,6 +19,7 @@
 
 #include <memory>
 #include <mutex>
+#include <span>
 #include <string>
 #include <vector>
 
@@ -52,8 +53,7 @@ class PARQUET_EXPORT Decryptor {
 
   [[nodiscard]] int32_t PlaintextLength(int32_t ciphertext_len) const;
   [[nodiscard]] int32_t CiphertextLength(int32_t plaintext_len) const;
-  int32_t Decrypt(::arrow::util::span<const uint8_t> ciphertext,
-                  ::arrow::util::span<uint8_t> plaintext);
+  int32_t Decrypt(std::span<const uint8_t> ciphertext, std::span<uint8_t> 
plaintext);
 
  private:
   std::unique_ptr<encryption::AesDecryptor> aes_decryptor_;
diff --git a/cpp/src/parquet/encryption/internal_file_encryptor.cc 
b/cpp/src/parquet/encryption/internal_file_encryptor.cc
index f6fc084998..23dbfe34d3 100644
--- a/cpp/src/parquet/encryption/internal_file_encryptor.cc
+++ b/cpp/src/parquet/encryption/internal_file_encryptor.cc
@@ -15,10 +15,12 @@
 // specific language governing permissions and limitations
 // under the License.
 
-#include "parquet/encryption/internal_file_encryptor.h"
+#include <span>
+
 #include "arrow/util/secure_string.h"
 #include "parquet/encryption/encryption.h"
 #include "parquet/encryption/encryption_internal.h"
+#include "parquet/encryption/internal_file_encryptor.h"
 
 using arrow::util::SecureString;
 
@@ -37,8 +39,8 @@ int32_t Encryptor::CiphertextLength(int64_t plaintext_len) 
const {
   return aes_encryptor_->CiphertextLength(plaintext_len);
 }
 
-int32_t Encryptor::Encrypt(::arrow::util::span<const uint8_t> plaintext,
-                           ::arrow::util::span<uint8_t> ciphertext) {
+int32_t Encryptor::Encrypt(std::span<const uint8_t> plaintext,
+                           std::span<uint8_t> ciphertext) {
   return aes_encryptor_->Encrypt(plaintext, key_.as_span(), str2span(aad_), 
ciphertext);
 }
 
diff --git a/cpp/src/parquet/encryption/internal_file_encryptor.h 
b/cpp/src/parquet/encryption/internal_file_encryptor.h
index ee15fe32de..c444140a05 100644
--- a/cpp/src/parquet/encryption/internal_file_encryptor.h
+++ b/cpp/src/parquet/encryption/internal_file_encryptor.h
@@ -19,6 +19,7 @@
 
 #include <map>
 #include <memory>
+#include <span>
 #include <string>
 #include <vector>
 
@@ -44,8 +45,7 @@ class PARQUET_EXPORT Encryptor {
 
   [[nodiscard]] int32_t CiphertextLength(int64_t plaintext_len) const;
 
-  int32_t Encrypt(::arrow::util::span<const uint8_t> plaintext,
-                  ::arrow::util::span<uint8_t> ciphertext);
+  int32_t Encrypt(std::span<const uint8_t> plaintext, std::span<uint8_t> 
ciphertext);
 
   bool EncryptColumnMetaData(
       bool encrypted_footer,
diff --git a/cpp/src/parquet/encryption/key_toolkit_internal.cc 
b/cpp/src/parquet/encryption/key_toolkit_internal.cc
index 60a8a52206..d304041e3e 100644
--- a/cpp/src/parquet/encryption/key_toolkit_internal.cc
+++ b/cpp/src/parquet/encryption/key_toolkit_internal.cc
@@ -15,6 +15,8 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include <span>
+
 #include "arrow/util/base64.h"
 #include "arrow/util/secure_string.h"
 
@@ -38,8 +40,8 @@ std::string EncryptKeyLocally(const SecureString& key_bytes,
   int32_t encrypted_key_len =
       key_encryptor.CiphertextLength(static_cast<int64_t>(key_bytes.size()));
   std::string encrypted_key(encrypted_key_len, '\0');
-  ::arrow::util::span<uint8_t> encrypted_key_span(
-      reinterpret_cast<uint8_t*>(&encrypted_key[0]), encrypted_key_len);
+  std::span<uint8_t> 
encrypted_key_span(reinterpret_cast<uint8_t*>(&encrypted_key[0]),
+                                        encrypted_key_len);
 
   encrypted_key_len = key_encryptor.Encrypt(key_bytes.as_span(), 
master_key.as_span(),
                                             str2span(aad), encrypted_key_span);
diff --git a/cpp/src/parquet/geospatial/util_internal.cc 
b/cpp/src/parquet/geospatial/util_internal.cc
index f27ad7012a..59551ae870 100644
--- a/cpp/src/parquet/geospatial/util_internal.cc
+++ b/cpp/src/parquet/geospatial/util_internal.cc
@@ -17,6 +17,7 @@
 
 #include "parquet/geospatial/util_internal.h"
 
+#include <span>
 #include <sstream>
 
 #include "arrow/util/endian.h"
@@ -147,11 +148,11 @@ std::vector<int32_t> WKBGeometryBounder::GeometryTypes() 
const {
 }
 
 void WKBGeometryBounder::MergeGeometry(std::string_view bytes_wkb) {
-  MergeGeometry(::arrow::util::span(reinterpret_cast<const 
uint8_t*>(bytes_wkb.data()),
-                                    bytes_wkb.size()));
+  MergeGeometry(
+      std::span(reinterpret_cast<const uint8_t*>(bytes_wkb.data()), 
bytes_wkb.size()));
 }
 
-void WKBGeometryBounder::MergeGeometry(::arrow::util::span<const uint8_t> 
bytes_wkb) {
+void WKBGeometryBounder::MergeGeometry(std::span<const uint8_t> bytes_wkb) {
   WKBBuffer src{bytes_wkb.data(), static_cast<int64_t>(bytes_wkb.size())};
   MergeGeometryInternal(&src, /*record_wkb_type=*/true);
   if (src.size() != 0) {
diff --git a/cpp/src/parquet/geospatial/util_internal.h 
b/cpp/src/parquet/geospatial/util_internal.h
index 9af144d42b..b25e1e1636 100644
--- a/cpp/src/parquet/geospatial/util_internal.h
+++ b/cpp/src/parquet/geospatial/util_internal.h
@@ -22,6 +22,7 @@
 #include <cmath>
 #include <iostream>
 #include <limits>
+#include <span>
 #include <string>
 #include <unordered_set>
 
@@ -94,19 +95,19 @@ struct PARQUET_EXPORT BoundingBox {
   BoundingBox& operator=(const BoundingBox&) = default;
 
   /// \brief Update the X and Y bounds to ensure these bounds contain coord
-  void UpdateXY(::arrow::util::span<const double> coord) {
+  void UpdateXY(std::span<const double> coord) {
     DCHECK_EQ(coord.size(), 2);
     UpdateInternal(coord);
   }
 
   /// \brief Update the X, Y, and Z bounds to ensure these bounds contain coord
-  void UpdateXYZ(::arrow::util::span<const double> coord) {
+  void UpdateXYZ(std::span<const double> coord) {
     DCHECK_EQ(coord.size(), 3);
     UpdateInternal(coord);
   }
 
   /// \brief Update the X, Y, and M bounds to ensure these bounds contain coord
-  void UpdateXYM(::arrow::util::span<const double> coord) {
+  void UpdateXYM(std::span<const double> coord) {
     DCHECK_EQ(coord.size(), 3);
     min[0] = std::min(min[0], coord[0]);
     min[1] = std::min(min[1], coord[1]);
@@ -117,7 +118,7 @@ struct PARQUET_EXPORT BoundingBox {
   }
 
   /// \brief Update the X, Y, Z, and M bounds to ensure these bounds contain 
coord
-  void UpdateXYZM(::arrow::util::span<const double> coord) {
+  void UpdateXYZM(std::span<const double> coord) {
     DCHECK_EQ(coord.size(), 4);
     UpdateInternal(coord);
   }
@@ -190,13 +191,13 @@ class PARQUET_EXPORT WKBGeometryBounder {
   /// the geometry is added to the internal geometry type list.
   void MergeGeometry(std::string_view bytes_wkb);
 
-  void MergeGeometry(::arrow::util::span<const uint8_t> bytes_wkb);
+  void MergeGeometry(std::span<const uint8_t> bytes_wkb);
 
   /// \brief Accumulate the bounds of a previously-calculated BoundingBox
   void MergeBox(const BoundingBox& box) { box_.Merge(box); }
 
   /// \brief Accumulate a previously-calculated list of geometry types
-  void MergeGeometryTypes(::arrow::util::span<const int32_t> geospatial_types) 
{
+  void MergeGeometryTypes(std::span<const int32_t> geospatial_types) {
     geospatial_types_.insert(geospatial_types.begin(), geospatial_types.end());
   }
 
diff --git a/cpp/src/parquet/metadata.cc b/cpp/src/parquet/metadata.cc
index 505ace275b..46cd1e4424 100644
--- a/cpp/src/parquet/metadata.cc
+++ b/cpp/src/parquet/metadata.cc
@@ -22,6 +22,7 @@
 #include <memory>
 #include <ostream>
 #include <random>
+#include <span>
 #include <sstream>
 #include <string>
 #include <string_view>
@@ -809,12 +810,11 @@ class FileMetaData::FileMetaDataImpl {
     uint32_t serialized_len = metadata_len_;
     ThriftSerializer serializer;
     serializer.SerializeToBuffer(metadata_.get(), &serialized_len, 
&serialized_data);
-    ::arrow::util::span<const uint8_t> serialized_data_span(serialized_data,
-                                                            serialized_len);
+    std::span<const uint8_t> serialized_data_span(serialized_data, 
serialized_len);
 
     // encrypt with nonce
-    ::arrow::util::span<const uint8_t> nonce(reinterpret_cast<const 
uint8_t*>(signature),
-                                             encryption::kNonceLength);
+    std::span<const uint8_t> nonce(reinterpret_cast<const uint8_t*>(signature),
+                                   encryption::kNonceLength);
     auto tag = reinterpret_cast<const uint8_t*>(signature) + 
encryption::kNonceLength;
 
     const SecureString& key = file_decryptor_->GetFooterKey();
@@ -867,8 +867,7 @@ class FileMetaData::FileMetaDataImpl {
       uint8_t* serialized_data;
       uint32_t serialized_len;
       serializer.SerializeToBuffer(metadata_.get(), &serialized_len, 
&serialized_data);
-      ::arrow::util::span<const uint8_t> serialized_data_span(serialized_data,
-                                                              serialized_len);
+      std::span<const uint8_t> serialized_data_span(serialized_data, 
serialized_len);
 
       // encrypt the footer key
       std::vector<uint8_t> 
encrypted_data(encryptor->CiphertextLength(serialized_len));
@@ -1773,8 +1772,7 @@ class 
ColumnChunkMetaDataBuilder::ColumnChunkMetaDataBuilderImpl {
 
         serializer.SerializeToBuffer(&column_chunk_->meta_data, 
&serialized_len,
                                      &serialized_data);
-        ::arrow::util::span<const uint8_t> 
serialized_data_span(serialized_data,
-                                                                
serialized_len);
+        std::span<const uint8_t> serialized_data_span(serialized_data, 
serialized_len);
 
         std::vector<uint8_t> 
encrypted_data(encryptor->CiphertextLength(serialized_len));
         int32_t encrypted_len = encryptor->Encrypt(serialized_data_span, 
encrypted_data);
diff --git a/cpp/src/parquet/size_statistics.cc 
b/cpp/src/parquet/size_statistics.cc
index 0b30d7c8bb..2ef783ebc9 100644
--- a/cpp/src/parquet/size_statistics.cc
+++ b/cpp/src/parquet/size_statistics.cc
@@ -21,6 +21,7 @@
 #include <array>
 #include <numeric>
 #include <ostream>
+#include <span>
 #include <string_view>
 #include <vector>
 
@@ -32,8 +33,7 @@ namespace parquet {
 
 namespace {
 
-void MergeLevelHistogram(::arrow::util::span<int64_t> histogram,
-                         ::arrow::util::span<const int64_t> other) {
+void MergeLevelHistogram(std::span<int64_t> histogram, std::span<const 
int64_t> other) {
   ARROW_DCHECK_EQ(histogram.size(), other.size());
   std::transform(histogram.begin(), histogram.end(), other.begin(), 
histogram.begin(),
                  std::plus<>());
@@ -143,8 +143,7 @@ std::ostream& operator<<(std::ostream& os, const 
SizeStatistics& size_stats) {
   return os;
 }
 
-void UpdateLevelHistogram(::arrow::util::span<const int16_t> levels,
-                          ::arrow::util::span<int64_t> histogram) {
+void UpdateLevelHistogram(std::span<const int16_t> levels, std::span<int64_t> 
histogram) {
   const int64_t num_levels = static_cast<int64_t>(levels.size());
   DCHECK_GE(histogram.size(), 1);
   const int16_t max_level = static_cast<int16_t>(histogram.size() - 1);
diff --git a/cpp/src/parquet/size_statistics.h 
b/cpp/src/parquet/size_statistics.h
index ec79b8c4f8..5b41b0596b 100644
--- a/cpp/src/parquet/size_statistics.h
+++ b/cpp/src/parquet/size_statistics.h
@@ -20,9 +20,9 @@
 #include <cstdint>
 #include <iosfwd>
 #include <optional>
+#include <span>
 #include <vector>
 
-#include "arrow/util/span.h"
 #include "parquet/platform.h"
 #include "parquet/type_fwd.h"
 
@@ -96,7 +96,6 @@ PARQUET_EXPORT
 std::ostream& operator<<(std::ostream&, const SizeStatistics&);
 
 PARQUET_EXPORT
-void UpdateLevelHistogram(::arrow::util::span<const int16_t> levels,
-                          ::arrow::util::span<int64_t> histogram);
+void UpdateLevelHistogram(std::span<const int16_t> levels, std::span<int64_t> 
histogram);
 
 }  // namespace parquet
diff --git a/cpp/src/parquet/size_statistics_test.cc 
b/cpp/src/parquet/size_statistics_test.cc
index 6e8cec9a13..8c36d6b680 100644
--- a/cpp/src/parquet/size_statistics_test.cc
+++ b/cpp/src/parquet/size_statistics_test.cc
@@ -25,7 +25,6 @@
 #include "arrow/buffer.h"
 #include "arrow/table.h"
 #include "arrow/testing/gtest_util.h"
-#include "arrow/util/span.h"
 #include "parquet/arrow/reader.h"
 #include "parquet/arrow/schema.h"
 #include "parquet/arrow/writer.h"
diff --git a/cpp/src/parquet/stream_writer.h b/cpp/src/parquet/stream_writer.h
index 7626514022..c4a3ccfe2f 100644
--- a/cpp/src/parquet/stream_writer.h
+++ b/cpp/src/parquet/stream_writer.h
@@ -22,12 +22,11 @@
 #include <cstdint>
 #include <memory>
 #include <optional>
+#include <span>
 #include <string>
 #include <string_view>
 #include <vector>
 
-#include "arrow/util/span.h"
-
 #include "parquet/column_writer.h"
 #include "parquet/file_writer.h"
 
@@ -154,7 +153,7 @@ class PARQUET_EXPORT StreamWriter {
   StreamWriter& operator<<(::std::string_view v);
 
   /// \brief Helper class to write variable length raw data.
-  using RawDataView = ::arrow::util::span<const uint8_t>;
+  using RawDataView = std::span<const uint8_t>;
 
   /// \brief Output operators for variable length raw data.
   StreamWriter& operator<<(RawDataView v);
diff --git a/cpp/src/parquet/thrift_internal.h 
b/cpp/src/parquet/thrift_internal.h
index 1ffe99eb3c..5d14ae4e28 100644
--- a/cpp/src/parquet/thrift_internal.h
+++ b/cpp/src/parquet/thrift_internal.h
@@ -21,8 +21,8 @@
 
 #include <cstdint>
 #include <limits>
-
 #include <memory>
+#include <span>
 #include <sstream>
 #include <string>
 #include <type_traits>
@@ -580,7 +580,7 @@ class ThriftDeserializer {
       // decrypt
       auto decrypted_buffer = AllocateBuffer(
           decryptor->pool(), 
decryptor->PlaintextLength(static_cast<int32_t>(clen)));
-      ::arrow::util::span<const uint8_t> cipher_buf(buf, clen);
+      std::span<const uint8_t> cipher_buf(buf, clen);
       uint32_t decrypted_buffer_len =
           decryptor->Decrypt(cipher_buf, 
decrypted_buffer->mutable_span_as<uint8_t>());
       if (decrypted_buffer_len <= 0) {
@@ -690,7 +690,7 @@ class ThriftSerializer {
                                 uint32_t out_length, Encryptor* encryptor) {
     auto cipher_buffer =
         AllocateBuffer(encryptor->pool(), 
encryptor->CiphertextLength(out_length));
-    ::arrow::util::span<const uint8_t> out_span(out_buffer, out_length);
+    std::span<const uint8_t> out_span(out_buffer, out_length);
     int32_t cipher_buffer_len =
         encryptor->Encrypt(out_span, 
cipher_buffer->mutable_span_as<uint8_t>());
 


Reply via email to