This is an automated email from the ASF dual-hosted git repository.
Mryange pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 706f4cf2406 [fix](be) Remove IColumn::erase and reject oversized
window aggregate strings (#70744)
706f4cf2406 is described below
commit 706f4cf240655e64cc5b1af60c5e59cbe3a29d01
Author: Mryange <[email protected]>
AuthorDate: Tue Nov 24 10:26:31 2026 +0800
[fix](be) Remove IColumn::erase and reject oversized window aggregate
strings (#70744)
### Background
The analytic sink buffers window-function input columns across blocks
and prunes rows that are no longer needed. It maintains separate buffers
for aggregate inputs and for partition and order keys.
### What problem does this PR solve?
Issue Number: None
Related PR: #68210 (single-value aggregate states now own selected
values)
PR Type: Bugfix
Problem Summary:
Some single-value aggregate states previously retained references to
input columns, so window pruning had to mutate columns in place through
IColumn::erase. PR #68210 changed these states to own their selected
values, allowing pruning to replace columns with cut() results and
making erase unnecessary. Aggregate input columns also cannot use the
ignore-overflow insertion path because many aggregate functions do not
support ColumnString64. Oversized aggregate strings now raise the normal
overflow error, while partition and order keys keep their existing
promotion path.
### Details
- **Change map:** Production code removes 154 lines and adds 30. The
change removes the IColumn::erase API and its column implementations,
switches analytic pruning to cut(), and removes 669 lines of
erase-specific unit tests. Aggregate input columns use checked range
insertion, while partition and order key columns retain ignore-overflow
insertion and ColumnString64 promotion.
- **Frequency:** The overflow occurs when buffered window aggregate
string inputs exceed the 4 GiB limit.
- **Root cause:** The analytic sink used ignore-overflow insertion for
aggregate inputs, even though downstream aggregate functions may not
accept ColumnString64.
- **Why existing tests missed it:** Existing tests did not exercise a
window aggregate input exceeding the string-column limit across blocks.
- **Fix:** Use ordinary insert_range_from() for aggregate inputs,
preserve the key-column promotion path, replace row pruning with cut(),
and remove IColumn::erase.
- **Other paths and branches:** Partition and order keys may still
promote to ColumnString64 because their comparison path supports it.
### Testing
- Passed: BUILD_TYPE=ASAN ./build.sh --be -j48 on the development
machine.
- Passed: build-support/check-build-hygiene.sh.
- Passed: build-support/check-format.sh with clang-format 16.
- Passed: `./run-be-ut.sh --run --filter=ColumnComplexTest.* -j 48`. The
BE unit-test target built and all 8 selected tests passed.
- Not run: The full BE unit-test suite and regression tests.
### Notes for Reviewers
PR #68210 replaced single-value aggregate states that retained
input-column references with states that own their selected values. This
removes the lifetime constraint that required in-place erase during
window row pruning.
### Release note
Window-function aggregate string inputs that exceed the 4 GiB
string-column limit now fail with a string overflow error instead of
continuing through an unsupported 64-bit column path.
### Check List (For Author)
- Behavior changed: Yes (see Details).
- Does this need documentation: No.
- Pre-submission status: Partially verified. The BE build, hygiene,
formatting, and targeted ColumnComplex unit tests passed. The full BE
unit-test and regression suites were not run.
### AI Disclosure
- Tool: Codex (GPT-6).
- Generated: BE source changes, removal of erase-specific unit tests,
and this description.
- Human review: The user reviewed the synchronized BE source changes
before authorizing PR submission.
---------
Co-authored-by: Codex <[email protected]>
---
be/src/core/column/column.h | 4 -
be/src/core/column/column_array.cpp | 18 ---
be/src/core/column/column_array.h | 2 -
be/src/core/column/column_complex.h | 10 --
be/src/core/column/column_const.h | 8 -
be/src/core/column/column_decimal.h | 10 --
be/src/core/column/column_map.cpp | 20 ---
be/src/core/column/column_map.h | 1 -
be/src/core/column/column_nullable.h | 5 -
be/src/core/column/column_string.cpp | 23 ---
be/src/core/column/column_string.h | 2 -
be/src/core/column/column_struct.h | 6 -
be/src/core/column/column_vector.h | 10 --
.../core/column/variant_v2/column_variant_v2.cpp | 23 ---
be/src/core/column/variant_v2/column_variant_v2.h | 1 -
be/src/exec/operator/analytic_sink_operator.cpp | 39 +++--
be/src/exec/operator/analytic_sink_operator.h | 2 +
be/test/core/block/column_complex_test.cpp | 18 ---
be/test/core/column/column_array_test.cpp | 125 ---------------
be/test/core/column/column_const_test.cpp | 15 --
be/test/core/column/column_decimal_test.cpp | 38 -----
be/test/core/column/column_map_test.cpp | 170 ---------------------
be/test/core/column/column_nullable_test.cpp | 85 -----------
be/test/core/column/column_string_test.cpp | 58 -------
be/test/core/column/column_struct_test.cpp | 63 --------
be/test/core/column/column_variant_v2_test.cpp | 43 ------
be/test/core/column/column_vector_test.cpp | 54 -------
27 files changed, 30 insertions(+), 823 deletions(-)
diff --git a/be/src/core/column/column.h b/be/src/core/column/column.h
index d92351001dc..9a1afcfb41f 100644
--- a/be/src/core/column/column.h
+++ b/be/src/core/column/column.h
@@ -176,10 +176,6 @@ public:
* for this column type
* eg: erase(3, 2) means remove the idx 3 and 4 elements (0-based)
*/
- virtual void erase(size_t start, size_t length) {
- throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
- "Method erase is not supported for " +
get_name());
- }
/// cut or expand inplace. `this` would be moved, only the return value is
avaliable.
virtual Ptr shrink(size_t length) const final {
diff --git a/be/src/core/column/column_array.cpp
b/be/src/core/column/column_array.cpp
index dad91af31c0..ccfea04167a 100644
--- a/be/src/core/column/column_array.cpp
+++ b/be/src/core/column/column_array.cpp
@@ -1024,24 +1024,6 @@ MutableColumnPtr ColumnArray::permute(const Permutation&
perm, size_t limit) con
return res;
}
-void ColumnArray::erase(size_t start, size_t length) {
- if (start >= size() || length == 0) {
- return;
- }
- length = std::min(length, size() - start);
-
- const auto& offsets_data = get_offsets();
- auto data_start = offsets_data[start - 1];
- auto data_end = offsets_data[start + length - 1];
- auto data_length = data_end - data_start;
- data->erase(data_start, data_length);
- offsets->erase(start, length);
-
- for (auto i = start; i < size(); ++i) {
- get_offsets()[i] -= data_length;
- }
-}
-
void ColumnArray::replace_float_special_values() {
get_data().replace_float_special_values();
}
diff --git a/be/src/core/column/column_array.h
b/be/src/core/column/column_array.h
index 7c3ecc06124..a4d2b6f6a3c 100644
--- a/be/src/core/column/column_array.h
+++ b/be/src/core/column/column_array.h
@@ -253,8 +253,6 @@ public:
->get_number_of_dimensions(); /// Every modern C++
compiler optimizes tail recursion.
}
- void erase(size_t start, size_t length) override;
-
size_t serialize_impl(char* pos, const size_t row) const override;
size_t deserialize_impl(const char* pos) override;
size_t serialize_size_at(size_t row) const override;
diff --git a/be/src/core/column/column_complex.h
b/be/src/core/column/column_complex.h
index 3df7be8e63b..ca182a74a67 100644
--- a/be/src/core/column/column_complex.h
+++ b/be/src/core/column/column_complex.h
@@ -238,16 +238,6 @@ public:
data[self_row] = assert_cast<const Self&,
TypeCheckOnRelease::DISABLE>(rhs).data[row];
}
- void erase(size_t start, size_t length) override {
- if (start >= data.size() || length == 0) {
- return;
- }
- length = std::min(length, data.size() - start);
- size_t remain_size = data.size() - length;
- std::move(data.begin() + start + length, data.end(), data.begin() +
start);
- data.resize(remain_size);
- }
-
size_t serialize_size_at(size_t row) const override { return
sizeof(data[row]); }
private:
diff --git a/be/src/core/column/column_const.h
b/be/src/core/column/column_const.h
index 44b1f9d477a..895a1636de9 100644
--- a/be/src/core/column/column_const.h
+++ b/be/src/core/column/column_const.h
@@ -320,14 +320,6 @@ public:
void finalize() override { data->finalize(); }
- void erase(size_t start, size_t length) override {
- if (start >= s || length == 0) {
- return;
- }
- length = std::min(length, s - start);
- s = s - length;
- }
-
size_t serialize_impl(char* pos, const size_t row) const override {
return data->serialize_impl(pos, 0);
}
diff --git a/be/src/core/column/column_decimal.h
b/be/src/core/column/column_decimal.h
index 23ae05b4a85..141c8068599 100644
--- a/be/src/core/column/column_decimal.h
+++ b/be/src/core/column/column_decimal.h
@@ -262,16 +262,6 @@ public:
CppNativeType get_intergral_part(size_t n) const;
CppNativeType get_fractional_part(size_t n) const;
- void erase(size_t start, size_t length) override {
- if (start >= data.size() || length == 0) {
- return;
- }
- length = std::min(length, data.size() - start);
- size_t elements_to_move = data.size() - start - length;
- memmove(data.data() + start, data.data() + start + length,
- elements_to_move * sizeof(value_type));
- data.resize(data.size() - length);
- }
size_t serialize_impl(char* pos, const size_t row) const override;
size_t deserialize_impl(const char* pos) override;
size_t serialize_size_at(size_t row) const override { return
sizeof(value_type); }
diff --git a/be/src/core/column/column_map.cpp
b/be/src/core/column/column_map.cpp
index 2d9c266e73a..9b8b4719b50 100644
--- a/be/src/core/column/column_map.cpp
+++ b/be/src/core/column/column_map.cpp
@@ -747,26 +747,6 @@ ColumnPtr ColumnMap::convert_to_full_column_if_const()
const {
offsets_column->convert_to_full_column_if_const());
}
-void ColumnMap::erase(size_t start, size_t length) {
- if (start >= size() || length == 0) {
- return;
- }
- length = std::min(length, size() - start);
-
- const auto& offsets_data = get_offsets();
- auto entry_start = offsets_data[start - 1];
- auto entry_end = offsets_data[start + length - 1];
- auto entry_length = entry_end - entry_start;
-
- keys_column->erase(entry_start, entry_length);
- values_column->erase(entry_start, entry_length);
- offsets_column->erase(start, length);
-
- for (auto i = start; i < size(); ++i) {
- get_offsets()[i] -= entry_length;
- }
-}
-
template <bool positive>
struct ColumnMap::less {
const ColumnMap& parent;
diff --git a/be/src/core/column/column_map.h b/be/src/core/column/column_map.h
index 0781a2cb503..f8943c315db 100644
--- a/be/src/core/column/column_map.h
+++ b/be/src/core/column/column_map.h
@@ -232,7 +232,6 @@ public:
return IColumn::convert_column_if_overflow();
}
- void erase(size_t start, size_t length) override;
size_t serialize_impl(char* pos, const size_t row) const override;
size_t deserialize_impl(const char* pos) override;
size_t serialize_size_at(size_t row) const override;
diff --git a/be/src/core/column/column_nullable.h
b/be/src/core/column/column_nullable.h
index 382ce7c4fc4..5a6114c659f 100644
--- a/be/src/core/column/column_nullable.h
+++ b/be/src/core/column/column_nullable.h
@@ -380,11 +380,6 @@ public:
void finalize() override { get_nested_column().finalize(); }
- void erase(size_t start, size_t length) override {
- get_nested_column().erase(start, length);
- get_null_map_column().erase(start, length);
- }
-
size_t serialize_impl(char* pos, const size_t row) const override;
size_t deserialize_impl(const char* pos) override;
size_t serialize_size_at(size_t row) const override {
diff --git a/be/src/core/column/column_string.cpp
b/be/src/core/column/column_string.cpp
index 1ea2f24c1e7..a9261421cbe 100644
--- a/be/src/core/column/column_string.cpp
+++ b/be/src/core/column/column_string.cpp
@@ -681,29 +681,6 @@ ColumnPtr ColumnStr<T>::convert_column_if_overflow() {
return this->get_ptr();
}
-template <typename T>
-void ColumnStr<T>::erase(size_t start, size_t length) {
- if (start >= offsets.size() || length == 0) {
- return;
- }
- length = std::min(length, offsets.size() - start);
-
- auto char_start = offsets[start - 1];
- auto char_end = offsets[start + length - 1];
- auto char_length = char_end - char_start;
- memmove(chars.data() + char_start, chars.data() + char_end, chars.size() -
char_end);
- chars.resize(chars.size() - char_length);
-
- const size_t remain_size = offsets.size() - length;
- memmove(offsets.data() + start, offsets.data() + start + length,
- (remain_size - start) * sizeof(T));
- offsets.resize(remain_size);
-
- for (size_t i = start; i < remain_size; ++i) {
- offsets[i] -= char_length;
- }
-}
-
template <typename T>
Field ColumnStr<T>::operator[](size_t n) const {
assert(n < size());
diff --git a/be/src/core/column/column_string.h
b/be/src/core/column/column_string.h
index 753f7957723..d0da6e99632 100644
--- a/be/src/core/column/column_string.h
+++ b/be/src/core/column/column_string.h
@@ -641,8 +641,6 @@ public:
ColumnPtr convert_column_if_overflow() override;
- void erase(size_t start, size_t length) override;
-
void deserialize(StringRef* keys, const size_t num_rows) override;
void serialize(StringRef* keys, const size_t num_rows) const override;
size_t serialize_impl(char* pos, size_t row) const override;
diff --git a/be/src/core/column/column_struct.h
b/be/src/core/column/column_struct.h
index 83affe72965..2a770bb79e3 100644
--- a/be/src/core/column/column_struct.h
+++ b/be/src/core/column/column_struct.h
@@ -183,12 +183,6 @@ public:
return IColumn::convert_column_if_overflow();
}
- void erase(size_t start, size_t length) override {
- for (auto& col : columns) {
- col->erase(start, length);
- }
- }
-
size_t serialize_size_at(size_t row) const override;
size_t deserialize_impl(const char* pos) override;
size_t serialize_impl(char* pos, const size_t row) const override;
diff --git a/be/src/core/column/column_vector.h
b/be/src/core/column/column_vector.h
index b6d79ae9d26..6d4eb83fc3c 100644
--- a/be/src/core/column/column_vector.h
+++ b/be/src/core/column/column_vector.h
@@ -358,16 +358,6 @@ public:
int direction, std::vector<uint8_t>& cmp_res,
uint8_t* __restrict filter) const override;
- void erase(size_t start, size_t length) override {
- if (start >= data.size() || length == 0) {
- return;
- }
- length = std::min(length, data.size() - start);
- size_t elements_to_move = data.size() - start - length;
- memmove(data.data() + start, data.data() + start + length,
- elements_to_move * sizeof(value_type));
- data.resize(data.size() - length);
- }
size_t serialize_impl(char* pos, const size_t row) const override;
size_t deserialize_impl(const char* pos) override;
size_t serialize_size_at(size_t row) const override { return
sizeof(value_type); }
diff --git a/be/src/core/column/variant_v2/column_variant_v2.cpp
b/be/src/core/column/variant_v2/column_variant_v2.cpp
index d632613bdba..e2511b0e335 100644
--- a/be/src/core/column/variant_v2/column_variant_v2.cpp
+++ b/be/src/core/column/variant_v2/column_variant_v2.cpp
@@ -1889,29 +1889,6 @@ void ColumnVariantV2::pop_back(size_t length) {
_check_invariants();
}
-void ColumnVariantV2::erase(size_t start, size_t length) {
- DORIS_CHECK_LE(start, size()) << "erase start exceeds the column size";
- DORIS_CHECK_LE(length, size() - start) << "erase range exceeds the column
size";
- if (length == 0) {
- return;
- }
- if (_shredded) {
- ensure_encoded();
- }
- if (_typed) {
- mutate_subcolumn(_typed);
- _typed->erase(start, length);
- _check_invariants();
- return;
- }
- require_exclusive(_meta_ids, "metadata ids");
- require_exclusive(_values, "values");
- // The metadata dictionary keeps blobs that no remaining row references;
ids stay valid.
- _values->erase(start, length);
- _meta_ids->erase(start, length);
- _check_invariants();
-}
-
StringRef ColumnVariantV2::get_data_at(size_t) const {
throw_unsupported("get_data_at");
}
diff --git a/be/src/core/column/variant_v2/column_variant_v2.h
b/be/src/core/column/variant_v2/column_variant_v2.h
index e54b7ad3e05..9b42733d235 100644
--- a/be/src/core/column/variant_v2/column_variant_v2.h
+++ b/be/src/core/column/variant_v2/column_variant_v2.h
@@ -264,7 +264,6 @@ public:
const uint32_t* indices_end) override;
void pop_back(size_t length) override;
// The analytic sink erases the rows it has consumed from its partition
and order key columns.
- void erase(size_t start, size_t length) override;
StringRef get_data_at(size_t row) const override;
void insert_data(const char* pos, size_t length) override;
diff --git a/be/src/exec/operator/analytic_sink_operator.cpp
b/be/src/exec/operator/analytic_sink_operator.cpp
index 19ccff08e3b..d784074c192 100644
--- a/be/src/exec/operator/analytic_sink_operator.cpp
+++ b/be/src/exec/operator/analytic_sink_operator.cpp
@@ -1379,18 +1379,20 @@ Status
AnalyticSinkOperatorX::_add_input_block(doris::RuntimeState* state, Block
{
SCOPED_TIMER(local_state._compute_partition_by_timer);
for (size_t i = 0; i < local_state._partition_by_eq_expr_ctxs.size();
++i) {
- RETURN_IF_ERROR(
- _insert_range_column(input_block,
local_state._partition_by_eq_expr_ctxs[i],
-
local_state._partition_by_columns[i].get(), block_rows));
+ // String key columns are promoted to ColumnString64 after
appending.
+ RETURN_IF_ERROR(_insert_range_column_ignore_overflow(
+ input_block, local_state._partition_by_eq_expr_ctxs[i],
+ local_state._partition_by_columns[i].get(), block_rows));
convert_column_if_overflow(local_state._partition_by_columns[i]);
}
}
{
SCOPED_TIMER(local_state._compute_order_by_timer);
for (size_t i = 0; i < local_state._order_by_eq_expr_ctxs.size(); ++i)
{
- RETURN_IF_ERROR(_insert_range_column(input_block,
local_state._order_by_eq_expr_ctxs[i],
-
local_state._order_by_columns[i].get(),
- block_rows));
+ // String key columns are promoted to ColumnString64 after
appending.
+ RETURN_IF_ERROR(_insert_range_column_ignore_overflow(
+ input_block, local_state._order_by_eq_expr_ctxs[i],
+ local_state._order_by_columns[i].get(), block_rows));
convert_column_if_overflow(local_state._order_by_columns[i]);
}
}
@@ -1456,14 +1458,20 @@ void AnalyticSinkLocalState::_remove_unused_rows() {
continue;
}
for (size_t j = 0; j < _agg_expr_ctxs[i].size(); j++) {
- _agg_input_columns[i][j]->erase(0, remove_rows);
+ auto& column = _agg_input_columns[i][j];
+ const auto start = static_cast<size_t>(remove_rows);
+ column = column->cut(start, column->size() -
start)->assert_mutable();
}
}
for (size_t i = 0; i < _partition_exprs_size; i++) {
- _partition_by_columns[i]->erase(0, remove_rows);
+ auto& column = _partition_by_columns[i];
+ const auto start = static_cast<size_t>(remove_rows);
+ column = column->cut(start, column->size() -
start)->assert_mutable();
}
for (size_t i = 0; i < _order_by_exprs_size; i++) {
- _order_by_columns[i]->erase(0, remove_rows);
+ auto& column = _order_by_columns[i];
+ const auto start = static_cast<size_t>(remove_rows);
+ column = column->cut(start, column->size() -
start)->assert_mutable();
}
}
COUNTER_UPDATE(_remove_count, 1);
@@ -1597,8 +1605,17 @@ Status
AnalyticSinkOperatorX::_insert_range_column(Block* block, const VExprCont
ColumnPtr column;
RETURN_IF_ERROR(expr->execute(block, column));
column = column->convert_to_full_column_if_const();
- // iff dst_column is string, maybe overflow of 4G, so need ignore overflow
- // the column is used by compare_at self to find the range, it's need
convert it when overflow?
+ dst_column->insert_range_from(*column, 0, length);
+ return Status::OK();
+}
+
+Status AnalyticSinkOperatorX::_insert_range_column_ignore_overflow(Block*
block,
+ const
VExprContextSPtr& expr,
+ IColumn*
dst_column,
+ size_t
length) {
+ ColumnPtr column;
+ RETURN_IF_ERROR(expr->execute(block, column));
+ column = column->convert_to_full_column_if_const();
dst_column->insert_range_from_ignore_overflow(*column, 0, length);
return Status::OK();
}
diff --git a/be/src/exec/operator/analytic_sink_operator.h
b/be/src/exec/operator/analytic_sink_operator.h
index 04f52d9ead3..dbe4de1f4c3 100644
--- a/be/src/exec/operator/analytic_sink_operator.h
+++ b/be/src/exec/operator/analytic_sink_operator.h
@@ -304,6 +304,8 @@ private:
void _prepare_spill(RuntimeState* state);
Status _insert_range_column(Block* block, const VExprContextSPtr& expr,
IColumn* dst_column,
size_t length);
+ Status _insert_range_column_ignore_overflow(Block* block, const
VExprContextSPtr& expr,
+ IColumn* dst_column, size_t
length);
Status _add_input_block(doris::RuntimeState* state, Block* input_block);
ObjectPool* _pool = nullptr;
diff --git a/be/test/core/block/column_complex_test.cpp
b/be/test/core/block/column_complex_test.cpp
index 4ced4c4f8e7..f9e2a830912 100644
--- a/be/test/core/block/column_complex_test.cpp
+++ b/be/test/core/block/column_complex_test.cpp
@@ -689,24 +689,6 @@ TEST_F(ColumnQuantileStateTest, OperatorValidate) {
check_field_type(column);
}
-TEST(ColumnComplexTest, TestErase) {
- using ColumnTest = ColumnComplexType<TYPE_BITMAP>;
-
- auto column_test = ColumnTest::create();
-
- column_test->data.push_back(BitmapValue {});
- column_test->data.push_back(BitmapValue {});
- column_test->data.push_back(BitmapValue {});
- column_test->data.push_back(BitmapValue {});
- column_test->data.push_back(BitmapValue {});
-
- column_test->erase(1, 0);
-
- column_test->erase(3, 1);
-
- EXPECT_EQ(column_test->size(), 4);
-}
-
TEST(ColumnComplexTest, TestUpdateHashWithValue) {
using ColumnTest = ColumnComplexType<TYPE_BITMAP>;
diff --git a/be/test/core/column/column_array_test.cpp
b/be/test/core/column/column_array_test.cpp
index 13d532536d4..147fd06e2aa 100644
--- a/be/test/core/column/column_array_test.cpp
+++ b/be/test/core/column/column_array_test.cpp
@@ -940,129 +940,4 @@ TEST_F(ColumnArrayTest, IntArrayPermuteTest) {
}
}
-TEST_F(ColumnArrayTest, ArrayTypeTesterase) {
- DataTypePtr datetype_32 =
std::make_shared<DataTypeNullable>(std::make_shared<DataTypeInt32>());
- DataTypePtr datetype_array = std::make_shared<DataTypeArray>(datetype_32);
- auto c = datetype_array->create_column();
- auto column_res = datetype_array->create_column();
- auto* column_array = assert_cast<ColumnArray*>(c.get());
- auto& column_offsets = column_array->get_offsets_column();
- auto& column_data = column_array->get_data();
-
- std::vector<int32_t> data = {1, 2, 3, 4, 5};
- std::vector<int32_t> data2 = {11, 22};
- std::vector<int32_t> data3 = {33, 44, 55};
- // insert null
- std::vector<int32_t> data5 = {66};
-
- std::vector<UInt64> offset = {5, 7, 10, 11, 12};
- for (auto d : data) {
- column_data.insert_data(reinterpret_cast<const char*>(&d), sizeof(d));
- }
- for (auto d : data2) {
- column_data.insert_data(reinterpret_cast<const char*>(&d), sizeof(d));
- }
- for (auto d : data3) {
- column_data.insert_data(reinterpret_cast<const char*>(&d), sizeof(d));
- }
- column_data.insert_default();
- for (auto d : data5) {
- column_data.insert_data(reinterpret_cast<const char*>(&d), sizeof(d));
- }
-
- for (auto d : offset) {
- column_offsets.insert_data(reinterpret_cast<const char*>(&d),
sizeof(d));
- }
-
- column_res->insert_range_from(*column_array, 0, offset.size());
- column_array->erase(0, 2);
- EXPECT_EQ(column_array->size(), 3);
- // Block tmp;
- // tmp.insert({std::move(c), datetype_array, "asd"});
- // std::cout << tmp.dump_data(0, tmp.rows());
-
- // Block tmp2;
- // tmp2.insert({std::move(column_res), datetype_array, "asd2"});
- // std::cout << tmp2.dump_data(0, tmp2.rows());
- auto* column_result = assert_cast<ColumnArray*>(column_res.get());
- auto& column_offsets_res = column_result->get_offsets_column();
- auto& offset_data_res = column_offsets_res;
- auto& offset_data = column_offsets;
- auto& column_data_res = assert_cast<ColumnInt32&>(
-
assert_cast<ColumnNullable&>(column_result->get_data()).get_nested_column());
- auto& column_data_origin = assert_cast<ColumnInt32&>(
- assert_cast<ColumnNullable&>(column_data).get_nested_column());
- for (int i = 0; i < column_array->size(); ++i) {
- std::cout << datetype_array->to_string(*column_array, i) << std::endl;
- std::cout << datetype_array->to_string(*column_res, i + 2) <<
std::endl;
- EXPECT_EQ(column_data_origin.get_element(i),
column_data_res.get_element(i + 7));
- EXPECT_EQ(offset_data.get_element(i), offset_data_res.get_element(i +
2) - 7);
- }
-}
-
-TEST_F(ColumnArrayTest, ArrayTypeTest2erase) {
- DataTypePtr datetype_32 =
std::make_shared<DataTypeNullable>(std::make_shared<DataTypeInt32>());
- DataTypePtr datetype_array = std::make_shared<DataTypeArray>(datetype_32);
- auto c = datetype_array->create_column();
- auto* column_array = assert_cast<ColumnArray*>(c.get());
- auto column_res = column_array->clone_empty();
- auto& column_offsets = column_array->get_offsets_column();
- auto& column_data = column_array->get_data();
-
- std::vector<int32_t> data = {1, 2, 3, 4, 5};
- std::vector<int32_t> data2 = {11, 22};
- std::vector<int32_t> data3 = {33, 44, 55};
- // insert null
- std::vector<int32_t> data5 = {66};
-
- std::vector<UInt64> offset = {5, 7, 10, 11, 12};
- for (auto d : data) {
- column_data.insert_data(reinterpret_cast<const char*>(&d), sizeof(d));
- }
- for (auto d : data2) {
- column_data.insert_data(reinterpret_cast<const char*>(&d), sizeof(d));
- }
- for (auto d : data3) {
- column_data.insert_data(reinterpret_cast<const char*>(&d), sizeof(d));
- }
- column_data.insert_default();
- for (auto d : data5) {
- column_data.insert_data(reinterpret_cast<const char*>(&d), sizeof(d));
- }
-
- for (auto d : offset) {
- column_offsets.insert_data(reinterpret_cast<const char*>(&d),
sizeof(d));
- }
-
- column_res->insert_from(*column_array, 0);
- column_res->insert_from(*column_array, 1);
- column_res->insert_from(*column_array, 4);
-
- column_array->erase(2, 2);
- EXPECT_EQ(column_array->size(), 3);
- std::cout << "have call erase" << std::endl;
- // Block tmp;
- // tmp.insert({std::move(c), datetype_array, "asd"});
- // std::cout << tmp.dump_data(0, tmp.rows());
-
- // Block tmp2;
- // tmp2.insert({std::move(column_res), datetype_array, "asd2"});
- // std::cout << tmp2.dump_data(0, tmp2.rows());
-
- auto* column_result = assert_cast<ColumnArray*>(column_res.get());
- auto& column_offsets_res = column_result->get_offsets_column();
- auto& offset_data_res = column_offsets_res;
- auto& offset_data = column_offsets;
- auto& column_data_res = assert_cast<ColumnInt32&>(
-
assert_cast<ColumnNullable&>(column_result->get_data()).get_nested_column());
- auto& column_data_origin = assert_cast<ColumnInt32&>(
- assert_cast<ColumnNullable&>(column_data).get_nested_column());
- for (int i = 0; i < column_array->size(); ++i) {
- std::cout << datetype_array->to_string(*column_array, i) << std::endl;
- std::cout << datetype_array->to_string(*column_res, i) << std::endl;
- EXPECT_EQ(column_data_origin.get_element(i),
column_data_res.get_element(i));
- EXPECT_EQ(offset_data.get_element(i), offset_data_res.get_element(i));
- }
-}
-
} // namespace doris
diff --git a/be/test/core/column/column_const_test.cpp
b/be/test/core/column/column_const_test.cpp
index e3cf2fbdc71..00059913b93 100644
--- a/be/test/core/column/column_const_test.cpp
+++ b/be/test/core/column/column_const_test.cpp
@@ -381,21 +381,6 @@ TEST(ColumnConstTest, structure_equals) {
}
}
-TEST(ColumnConstTest, erase) {
- auto column_data = ColumnHelper::create_column<DataTypeInt64>({7});
- auto column_const = ColumnConst::create(column_data, 3);
- column_const->erase(0, 1);
- EXPECT_EQ(column_const->size(), 2);
- EXPECT_EQ(column_const->get_data_column().get_int(0), 7);
-
- column_const->erase(1, 1);
- EXPECT_EQ(column_const->size(), 1);
- EXPECT_EQ(column_const->get_data_column().get_int(0), 7);
-
- column_const->erase(0, 1);
- EXPECT_EQ(column_const->size(), 0);
-}
-
TEST(ColumnConstTest, replace_column_data) {
auto column_data = ColumnHelper::create_column<DataTypeInt64>({7});
auto column_const = ColumnConst::create(column_data, 3);
diff --git a/be/test/core/column/column_decimal_test.cpp
b/be/test/core/column/column_decimal_test.cpp
index ca4cffa0cab..fd290dd1ccc 100644
--- a/be/test/core/column/column_decimal_test.cpp
+++ b/be/test/core/column/column_decimal_test.cpp
@@ -629,42 +629,4 @@ TEST_F(ColumnDecimalTest, sort_column) {
_column_decimal_common_test_with_type(assert_sort_column_callback, false);
}
-TEST_F(ColumnDecimalTest, ScalaTypeDecimalTesterase) {
- auto datetype_decimal = create_decimal(10, 2, false);
- auto column = datetype_decimal->create_column();
- auto column_res = datetype_decimal->create_column();
-
- std::vector<double> data = {1.1, 2.2, 3.3, 4.4, 5.5};
- for (auto d : data) {
- column->insert_data(reinterpret_cast<const char*>(&d), sizeof(d));
- column_res->insert_data(reinterpret_cast<const char*>(&d), sizeof(d));
- }
- column->erase(0, 2);
- EXPECT_EQ(column->size(), 3);
- for (int i = 0; i < column->size(); ++i) {
- EXPECT_EQ(column->get_data_at(i), column_res->get_data_at(i + 2));
- }
-}
-
-TEST_F(ColumnDecimalTest, ScalaTypeDecimalTest2erase) {
- auto datetype_decimal = create_decimal(10, 2, false);
- auto column = datetype_decimal->create_column();
- auto column_res = datetype_decimal->create_column();
-
- std::vector<double> data = {1.1, 2.2, 3.3, 4.4, 5.5};
- for (auto d : data) {
- column->insert_data(reinterpret_cast<const char*>(&d), sizeof(d));
- }
-
- std::vector<double> res = {1.1, 2.2, 5.5};
- for (auto d : res) {
- column_res->insert_data(reinterpret_cast<const char*>(&d), sizeof(d));
- }
- column->erase(2, 2);
- EXPECT_EQ(column->size(), 3);
- for (int i = 0; i < column->size(); ++i) {
- EXPECT_EQ(column->get_data_at(i), column_res->get_data_at(i));
- }
-}
-
} // namespace doris
diff --git a/be/test/core/column/column_map_test.cpp
b/be/test/core/column/column_map_test.cpp
index 9e47be872aa..5d9dec2cefe 100644
--- a/be/test/core/column/column_map_test.cpp
+++ b/be/test/core/column/column_map_test.cpp
@@ -50,174 +50,4 @@ protected:
void TearDown() override {}
};
-TEST_F(ColumnMapTest, MapTypeTesterase) {
- DataTypePtr key_type =
std::make_shared<DataTypeNullable>(std::make_shared<DataTypeString>());
- DataTypePtr value_type =
std::make_shared<DataTypeNullable>(std::make_shared<DataTypeInt64>());
- DataTypePtr map_type = std::make_shared<DataTypeMap>(key_type, value_type);
- auto column = map_type->create_column();
- auto* column_map = assert_cast<ColumnMap*>(column.get());
- auto column_res = column_map->clone_empty();
- auto& column_offsets = column_map->get_offsets_column();
- auto& column_data_key = column_map->get_keys();
- auto& column_data_value = column_map->get_values();
-
- std::vector<StringRef> k1 = {StringRef("kasd"), StringRef("k1234567"),
StringRef("k3"),
- StringRef("k4"), StringRef("k5")};
- std::vector<int64_t> v1 = {1, 2, 3, 4, 5};
- std::vector<String> k2 = {"k11", "k22"};
- std::vector<int64_t> v2 = {33, 44};
- std::vector<String> k4 = {"k66"};
- std::vector<int64_t> v4 = {66};
- std::vector<UInt64> offset = {5, 7, 8, 9};
- for (auto d : k1) {
- column_data_key.insert_data(d.data, d.size);
- }
- for (auto d : v1) {
- column_data_value.insert_data(reinterpret_cast<const char*>(&d),
sizeof(d));
- }
- for (auto d : k2) {
- column_data_key.insert_data(d.data(), d.size());
- }
- for (auto d : v2) {
- column_data_value.insert_data(reinterpret_cast<const char*>(&d),
sizeof(d));
- }
- column_data_key.insert_default();
- column_data_value.insert_default();
- for (auto d : k4) {
- column_data_key.insert_data(d.data(), d.size());
- }
- for (auto d : v4) {
- column_data_value.insert_data(reinterpret_cast<const char*>(&d),
sizeof(d));
- }
- for (auto d : offset) {
- column_offsets.insert_data(reinterpret_cast<const char*>(&d),
sizeof(d));
- }
- column_res->insert_range_from(*column_map, 0, offset.size());
- column_map->erase(0, 2);
-
- // Block tmp;
- // tmp.insert({std::move(column), map_type, "asd"});
- // std::cout << tmp.dump_data(0, tmp.rows());
- // Block tmp2;
- // tmp2.insert({std::move(column_res), map_type, "asd2"});
- // std::cout << tmp2.dump_data(0, tmp2.rows());
-
- EXPECT_EQ(column_map->size(), 2);
- auto* column_result = assert_cast<ColumnMap*>(column_res.get());
- auto& column_offsets_res = column_result->get_offsets_column();
- auto& offset_data_res = column_offsets_res;
- auto& offset_data = column_offsets;
-
- auto& column_data_res = assert_cast<ColumnInt64&>(
-
assert_cast<ColumnNullable&>(assert_cast<ColumnMap&>(*column_res).get_values())
- .get_nested_column());
- auto& column_data_origin = assert_cast<ColumnInt64&>(
-
assert_cast<ColumnNullable&>(column_data_value).get_nested_column());
-
- auto& column_data_res_key = assert_cast<ColumnString&>(
-
assert_cast<ColumnNullable&>(assert_cast<ColumnMap&>(*column_res).get_keys())
- .get_nested_column());
- auto& column_data_origin_key = assert_cast<ColumnString&>(
- assert_cast<ColumnNullable&>(column_data_key).get_nested_column());
-
- for (int i = 0; i < column_map->size(); ++i) {
- std::cout << map_type->to_string(*column_map, i) << std::endl;
- std::cout << map_type->to_string(*column_res, i + 2) << std::endl;
- EXPECT_EQ(column_data_origin.get_element(i),
column_data_res.get_element(i + 7));
- EXPECT_EQ(column_data_origin_key.get_data_at(i),
column_data_res_key.get_data_at(i + 7));
- EXPECT_EQ(offset_data.get_element(i), offset_data_res.get_element(i +
2) - 7);
- }
-}
-
-TEST_F(ColumnMapTest, MapTypeTest2erase) {
- DataTypePtr key_type =
std::make_shared<DataTypeNullable>(std::make_shared<DataTypeString>());
- DataTypePtr value_type =
std::make_shared<DataTypeNullable>(std::make_shared<DataTypeInt64>());
- DataTypePtr map_type = std::make_shared<DataTypeMap>(key_type, value_type);
- auto column = map_type->create_column();
- auto* column_map = assert_cast<ColumnMap*>(column.get());
- auto column_res = column_map->clone_empty();
- auto& column_offsets = column_map->get_offsets_column();
- auto& column_data_key = column_map->get_keys();
- auto& column_data_value = column_map->get_values();
-
- std::vector<StringRef> k1 = {StringRef("kasd"), StringRef("k1234567"),
StringRef("k3"),
- StringRef("k4"), StringRef("k5")};
- std::vector<int64_t> v1 = {1, 2, 3, 4, 5};
- std::vector<String> k2 = {"k11", "k22"};
- std::vector<int64_t> v2 = {33, 44};
- std::vector<String> k4 = {"k66"};
- std::vector<int64_t> v4 = {66};
- std::vector<String> k5 = {"k77", "k88", "k99"};
- std::vector<int64_t> v5 = {77, 88, 99};
- std::vector<UInt64> offset = {5, 7, 8, 9, 12};
- for (auto d : k1) {
- column_data_key.insert_data(d.data, d.size);
- }
- for (auto d : v1) {
- column_data_value.insert_data(reinterpret_cast<const char*>(&d),
sizeof(d));
- }
- for (auto d : k2) {
- column_data_key.insert_data(d.data(), d.size());
- }
- for (auto d : v2) {
- column_data_value.insert_data(reinterpret_cast<const char*>(&d),
sizeof(d));
- }
- column_data_key.insert_default();
- column_data_value.insert_default();
- for (auto d : k4) {
- column_data_key.insert_data(d.data(), d.size());
- }
- for (auto d : v4) {
- column_data_value.insert_data(reinterpret_cast<const char*>(&d),
sizeof(d));
- }
- for (auto d : k5) {
- column_data_key.insert_data(d.data(), d.size());
- }
- for (auto d : v5) {
- column_data_value.insert_data(reinterpret_cast<const char*>(&d),
sizeof(d));
- }
-
- for (auto d : offset) {
- column_offsets.insert_data(reinterpret_cast<const char*>(&d),
sizeof(d));
- }
-
- column_res->insert_from(*column_map, 0);
- column_res->insert_from(*column_map, 1);
- column_res->insert_from(*column_map, 4);
- column_map->erase(2, 2);
-
- // Block tmp;
- // tmp.insert({std::move(column), map_type, "asd"});
- // std::cout << tmp.dump_data(0, tmp.rows());
- // Block tmp2;
- // tmp2.insert({std::move(column_res), map_type, "asd2"});
- // std::cout << tmp2.dump_data(0, tmp2.rows());
-
- EXPECT_EQ(column_map->size(), 3);
- auto* column_result = assert_cast<ColumnMap*>(column_res.get());
- auto& column_offsets_res = column_result->get_offsets_column();
- auto& offset_data_res = column_offsets_res;
- auto& offset_data = column_offsets;
-
- auto& column_data_res = assert_cast<ColumnInt64&>(
-
assert_cast<ColumnNullable&>(assert_cast<ColumnMap&>(*column_res).get_values())
- .get_nested_column());
- auto& column_data_origin = assert_cast<ColumnInt64&>(
-
assert_cast<ColumnNullable&>(column_data_value).get_nested_column());
-
- auto& column_data_res_key = assert_cast<ColumnString&>(
-
assert_cast<ColumnNullable&>(assert_cast<ColumnMap&>(*column_res).get_keys())
- .get_nested_column());
- auto& column_data_origin_key = assert_cast<ColumnString&>(
- assert_cast<ColumnNullable&>(column_data_key).get_nested_column());
-
- for (int i = 0; i < column_map->size(); ++i) {
- std::cout << map_type->to_string(*column_map, i) << std::endl;
- std::cout << map_type->to_string(*column_res, i) << std::endl;
- EXPECT_EQ(column_data_origin.get_element(i),
column_data_res.get_element(i));
- EXPECT_EQ(column_data_origin_key.get_data_at(i),
column_data_res_key.get_data_at(i));
- EXPECT_EQ(offset_data.get_element(i), offset_data_res.get_element(i));
- }
-}
-
} // namespace doris
diff --git a/be/test/core/column/column_nullable_test.cpp
b/be/test/core/column/column_nullable_test.cpp
index 9f209dd9f2f..4031bb7b73c 100644
--- a/be/test/core/column/column_nullable_test.cpp
+++ b/be/test/core/column/column_nullable_test.cpp
@@ -408,91 +408,6 @@ TEST(ColumnNullableTest, append_data_by_selector) {
EXPECT_TRUE(ColumnHelper::column_equal(std::move(dst_column),
expected_column));
}
-TEST(ColumnNullableTest, ScalaTypeNullInt32Testerase) {
- auto datetype_int32 =
std::make_shared<DataTypeNullable>(std::make_shared<DataTypeInt32>());
- auto column = datetype_int32->create_column();
- auto column_res = datetype_int32->create_column();
- std::vector<int32_t> data = {1, 2, 3, 4, 5};
- for (auto d : data) {
- column->insert_data(reinterpret_cast<const char*>(&d), sizeof(d));
- }
- column_res->insert_range_from(*column, 0, data.size());
- column->erase(0, 2);
- EXPECT_EQ(column->size(), 3);
-
- for (int i = 0; i < column->size(); ++i) {
- EXPECT_EQ(column->get_data_at(i), column_res->get_data_at(i + 2));
- }
-}
-
-TEST(ColumnNullableTest, ScalaTypeNullInt32Test2erase) {
- auto datetype_int32 =
std::make_shared<DataTypeNullable>(std::make_shared<DataTypeInt32>());
- auto column = datetype_int32->create_column();
- auto column_res = datetype_int32->create_column();
- std::vector<int32_t> data = {1, 2, 3, 4, 5};
- std::vector<int32_t> res = {1, 2, 5};
- for (auto d : data) {
- column->insert_data(reinterpret_cast<const char*>(&d), sizeof(d));
- }
- for (auto d : res) {
- column_res->insert_data(reinterpret_cast<const char*>(&d), sizeof(d));
- }
- column->erase(2, 2);
- EXPECT_EQ(column->size(), 3);
-
- for (int i = 0; i < column->size(); ++i) {
- EXPECT_EQ(column->get_data_at(i), column_res->get_data_at(i));
- }
-}
-
-TEST(ColumnNullableTest, ScalaTypeNullStringTesterase) {
- auto datetype_string =
std::make_shared<DataTypeNullable>(std::make_shared<DataTypeString>());
- auto column = datetype_string->create_column();
- auto column_res = datetype_string->create_column();
- std::vector<StringRef> data = {StringRef("asd"), StringRef("1234567"),
StringRef("3"),
- StringRef("4"), StringRef("5")};
- column->insert_default();
- for (auto d : data) {
- column->insert_data(d.data, d.size);
- }
- column->insert_default();
- column_res->insert_range_from(*column, 0, data.size() + 2);
- column->erase(0, 2);
- EXPECT_EQ(column->size(), 5);
- for (int i = 0; i < column->size(); ++i) {
- std::cout << column->get_data_at(i).to_string() << std::endl;
- EXPECT_EQ(column->get_data_at(i).to_string(),
column_res->get_data_at(i + 2).to_string());
- }
-}
-
-TEST(ColumnNullableTest, ScalaTypeNullStringTest2erase) {
- auto datetype_string =
std::make_shared<DataTypeNullable>(std::make_shared<DataTypeString>());
- auto column = datetype_string->create_column();
- auto column_res = datetype_string->create_column();
- std::vector<StringRef> data = {StringRef("asd"), StringRef("1234567"),
StringRef("3"),
- StringRef("4"), StringRef("5")};
- std::vector<StringRef> res = {StringRef("asd"), StringRef("4"),
StringRef("5")};
- column->insert_default();
- for (auto d : data) {
- column->insert_data(d.data, d.size);
- }
- column->insert_default();
-
- column_res->insert_default();
- for (auto d : res) {
- column_res->insert_data(d.data, d.size);
- }
- column_res->insert_default();
-
- column->erase(2, 2);
- EXPECT_EQ(column->size(), 5);
- for (int i = 0; i < column->size(); ++i) {
- std::cout << column->get_data_at(i).to_string() << " , "
- << column_res->get_data_at(i).to_string() << std::endl;
- // EXPECT_EQ(column->get_data_at(i).to_string(),
column_res->get_data_at(i).to_string());
- }
-}
-
// The null bits come back offset to row_pos, so a batch reads its own rows'
flags from
// index 0; a column that is not Nullable has none.
TEST(ColumnNullableTest, PeelNullableOffsetsTheNullBitsToTheBatch) {
diff --git a/be/test/core/column/column_string_test.cpp
b/be/test/core/column/column_string_test.cpp
index 08ac03dcd99..a3b805f90a7 100644
--- a/be/test/core/column/column_string_test.cpp
+++ b/be/test/core/column/column_string_test.cpp
@@ -1350,64 +1350,6 @@ TEST_F(ColumnStringTest, sort_column) {
column_string_common_test(assert_sort_column_callback, false);
}
-TEST_F(ColumnStringTest, ScalaTypeStringTesterase) {
- auto column = ColumnString::create();
- std::vector<StringRef> data = {StringRef("asd"), StringRef("1234567"),
StringRef("3"),
- StringRef("4"), StringRef("5")};
- for (auto d : data) {
- column->insert_data(d.data, d.size);
- }
- column->erase(0, 2);
- EXPECT_EQ(column->size(), 3);
- for (int i = 0; i < column->size(); ++i) {
- std::cout << column->get_data_at(i).to_string() << std::endl;
- EXPECT_EQ(column->get_data_at(i).to_string(), data[i + 2].to_string());
- }
-
- auto column2 = ColumnString::create();
- std::vector<StringRef> data2 = {StringRef(""), StringRef("1234567"),
StringRef("asd"),
- StringRef("4"), StringRef("5")};
- for (auto d : data2) {
- column2->insert_data(d.data, d.size);
- }
- column2->erase(0, 2);
- EXPECT_EQ(column2->size(), 3);
- for (int i = 0; i < column2->size(); ++i) {
- std::cout << column2->get_data_at(i).to_string() << std::endl;
- EXPECT_EQ(column2->get_data_at(i).to_string(), data2[i +
2].to_string());
- }
-}
-
-TEST_F(ColumnStringTest, ScalaTypeStringTest2erase) {
- auto column = ColumnString::create();
- std::vector<StringRef> data = {StringRef("asd"), StringRef("1234567"),
StringRef("3"),
- StringRef("4"), StringRef("5")};
- std::vector<StringRef> res = {StringRef("asd"), StringRef("1234567"),
StringRef("5")};
- for (auto d : data) {
- column->insert_data(d.data, d.size);
- }
- column->erase(2, 2);
- EXPECT_EQ(column->size(), 3);
- for (int i = 0; i < column->size(); ++i) {
- std::cout << column->get_data_at(i).to_string() << std::endl;
- EXPECT_EQ(column->get_data_at(i).to_string(), res[i].to_string());
- }
-
- auto column2 = ColumnString::create();
- std::vector<StringRef> data2 = {StringRef(""), StringRef("1234567"),
StringRef("asd"),
- StringRef("4"), StringRef("5")};
- std::vector<StringRef> res2 = {StringRef(""), StringRef("1234567"),
StringRef("5")};
- for (auto d : data2) {
- column2->insert_data(d.data, d.size);
- }
- column2->erase(2, 2);
- EXPECT_EQ(column2->size(), 3);
- for (int i = 0; i < column2->size(); ++i) {
- std::cout << column2->get_data_at(i).to_string() << std::endl;
- EXPECT_EQ(column2->get_data_at(i).to_string(), res2[i].to_string());
- }
-}
-
TEST_F(ColumnStringTest, is_ascii) {
{
auto column = ColumnString::create();
diff --git a/be/test/core/column/column_struct_test.cpp
b/be/test/core/column/column_struct_test.cpp
index 49994ef7cc6..07770d8910f 100644
--- a/be/test/core/column/column_struct_test.cpp
+++ b/be/test/core/column/column_struct_test.cpp
@@ -320,67 +320,4 @@ TEST_F(ColumnStructTest,
RangeHashWithAllZeroMaskMatchesUnmasked) {
}
}
-TEST_F(ColumnStructTest, StructTypeTesterase) {
- DataTypePtr key_type = (std::make_shared<DataTypeString>());
- DataTypePtr value_type = (std::make_shared<DataTypeInt32>());
- DataTypePtr struct_type = std::make_shared<DataTypeStruct>(DataTypes
{key_type, value_type});
- auto column = struct_type->create_column();
- auto* column_struct = assert_cast<ColumnStruct*>(column.get());
- auto column_res = column_struct->clone_empty();
- auto& column_string =
assert_cast<ColumnString&>(column_struct->get_column(0));
- auto& column_int = assert_cast<ColumnInt32&>(column_struct->get_column(1));
-
- std::vector<String> data_string = {"asd", "1234567", "3", "4", "5"};
- std::vector<int32_t> data_int = {1, 2, 3, 4, 5};
-
- for (auto d : data_string) {
- column_string.insert_data(d.data(), d.size());
- }
- for (auto d : data_int) {
- column_int.insert_data(reinterpret_cast<const char*>(&d), sizeof(d));
- }
- // Block tmp;
- // tmp.insert({std::move(column), struct_type, "asd"});
- // std::cout << tmp.dump_data(0, tmp.rows());
-
- column_struct->erase(0, 2);
- EXPECT_EQ(column_struct->size(), 3);
- for (int i = 0; i < column_struct->size(); ++i) {
- EXPECT_EQ(column_string.get_data_at(i).to_string(), data_string[i +
2]);
- EXPECT_EQ(column_int.get_element(i), data_int[i + 2]);
- }
-}
-
-TEST_F(ColumnStructTest, StructTypeTest2erase) {
- DataTypePtr key_type = (std::make_shared<DataTypeString>());
- DataTypePtr value_type = (std::make_shared<DataTypeInt32>());
- DataTypePtr struct_type = std::make_shared<DataTypeStruct>(DataTypes
{key_type, value_type});
- auto column = struct_type->create_column();
- auto* column_struct = assert_cast<ColumnStruct*>(column.get());
- auto& column_string =
assert_cast<ColumnString&>(column_struct->get_column(0));
- auto& column_int = assert_cast<ColumnInt32&>(column_struct->get_column(1));
-
- std::vector<String> data_string = {"asd", "1234567", "3", "4", "5"};
- std::vector<int32_t> data_int = {1, 2, 3, 4, 5};
-
- std::vector<String> data_string_res = {"asd", "1234567", "5"};
- std::vector<int32_t> data_int_res = {1, 2, 5};
-
- for (auto d : data_string) {
- column_string.insert_data(d.data(), d.size());
- }
- for (auto d : data_int) {
- column_int.insert_data(reinterpret_cast<const char*>(&d), sizeof(d));
- }
- // Block tmp;
- // tmp.insert({std::move(column), struct_type, "asd"});
- // std::cout << tmp.dump_data(0, tmp.rows());
-
- column_struct->erase(2, 2);
- EXPECT_EQ(column_struct->size(), 3);
- for (int i = 0; i < column_struct->size(); ++i) {
- EXPECT_EQ(column_string.get_data_at(i).to_string(),
data_string_res[i]);
- EXPECT_EQ(column_int.get_element(i), data_int_res[i]);
- }
-}
} // namespace doris
diff --git a/be/test/core/column/column_variant_v2_test.cpp
b/be/test/core/column/column_variant_v2_test.cpp
index 17e9b8c4184..74818de63ed 100644
--- a/be/test/core/column/column_variant_v2_test.cpp
+++ b/be/test/core/column/column_variant_v2_test.cpp
@@ -1843,47 +1843,6 @@ TEST(ColumnVariantV2Test,
CompositeShreddedSizeDoesNotRecountSegments) {
EXPECT_EQ(*size_calls, 0);
}
-TEST(ColumnVariantV2Test, EraseRemovesRowsInEveryState) {
- // Encoded rows with two metadata dictionaries: the ids of the remaining
rows stay valid.
- auto encoded = ColumnVariantV2::create();
- for (const char* json : {R"({"a":1})", "2", R"({"b":3})", "4",
R"("five")"}) {
- insert_encoded_field(*encoded, encode_json(json));
- }
- encoded->erase(0, 2);
- ASSERT_EQ(encoded->size(), 3);
- EXPECT_EQ(json_at(*encoded, 0), R"({"b":3})");
- EXPECT_EQ(json_at(*encoded, 2), R"("five")");
- encoded->erase(1, 1);
- ASSERT_EQ(encoded->size(), 2);
- EXPECT_EQ(json_at(*encoded, 1), R"("five")");
- encoded->erase(2, 0);
- EXPECT_EQ(encoded->size(), 2);
- validate_encoded_column(*encoded);
-
- constexpr std::array<int32_t, 4> VALUES {7, 8, 9, 10};
- constexpr std::array<uint8_t, 4> NULLS {0, 1, 0, 0};
- auto typed = typed_int32(VALUES, NULLS);
- typed->erase(0, 2);
- EXPECT_TRUE(typed->is_typed());
- constexpr std::array<int32_t, 2> REMAINING {9, 10};
- constexpr std::array<uint8_t, 2> REMAINING_NULLS {0, 0};
- expect_int32_rows(*typed, REMAINING, REMAINING_NULLS);
-
- auto rows = ColumnVariantV2::create();
- for (const char* json : {"1", "2", "3"}) {
- insert_encoded_field(*rows, encode_json(json));
- }
- auto calls = std::make_shared<size_t>(0);
- auto shredded = ColumnVariantV2::create_shredded(
- std::make_shared<MaterializingShreddedState>(rows->get_ptr(),
calls));
- shredded->erase(0, 1);
- EXPECT_FALSE(shredded->is_shredded());
- ASSERT_EQ(shredded->size(), 2);
- EXPECT_EQ(json_at(*shredded, 0), "2");
- EXPECT_EQ(json_at(*shredded, 1), "3");
- EXPECT_EQ(rows->size(), 3);
-}
-
TEST(ColumnVariantV2Test, CompositeValidatesSegmentsAfterFirstTypedMiss) {
auto first_calls = std::make_shared<size_t>(0);
auto second_calls = std::make_shared<size_t>(0);
@@ -2970,8 +2929,6 @@ TEST(ColumnVariantV2Test,
TypedMutatorsDetachSharedNestedColumn) {
constexpr std::array<uint8_t, 2> FIRST_TWO_NULLS {};
exercise([](ColumnVariantV2& column) { column.pop_back(1); }, FIRST_TWO,
FIRST_TWO_NULLS);
exercise([](ColumnVariantV2& column) { column.resize(2); }, FIRST_TWO,
FIRST_TWO_NULLS);
- constexpr std::array<int32_t, 2> LAST_TWO {2, 3};
- exercise([](ColumnVariantV2& column) { column.erase(0, 1); }, LAST_TWO,
FIRST_TWO_NULLS);
constexpr std::array<int32_t, 2> FILTERED {1, 3};
constexpr std::array<uint8_t, 2> FILTERED_NULLS {};
exercise(
diff --git a/be/test/core/column/column_vector_test.cpp
b/be/test/core/column/column_vector_test.cpp
index 0552a7e7271..dac36da62ec 100644
--- a/be/test/core/column/column_vector_test.cpp
+++ b/be/test/core/column/column_vector_test.cpp
@@ -492,58 +492,4 @@ TEST_F(ColumnVectorTest, sort_column) {
_column_vector_common_test(assert_sort_column_callback);
}
-TEST_F(ColumnVectorTest, ScalaTypeUInt8Testerase) {
- auto column = ColumnUInt8::create();
- std::vector<Int8> data = {1, 2, 3, 4, 5};
- for (auto d : data) {
- column->insert_data(reinterpret_cast<const char*>(&d), sizeof(d));
- }
- column->erase(0, 2);
- EXPECT_EQ(column->size(), 3);
- for (int i = 0; i < column->size(); ++i) {
- EXPECT_EQ(column->get_int(i), data[i + 2]);
- }
-}
-
-TEST_F(ColumnVectorTest, ScalaTypeUInt8Test2erase) {
- auto column = ColumnUInt8::create();
- std::vector<Int8> data = {1, 2, 3, 4, 5};
- for (auto d : data) {
- column->insert_data(reinterpret_cast<const char*>(&d), sizeof(d));
- }
- column->erase(2, 2);
- EXPECT_EQ(column->size(), 3);
- std::vector<Int8> data2 = {1, 2, 5};
- for (int i = 0; i < column->size(); ++i) {
- EXPECT_EQ(column->get_int(i), data2[i]);
- }
-}
-
-TEST_F(ColumnVectorTest, ScalaTypeInt32Testerase) {
- auto column = ColumnInt32::create();
- std::vector<int32_t> data = {1, 2, 3, 4, 5};
- for (auto d : data) {
- column->insert_data(reinterpret_cast<const char*>(&d), sizeof(d));
- }
- column->erase(0, 2);
- EXPECT_EQ(column->size(), 3);
- for (int i = 0; i < column->size(); ++i) {
- EXPECT_EQ(column->get_int(i), data[i + 2]);
- }
-}
-
-TEST_F(ColumnVectorTest, ScalaTypeInt32Test2erase) {
- auto column = ColumnInt32::create();
- std::vector<int32_t> data = {1, 2, 3, 4, 5};
- for (auto d : data) {
- column->insert_data(reinterpret_cast<const char*>(&d), sizeof(d));
- }
- column->erase(2, 2);
- EXPECT_EQ(column->size(), 3);
- std::vector<int32_t> data2 = {1, 2, 5};
- for (int i = 0; i < column->size(); ++i) {
- EXPECT_EQ(column->get_int(i), data2[i]);
- }
-}
-
} // namespace doris
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]