Skip to content

Commit

Permalink
remove get data at in array
Browse files Browse the repository at this point in the history
  • Loading branch information
Mryange committed Nov 18, 2024
1 parent 45a7a59 commit aa3141b
Showing 1 changed file with 6 additions and 24 deletions.
30 changes: 6 additions & 24 deletions be/src/vec/columns/column_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,38 +159,20 @@ void ColumnArray::get(size_t n, Field& res) const {
}

StringRef ColumnArray::get_data_at(size_t n) const {
/** Returns the range of memory that covers all elements of the array.
* Works for arrays of fixed length values.
* For arrays of strings and arrays of arrays, the resulting chunk of memory may not be one-to-one correspondence with the elements,
* since it contains only the data laid in succession, but not the offsets.
*/
size_t offset_of_first_elem = offset_at(n);
StringRef first;
if (offset_of_first_elem < get_data().size()) {
first = get_data().get_data_at(offset_of_first_elem);
}

size_t array_size = size_at(n);
if (array_size == 0) {
return StringRef(first.data, 0);
}

size_t offset_of_last_elem = offset_at(n + 1) - 1;
StringRef last = get_data().get_data_at(offset_of_last_elem);
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
"Method get_data_at is not supported for " + get_name());
}

return StringRef(first.data, last.data + last.size - first.data);
void ColumnArray::insert_data(const char* pos, size_t length) {
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
"Method insert_data is not supported for " + get_name());
}

bool ColumnArray::is_default_at(size_t n) const {
const auto& offsets_data = get_offsets();
return offsets_data[n] == offsets_data[static_cast<ssize_t>(n) - 1];
}

void ColumnArray::insert_data(const char* pos, size_t length) {
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
"Method insert_data is not supported for " + get_name());
}

StringRef ColumnArray::serialize_value_into_arena(size_t n, Arena& arena,
char const*& begin) const {
size_t array_size = size_at(n);
Expand Down

0 comments on commit aa3141b

Please sign in to comment.