Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cpp/src/arrow/array/concatenate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <cstdint>
#include <limits>
#include <memory>
#include <span>
#include <utility>
#include <vector>

Expand Down Expand Up @@ -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);
}
}
Expand Down
7 changes: 4 additions & 3 deletions cpp/src/arrow/array/data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <cstddef>
#include <cstdint>
#include <memory>
#include <span>
#include <string>
#include <utility>
#include <vector>
Expand Down Expand Up @@ -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>))};
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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>)};
Expand Down
12 changes: 6 additions & 6 deletions cpp/src/arrow/array/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <cassert>
#include <cstdint>
#include <memory>
#include <span>
#include <utility>
#include <vector>

Expand All @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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); }
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/array/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <cstring>
#include <limits>
#include <memory>
#include <span>
#include <type_traits>
#include <utility>
#include <vector>
Expand All @@ -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"

Expand Down
9 changes: 5 additions & 4 deletions cpp/src/arrow/array/validate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "arrow/array/validate.h"

#include <span>
#include <vector>

#include "arrow/array.h" // IWYU pragma: keep
Expand Down Expand Up @@ -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;
Expand All @@ -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 ",
Expand Down
10 changes: 5 additions & 5 deletions cpp/src/arrow/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <cstring>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <string_view>
#include <utility>
Expand All @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/arrow/c/bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <memory>
#include <mutex>
#include <queue>
#include <span>
#include <string>
#include <string_view>
#include <utility>
Expand Down Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions cpp/src/arrow/c/bridge_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <cerrno>
#include <deque>
#include <functional>
#include <span>
#include <string>
#include <string_view>
#include <type_traits>
Expand Down Expand Up @@ -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)) {
Expand Down
11 changes: 5 additions & 6 deletions cpp/src/arrow/chunk_resolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@
#include <cstdint>
#include <limits>
#include <memory>
#include <span>
#include <vector>

#include "arrow/array.h"
#include "arrow/record_batch.h"

namespace arrow {

using util::span;

namespace {
template <typename T>
int64_t GetLength(const T& array) {
Expand All @@ -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(),
Expand Down Expand Up @@ -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_)),
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/arrow/chunk_resolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion cpp/src/arrow/compute/kernels/aggregate_pivot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion cpp/src/arrow/compute/kernels/chunked_internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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();
Expand Down
12 changes: 6 additions & 6 deletions cpp/src/arrow/compute/kernels/chunked_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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),
Expand All @@ -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_;
Expand Down
2 changes: 0 additions & 2 deletions cpp/src/arrow/compute/kernels/hash_aggregate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
1 change: 0 additions & 1 deletion cpp/src/arrow/compute/kernels/hash_aggregate_numeric.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Loading
Loading