Skip to content

Commit

Permalink
for all
Browse files Browse the repository at this point in the history
  • Loading branch information
amorynan committed Nov 20, 2024
1 parent 702a89d commit 71c8c10
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 68 deletions.
14 changes: 10 additions & 4 deletions be/src/vec/columns/column.h
Original file line number Diff line number Diff line change
Expand Up @@ -700,12 +700,18 @@ class IColumn : public COW<IColumn> {
*/
String dump_structure() const;

// only used in agg value replace
// ColumnString should replace according to 0,1,2... ,size,0,1,2...
virtual void replace_column_data(const IColumn&, size_t row, size_t self_row = 0) = 0;
// only used in agg value replace for column which is not variable length
virtual void replace_column_data(const IColumn&, size_t row, size_t self_row = 0) {
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
"Method replace_column_data is not supported for " + get_name());
}

// only used in ColumnNullable replace_column_data
virtual void replace_column_data_default(size_t self_row = 0) = 0;
virtual void replace_column_data_default(size_t self_row = 0) {
throw doris::Exception(
ErrorCode::NOT_IMPLEMENTED_ERROR,
"Method replace_column_data_default is not supported for " + get_name());
}

virtual void replace_column_null_data(const uint8_t* __restrict null_map) {}

Expand Down
20 changes: 0 additions & 20 deletions be/src/vec/columns/column_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,26 +231,6 @@ class ColumnArray final : public COWHelper<IColumn, ColumnArray> {
void insert_indices_from(const IColumn& src, const int* indices_begin,
const int* indices_end) override;

void replace_column_data(const IColumn& rhs, size_t row, size_t self_row = 0) override {
DCHECK(size() > self_row);
const auto& r = assert_cast<const ColumnArray&>(rhs);
const size_t nested_row_size = r.size_at(row);
const size_t r_nested_start_off = r.offset_at(row);

// we should clear data because we call resize() before replace_column_data()
if (self_row == 0) {
data->clear();
}
get_offsets()[self_row] = get_offsets()[self_row - 1] + nested_row_size;
// we make sure call replace_column_data() by order so, here we just insert data for nested
data->insert_range_from(r.get_data(), r_nested_start_off, nested_row_size);
}

void replace_column_data_default(size_t self_row = 0) override {
DCHECK(size() > self_row);
get_offsets()[self_row] = get_offsets()[self_row - 1];
}

void clear() override {
data->clear();
offsets->clear();
Expand Down
22 changes: 0 additions & 22 deletions be/src/vec/columns/column_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,28 +145,6 @@ class ColumnMap final : public COWHelper<IColumn, ColumnMap> {
return append_data_by_selector_impl<ColumnMap>(res, selector);
}

void replace_column_data(const IColumn& rhs, size_t row, size_t self_row = 0) override {
DCHECK(size() > self_row);
const auto& r = assert_cast<const ColumnMap&>(rhs);
const size_t nested_row_size = r.size_at(row);
const size_t r_key_nested_start_off = r.offset_at(row);
const size_t r_val_nested_start_off = r.offset_at(row);

if (self_row == 0) {
keys_column->clear();
values_column->clear();
}
get_offsets()[self_row] = get_offsets()[self_row - 1] + nested_row_size;
// here we use batch size to avoid many virtual call in nested column
keys_column->insert_range_from(r.get_keys(), r_key_nested_start_off, nested_row_size);
values_column->insert_range_from(r.get_values(), r_val_nested_start_off, nested_row_size);
}

void replace_column_data_default(size_t self_row = 0) override {
DCHECK(size() > self_row);
get_offsets()[self_row] = get_offsets()[self_row - 1];
}

ColumnArray::Offsets64& ALWAYS_INLINE get_offsets() {
return assert_cast<COffsets&>(*offsets_column).get_data();
}
Expand Down
12 changes: 0 additions & 12 deletions be/src/vec/columns/column_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -552,18 +552,6 @@ class ColumnString final : public COWHelper<IColumn, ColumnString> {
offsets.clear();
}

void replace_column_data(const IColumn& rhs, size_t row, size_t self_row = 0) override {
throw doris::Exception(ErrorCode::INTERNAL_ERROR,
"Method replace_column_data is not supported for " + get_name());
}

// should replace according to 0,1,2... ,size,0,1,2...
void replace_column_data_default(size_t self_row = 0) override {
throw doris::Exception(
ErrorCode::INTERNAL_ERROR,
"Method replace_column_data_default is not supported for " + get_name());
}

void compare_internal(size_t rhs_row_id, const IColumn& rhs, int nan_direction_hint,
int direction, std::vector<uint8>& cmp_res,
uint8* __restrict filter) const override;
Expand Down
11 changes: 1 addition & 10 deletions be/src/vec/columns/column_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class ColumnStruct final : public COWHelper<IColumn, ColumnStruct> {
static MutablePtr create(Arg&& arg) {
return Base::create(std::forward<Arg>(arg));
}

bool is_variable_length() const override { return true; }
std::string get_name() const override;
bool is_column_struct() const override { return true; }
const char* get_family_name() const override { return "Struct"; }
Expand Down Expand Up @@ -142,15 +142,6 @@ class ColumnStruct final : public COWHelper<IColumn, ColumnStruct> {
void append_data_by_selector(MutableColumnPtr& res, const Selector& selector) const override {
return append_data_by_selector_impl<ColumnStruct>(res, selector);
}
void replace_column_data(const IColumn& rhs, size_t row, size_t self_row = 0) override {
throw doris::Exception(ErrorCode::INTERNAL_ERROR,
"Method replace_column_data is not supported for " + get_name());
}

void replace_column_data_default(size_t self_row = 0) override {
throw doris::Exception(ErrorCode::INTERNAL_ERROR,
"Method replace_column_data is not supported for " + get_name());
}

void insert_range_from(const IColumn& src, size_t start, size_t length) override;
ColumnPtr filter(const Filter& filt, ssize_t result_size_hint) const override;
Expand Down

0 comments on commit 71c8c10

Please sign in to comment.