Skip to content

Commit

Permalink
[ut](columns) Add be ut for ColumnDecimal, ColumnVector
Browse files Browse the repository at this point in the history
  • Loading branch information
jacktengg committed Feb 23, 2025
1 parent 9f42075 commit d445a02
Show file tree
Hide file tree
Showing 85 changed files with 6,590 additions and 137 deletions.
2 changes: 0 additions & 2 deletions be/src/vec/columns/column.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,6 @@ class IColumn : public COW<IColumn> {
}

/// Appends one element from other column with the same type multiple times.
/// we should make sure position is less than src's size and length is less than src's size,
/// and position + length is less than src's size
virtual void insert_many_from(const IColumn& src, size_t position, size_t length) {
for (size_t i = 0; i < length; ++i) {
insert_from(src, position);
Expand Down
3 changes: 1 addition & 2 deletions be/src/vec/columns/column_decimal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,7 @@ void ColumnDecimal<T>::compare_internal(size_t rhs_row_id, const IColumn& rhs,
size_t end = simd::find_one(cmp_res, begin + 1);
for (size_t row_id = begin; row_id < end; row_id++) {
auto value_a = get_data()[row_id];
int res = 0;
res = value_a > cmp_base ? 1 : (value_a < cmp_base ? -1 : 0);
int res = value_a > cmp_base ? 1 : (value_a < cmp_base ? -1 : 0);
if (res * direction < 0) {
filter[row_id] = 1;
cmp_res[row_id] = 1;
Expand Down
79 changes: 0 additions & 79 deletions be/src/vec/columns/column_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -450,85 +450,6 @@ class ColumnObject final : public COWHelper<IColumn, ColumnObject> {
void update_crc_with_value(size_t start, size_t end, uint32_t& hash,
const uint8_t* __restrict null_data) const override;

Int64 get_int(size_t /*n*/) const override {
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, "get_int" + get_name());
}

bool get_bool(size_t /*n*/) const override {
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, "get_bool" + get_name());
}

void insert_many_fix_len_data(const char* pos, size_t num) override {
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
"insert_many_fix_len_data" + get_name());
}

void insert_many_dict_data(const int32_t* data_array, size_t start_index, const StringRef* dict,
size_t data_num, uint32_t dict_num = 0) override {
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
"insert_many_dict_data" + get_name());
}

void insert_many_continuous_binary_data(const char* data, const uint32_t* offsets,
const size_t num) override {
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
"insert_many_continuous_binary_data" + get_name());
}

void insert_many_strings(const StringRef* strings, size_t num) override {
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
"insert_many_strings" + get_name());
}

void insert_many_strings_overflow(const StringRef* strings, size_t num,
size_t max_length) override {
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
"insert_many_strings_overflow" + get_name());
}

void insert_many_raw_data(const char* pos, size_t num) override {
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
"insert_many_raw_data" + get_name());
}

size_t get_max_row_byte_size() const override {
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
"get_max_row_byte_size" + get_name());
}

void serialize_vec(std::vector<StringRef>& keys, size_t num_rows,
size_t max_row_byte_size) const override {
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, "serialize_vec" + get_name());
}

void serialize_vec_with_null_map(std::vector<StringRef>& keys, size_t num_rows,
const uint8_t* null_map) const override {
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
"serialize_vec_with_null_map" + get_name());
}

void deserialize_vec(std::vector<StringRef>& keys, const size_t num_rows) override {
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, "deserialize_vec" + get_name());
}

void deserialize_vec_with_null_map(std::vector<StringRef>& keys, const size_t num_rows,
const uint8_t* null_map) override {
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
"deserialize_vec_with_null_map" + get_name());
}

Status filter_by_selector(const uint16_t* sel, size_t sel_size, IColumn* col_ptr) const {
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, "filter_by_selector" + get_name());
}

bool structure_equals(const IColumn&) const override {
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, "structure_equals" + get_name());
}

StringRef get_raw_data() const override {
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, "get_raw_data" + get_name());
}

StringRef get_data_at(size_t) const override {
throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, "get_data_at" + get_name());
}
Expand Down
1 change: 0 additions & 1 deletion be/src/vec/columns/columns_number.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ using ColumnUInt8 = ColumnVector<UInt8>;
using ColumnUInt16 = ColumnVector<UInt16>;
using ColumnUInt32 = ColumnVector<UInt32>;
using ColumnUInt64 = ColumnVector<UInt64>;
using ColumnUInt128 = ColumnVector<UInt128>;

using ColumnInt8 = ColumnVector<Int8>;
using ColumnInt16 = ColumnVector<Int16>;
Expand Down
2 changes: 1 addition & 1 deletion be/src/vec/data_types/serde/data_type_decimal_serde.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Status DataTypeDecimalSerDe<T>::deserialize_one_cell_from_json(IColumn& column,
return Status::OK();
}
return Status::InvalidArgument("parse decimal fail, string: '{}', primitive type: '{}'",
std::string(rb.position(), rb.count()).c_str(),
std::string(slice.data, slice.size).c_str(),
get_primitive_type());
}

Expand Down
2 changes: 1 addition & 1 deletion be/test/agent/heartbeat_server_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ using std::vector;
namespace doris {

TEST(HeartbeatTest, TestHeartbeat) {
setenv("DORIS_HOME", "./", 1);
// setenv("DORIS_HOME", "./", 1);
THeartbeatResult heartbeat_result;
ClusterInfo ori_cluster_info;
ori_cluster_info.cluster_id = -1;
Expand Down
26 changes: 26 additions & 0 deletions be/test/data/vec/columns/BIGINT.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
-1
0
1
2
3037000500
-9223372036854775808
9223372036854775807
1234567890123456789
4567891234567891234
7891234567891234567
3456789123456789123
6789123456789123456
2345678912345678912
5678912345678912345
8912345678912345678
1234567891234567890
-3873307664046405590
7446424211242738476
6637450474744415088
-4388843650233597359
306567258363819813
-7091032546583349460
1181091387208033590
-8309987765617131980
-6559491738043095171
NULL
19 changes: 19 additions & 0 deletions be/test/data/vec/columns/BIGINT_UNSIGNED.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
0
1
2
3037000500
9223372036854775807
1234567890123456789
4567891234567891234
7891234567891234567
3456789123456789123
6789123456789123456
2345678912345678912
5678912345678912345
8912345678912345678
1234567891234567890
7446424211242738476
6637450474744415088
306567258363819813
1181091387208033590
NULL
20 changes: 20 additions & 0 deletions be/test/data/vec/columns/DECIMALV3(1,0).csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
0
1
2
3
4
5
6
7
8
9
-1
-2
-3
-4
-5
-6
-7
-8
-9
NULL
20 changes: 20 additions & 0 deletions be/test/data/vec/columns/DECIMALV3(1,1).csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
-0.1
-0.2
-0.3
-0.4
-0.5
-0.6
-0.7
-0.8
-0.9
NULL
9 changes: 9 additions & 0 deletions be/test/data/vec/columns/DECIMALV3(10,5).csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
00000.00000
-00000.00000
98765.43210
0.00001
99999.99999
-98765.43210
-0.00001
-99999.99999
NULL
133 changes: 133 additions & 0 deletions be/test/data/vec/columns/DECIMALV3(18,0).csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
0
0.0
00.0
00.00
1
2
3
4
5
6
7
8
9
1.0
2.0
3.0
4.0
5.0
6.0
7.0
8.0
9.0
000000000000000000
000000000000000001
000000000000000005
000000000000000009
000000001000000000
000000005000000000
000000009000000000
000000001000000001
000000005000000005
000000009000000009
100000000000000000
100000000000000001
100000000000000005
100000000000000009
100000000000010000
100000000000050000
100000000000090000
100000000000010001
100000000000050005
100000000000090009
500000000000000000
500000000000000001
500000000000000005
500000000000000009
500000000000010000
500000000000050000
500000000000090000
500000000000010001
500000000000050005
500000000000090009
900000000000000000
900000000000000001
900000000000000005
900000000000000009
900000000000010000
900000000000050000
900000000000090000
900000000000010001
900000000000050005
900000000000090009
444444444444444444
499999999999999999
555555555555555555
999999999999999999
-0
-0.0
-00.0
-00.00
-1
-2
-3
-4
-5
-6
-7
-8
-9
-1.0
-2.0
-3.0
-4.0
-5.0
-6.0
-7.0
-8.0
-9.0
-000000000000000000
-000000000000000001
-000000000000000005
-000000000000000009
-000000001000000000
-000000005000000000
-000000009000000000
-000000001000000001
-000000005000000005
-000000009000000009
-100000000000000000
-100000000000000001
-100000000000000005
-100000000000000009
-100000000000010000
-100000000000050000
-100000000000090000
-100000000000010001
-100000000000050005
-100000000000090009
-500000000000000000
-500000000000000001
-500000000000000005
-500000000000000009
-500000000000010000
-500000000000050000
-500000000000090000
-500000000000010001
-500000000000050005
-500000000000090009
-900000000000000000
-900000000000000001
-900000000000000005
-900000000000000009
-900000000000010000
-900000000000050000
-900000000000090000
-900000000000010001
-900000000000050005
-900000000000090009
-444444444444444444
-499999999999999999
-555555555555555555
-999999999999999999
NULL
Loading

0 comments on commit d445a02

Please sign in to comment.