Skip to content

Commit 195ad4c

Browse files
marisingmorningman-cmy
authored andcommitted
[Bug]fix the crash of checksum task apache#3735 (apache#3738)
1. the table include key column of double/float type 2. when run checksum task, will use all of key columns to compare 3. schema.column(idx) of double/float type is NULL apache#3735
1 parent 06c6f1f commit 195ad4c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

be/src/olap/row.h

+6
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,12 @@ void agg_finalize_row(const std::vector<uint32_t>& ids, RowType* row, MemPool* m
187187
template<typename RowType>
188188
uint32_t hash_row(const RowType& row, uint32_t seed) {
189189
for (uint32_t cid : row.schema()->column_ids()) {
190+
FieldType type = row.schema()->column(cid)->type();
191+
// The approximation of float/double in a certain precision range, the binary of byte is not
192+
// a fixed value, so these two types are ignored in calculating hash code.
193+
if (type == OLAP_FIELD_TYPE_FLOAT || type == OLAP_FIELD_TYPE_DOUBLE) {
194+
continue;
195+
}
190196
seed = row.schema()->column(cid)->hash_code(row.cell(cid), seed);
191197
}
192198
return seed;

be/src/olap/task/engine_checksum_task.cpp

+2-8
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,7 @@ OLAPStatus EngineChecksumTask::_compute_checksum() {
8080
}
8181
}
8282

83-
// ignore float and double type considering to precision lose
8483
for (size_t i = 0; i < tablet->tablet_schema().num_columns(); ++i) {
85-
FieldType type = tablet->tablet_schema().column(i).type();
86-
if (type == OLAP_FIELD_TYPE_FLOAT || type == OLAP_FIELD_TYPE_DOUBLE) {
87-
continue;
88-
}
89-
9084
reader_params.return_columns.push_back(i);
9185
}
9286

@@ -118,8 +112,8 @@ OLAPStatus EngineChecksumTask::_compute_checksum() {
118112
OLAP_LOG_WARNING("fail to read in reader. [res=%d]", res);
119113
return res;
120114
}
121-
122-
row_checksum = hash_row(row, row_checksum);
115+
// The value of checksum is independent of the sorting of data rows.
116+
row_checksum ^= hash_row(row, 0);
123117
// the memory allocate by mem pool has been copied,
124118
// so we should release memory immediately
125119
mem_pool->clear();

0 commit comments

Comments
 (0)