Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 5 additions & 1 deletion clickhouse/columns/array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,14 @@ size_t ColumnArray::GetSize(size_t n) const {
return (n == 0) ? (*offsets_)[n] : ((*offsets_)[n] - (*offsets_)[n - 1]);
}

ColumnRef ColumnArray::GetData() {
ColumnRef ColumnArray::GetData() const {
return data_;
}

const std::shared_ptr<ColumnUInt64>& ColumnArray::GetOffsets() const {
return offsets_;
}

void ColumnArray::Reset() {
data_.reset();
offsets_.reset();
Expand Down
22 changes: 15 additions & 7 deletions clickhouse/columns/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,24 @@ class ColumnArray : public Column {

void OffsetsIncrease(size_t);

/// Gets the backing data array of the Array's. This does not include any Array Bounds.
ColumnRef GetData() const;

/// Gets all offsets denoting the list boundaries overlayed GetData.
/// The layout is [size_i, ...] where `i` is the row.
const std::shared_ptr<ColumnUInt64>& GetOffsets() const;

/// Gets the offset of the start of row `n` into `GetData()`.
size_t GetOffset(size_t n) const;

/// Gets the element count of row `n`.
size_t GetSize(size_t n) const;

protected:
template<typename T> friend class ColumnArrayT;

ColumnArray(ColumnArray&& array);

size_t GetOffset(size_t n) const;
size_t GetSize(size_t n) const;
ColumnRef GetData();
void AddOffset(size_t n);
void Reset();

Expand Down Expand Up @@ -262,11 +272,9 @@ class ColumnArrayT : public ColumnArray {
template <typename Container>
inline void Append(Container&& container) {
using container_type = decltype(container);
if constexpr (std::is_lvalue_reference_v<container_type> ||
std::is_const_v<std::remove_reference_t<container_type>>) {
if constexpr (std::is_lvalue_reference_v<container_type> || std::is_const_v<std::remove_reference_t<container_type>>) {
Append(std::begin(container), std::end(container));
}
else {
} else {
Append(std::make_move_iterator(std::begin(container)),
std::make_move_iterator(std::end(container)));
}
Expand Down
Loading