This is an automated email from the ASF dual-hosted git repository.
lihaopeng 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 d47b7170cf3 [Refactor](exec) Refactor some unreasonable code in exec
(#42678)
d47b7170cf3 is described below
commit d47b7170cf36e253b967b75cf449886250ee31c0
Author: HappenLee <[email protected]>
AuthorDate: Wed Oct 30 11:15:41 2024 +0800
[Refactor](exec) Refactor some unreasonable code in exec (#42678)
1. Add TODO comment in join
2. error comment change
3. auto pointer type
4. change copy to reference
---
be/src/pipeline/exec/hashjoin_build_sink.h | 3 ++-
be/src/pipeline/exec/hashjoin_probe_operator.cpp | 2 +-
be/src/vec/core/block.cpp | 4 ++--
be/src/vec/core/block.h | 2 +-
be/src/vec/sink/vrow_distribution.cpp | 4 ++--
be/src/vec/sink/vrow_distribution.h | 2 +-
.../nereids/rules/expression/rules/NullSafeEqualToEqualTest.java | 2 +-
7 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/be/src/pipeline/exec/hashjoin_build_sink.h
b/be/src/pipeline/exec/hashjoin_build_sink.h
index 83755d7f730..1d52feaccff 100644
--- a/be/src/pipeline/exec/hashjoin_build_sink.h
+++ b/be/src/pipeline/exec/hashjoin_build_sink.h
@@ -190,6 +190,7 @@ struct ProcessHashTableBuild {
bool* has_null_key) {
if (short_circuit_for_null || ignore_null) {
// first row is mocked and is null
+ // TODO: Need to test the for loop. break may better
for (uint32_t i = 1; i < _rows; i++) {
if ((*null_map)[i]) {
*has_null_key = true;
@@ -228,4 +229,4 @@ private:
};
} // namespace doris::pipeline
-#include "common/compile_check_end.h"
\ No newline at end of file
+#include "common/compile_check_end.h"
diff --git a/be/src/pipeline/exec/hashjoin_probe_operator.cpp
b/be/src/pipeline/exec/hashjoin_probe_operator.cpp
index bb869ee3257..a9d3c962b76 100644
--- a/be/src/pipeline/exec/hashjoin_probe_operator.cpp
+++ b/be/src/pipeline/exec/hashjoin_probe_operator.cpp
@@ -155,7 +155,7 @@ bool
HashJoinProbeLocalState::_need_probe_null_map(vectorized::Block& block,
const std::vector<int>&
res_col_ids) {
for (size_t i = 0; i < _probe_expr_ctxs.size(); ++i) {
if (!_shared_state->is_null_safe_eq_join[i]) {
- auto column = block.get_by_position(res_col_ids[i]).column.get();
+ const auto* column =
block.get_by_position(res_col_ids[i]).column.get();
if (check_and_get_column<vectorized::ColumnNullable>(*column)) {
return true;
}
diff --git a/be/src/vec/core/block.cpp b/be/src/vec/core/block.cpp
index 2eb06e3c6a5..11075335fb1 100644
--- a/be/src/vec/core/block.cpp
+++ b/be/src/vec/core/block.cpp
@@ -1083,7 +1083,7 @@ Status MutableBlock::add_rows(const Block* block, size_t
row_begin, size_t lengt
return Status::OK();
}
-Status MutableBlock::add_rows(const Block* block, std::vector<int64_t> rows) {
+Status MutableBlock::add_rows(const Block* block, const std::vector<int64_t>&
rows) {
RETURN_IF_CATCH_EXCEPTION({
DCHECK_LE(columns(), block->columns());
const auto& block_data = block->get_columns_with_type_and_name();
@@ -1093,7 +1093,7 @@ Status MutableBlock::add_rows(const Block* block,
std::vector<int64_t> rows) {
auto& dst = _columns[i];
const auto& src = *block_data[i].column.get();
dst->reserve(dst->size() + length);
- for (size_t row : rows) {
+ for (auto row : rows) {
// we can introduce a new function like
`insert_assume_reserved` for IColumn.
dst->insert_from(src, row);
}
diff --git a/be/src/vec/core/block.h b/be/src/vec/core/block.h
index bbcdd9472ae..d1af45e1297 100644
--- a/be/src/vec/core/block.h
+++ b/be/src/vec/core/block.h
@@ -624,7 +624,7 @@ public:
Status add_rows(const Block* block, const uint32_t* row_begin, const
uint32_t* row_end,
const std::vector<int>* column_offset = nullptr);
Status add_rows(const Block* block, size_t row_begin, size_t length);
- Status add_rows(const Block* block, std::vector<int64_t> rows);
+ Status add_rows(const Block* block, const std::vector<int64_t>& rows);
/// remove the column with the specified name
void erase(const String& name);
diff --git a/be/src/vec/sink/vrow_distribution.cpp
b/be/src/vec/sink/vrow_distribution.cpp
index 74a2830a191..b79df49f062 100644
--- a/be/src/vec/sink/vrow_distribution.cpp
+++ b/be/src/vec/sink/vrow_distribution.cpp
@@ -50,7 +50,7 @@ VRowDistribution::_get_partition_function() {
Status VRowDistribution::_save_missing_values(
std::vector<std::vector<std::string>>& col_strs, // non-const ref for
move
- int col_size, Block* block, std::vector<int64_t> filter,
+ int col_size, Block* block, const std::vector<int64_t>& filter,
const std::vector<const NullMap*>& col_null_maps) {
// de-duplication for new partitions but save all rows.
RETURN_IF_ERROR(_batching_block->add_rows(block, filter));
@@ -366,7 +366,7 @@ Status
VRowDistribution::_generate_rows_distribution_for_auto_partition(
auto num_rows = block->rows();
std::vector<uint16_t> partition_keys = _vpartition->get_partition_keys();
- auto partition_col = block->get_by_position(partition_keys[0]);
+ auto& partition_col = block->get_by_position(partition_keys[0]);
_missing_map.clear();
_missing_map.reserve(partition_col.column->size());
bool stop_processing = false;
diff --git a/be/src/vec/sink/vrow_distribution.h
b/be/src/vec/sink/vrow_distribution.h
index 248982c0202..88002c3c211 100644
--- a/be/src/vec/sink/vrow_distribution.h
+++ b/be/src/vec/sink/vrow_distribution.h
@@ -143,7 +143,7 @@ private:
std::pair<vectorized::VExprContextSPtrs, vectorized::VExprSPtrs>
_get_partition_function();
Status _save_missing_values(std::vector<std::vector<std::string>>&
col_strs, int col_size,
- Block* block, std::vector<int64_t> filter,
+ Block* block, const std::vector<int64_t>&
filter,
const std::vector<const NullMap*>&
col_null_maps);
void _get_tablet_ids(vectorized::Block* block, int32_t index_idx,
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/NullSafeEqualToEqualTest.java
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/NullSafeEqualToEqualTest.java
index 8da25e92e7e..d4adc821880 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/NullSafeEqualToEqualTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/NullSafeEqualToEqualTest.java
@@ -54,7 +54,7 @@ class NullSafeEqualToEqualTest extends
ExpressionRewriteTestHelper {
assertRewrite(new NullSafeEqual(new IntegerLiteral(0),
NullLiteral.INSTANCE), BooleanLiteral.FALSE);
}
- // "NULL <=> Null" to false
+ // "NULL <=> Null" to true
@Test
void testNullSafeEqualToTrue() {
executor = new ExpressionRuleExecutor(ImmutableList.of(
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]