github-actions[bot] commented on code in PR #34134:
URL: https://github.com/apache/doris/pull/34134#discussion_r1582088680
##########
be/src/vec/exec/scan/vscan_node.cpp:
##########
@@ -1079,11 +1066,60 @@
}
template <PrimitiveType T>
-Status VScanNode::_normalize_match_in_compound_predicate(vectorized::VExpr*
expr,
- VExprContext*
expr_ctx,
- SlotDescriptor* slot,
- ColumnValueRange<T>&
range,
- PushDownType* pdt) {
+Status
VScanNode::_normalize_in_and_not_in_compound_predicate(vectorized::VExpr* expr,
+ VExprContext*
expr_ctx,
+ SlotDescriptor*
slot,
+
ColumnValueRange<T>& range,
+ PushDownType*
pdt) {
+ if (TExprNodeType::IN_PRED == expr->node_type()) {
+ std::string fn_name =
+ expr->op() == TExprOpcode::type::FILTER_IN ? "in_list" :
"not_in_list";
+
+ HybridSetBase::IteratorBase* iter = nullptr;
+ auto hybrid_set = expr->get_set_func();
+
+ if (hybrid_set != nullptr) {
+ if (hybrid_set->size() <= _max_pushdown_conditions_per_column) {
+ iter = hybrid_set->begin();
+ } else {
+ _filter_predicates.in_filters.emplace_back(slot->col_name(),
expr->get_set_func());
+ *pdt = PushDownType::ACCEPTABLE;
+ return Status::OK();
+ }
+ } else {
+ VInPredicate* pred = static_cast<VInPredicate*>(expr);
+
+ InState* state = reinterpret_cast<InState*>(
Review Comment:
warning: use auto when initializing with a cast to avoid duplicating the
type name [modernize-use-auto]
```suggestion
auto* state = reinterpret_cast<InState*>(
```
##########
be/src/vec/exec/scan/vscan_node.cpp:
##########
@@ -1079,11 +1066,60 @@
}
template <PrimitiveType T>
-Status VScanNode::_normalize_match_in_compound_predicate(vectorized::VExpr*
expr,
- VExprContext*
expr_ctx,
- SlotDescriptor* slot,
- ColumnValueRange<T>&
range,
- PushDownType* pdt) {
+Status
VScanNode::_normalize_in_and_not_in_compound_predicate(vectorized::VExpr* expr,
+ VExprContext*
expr_ctx,
+ SlotDescriptor*
slot,
+
ColumnValueRange<T>& range,
+ PushDownType*
pdt) {
+ if (TExprNodeType::IN_PRED == expr->node_type()) {
+ std::string fn_name =
+ expr->op() == TExprOpcode::type::FILTER_IN ? "in_list" :
"not_in_list";
+
+ HybridSetBase::IteratorBase* iter = nullptr;
+ auto hybrid_set = expr->get_set_func();
+
+ if (hybrid_set != nullptr) {
+ if (hybrid_set->size() <= _max_pushdown_conditions_per_column) {
+ iter = hybrid_set->begin();
+ } else {
+ _filter_predicates.in_filters.emplace_back(slot->col_name(),
expr->get_set_func());
+ *pdt = PushDownType::ACCEPTABLE;
+ return Status::OK();
+ }
+ } else {
+ VInPredicate* pred = static_cast<VInPredicate*>(expr);
+
+ InState* state = reinterpret_cast<InState*>(
+ expr_ctx->fn_context(pred->fn_context_index())
+
->get_function_state(FunctionContext::FRAGMENT_LOCAL));
+
+ if (!state->use_set) {
+ return Status::OK();
+ }
+
+ iter = state->hybrid_set->begin();
+ }
+
+ while (iter->has_next()) {
+ if (nullptr == iter->get_value()) {
+ iter->next();
+ continue;
+ }
+ auto value = const_cast<void*>(iter->get_value());
Review Comment:
warning: 'auto value' can be declared as 'auto *value'
[readability-qualified-auto]
```suggestion
auto *value = const_cast<void*>(iter->get_value());
```
##########
be/src/vec/exec/scan/vscan_node.cpp:
##########
@@ -1021,11 +1009,10 @@ Status VScanNode::_normalize_compound_predicate(
}
template <PrimitiveType T>
-Status VScanNode::_normalize_binary_in_compound_predicate(vectorized::VExpr*
expr,
- VExprContext*
expr_ctx,
- SlotDescriptor* slot,
- ColumnValueRange<T>&
range,
- PushDownType* pdt) {
+Status VScanNode::_normalize_binary_compound_predicate(vectorized::VExpr* expr,
Review Comment:
warning: function '_normalize_binary_compound_predicate' has cognitive
complexity of 54 (threshold 50) [readability-function-cognitive-complexity]
```cpp
Status VScanNode::_normalize_binary_compound_predicate(vectorized::VExpr*
expr,
^
```
<details>
<summary>Additional context</summary>
**be/src/vec/exec/scan/vscan_node.cpp:1016:** +1, including nesting penalty
of 0, nesting level increased to 1
```cpp
if (TExprNodeType::BINARY_PRED == expr->node_type()) {
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1017:** nesting level increased to 2
```cpp
auto eq_checker = [](const std::string& fn_name) { return fn_name ==
"eq"; };
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1018:** nesting level increased to 2
```cpp
auto ne_checker = [](const std::string& fn_name) { return fn_name ==
"ne"; };
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1019:** nesting level increased to 2
```cpp
auto noneq_checker = [](const std::string& fn_name) {
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1020:** +1
```cpp
return fn_name != "ne" && fn_name != "eq" && fn_name !=
"eq_for_null";
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1028:** +2, including nesting penalty
of 1, nesting level increased to 2
```cpp
RETURN_IF_ERROR(_should_push_down_binary_predicate(
^
```
**be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1028:** +3, including nesting penalty
of 2, nesting level increased to 3
```cpp
RETURN_IF_ERROR(_should_push_down_binary_predicate(
^
```
**be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1031:** +2, including nesting penalty
of 1, nesting level increased to 2
```cpp
RETURN_IF_ERROR(_should_push_down_binary_predicate(
^
```
**be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1031:** +3, including nesting penalty
of 2, nesting level increased to 3
```cpp
RETURN_IF_ERROR(_should_push_down_binary_predicate(
^
```
**be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1034:** +2, including nesting penalty
of 1, nesting level increased to 2
```cpp
RETURN_IF_ERROR(_should_push_down_binary_predicate(
^
```
**be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1034:** +3, including nesting penalty
of 2, nesting level increased to 3
```cpp
RETURN_IF_ERROR(_should_push_down_binary_predicate(
^
```
**be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1037:** +2, including nesting penalty
of 1, nesting level increased to 2
```cpp
if (eq_pdt == PushDownType::UNACCEPTABLE && ne_pdt ==
PushDownType::UNACCEPTABLE &&
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1037:** +1
```cpp
if (eq_pdt == PushDownType::UNACCEPTABLE && ne_pdt ==
PushDownType::UNACCEPTABLE &&
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1044:** +2, including nesting penalty
of 1, nesting level increased to 2
```cpp
if (eq_pdt == PushDownType::ACCEPTABLE || ne_pdt ==
PushDownType::ACCEPTABLE ||
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1044:** +1
```cpp
if (eq_pdt == PushDownType::ACCEPTABLE || ne_pdt ==
PushDownType::ACCEPTABLE ||
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1046:** +3, including nesting penalty
of 2, nesting level increased to 3
```cpp
if (value.data != nullptr) {
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1047:** +4, including nesting penalty
of 3, nesting level increased to 4
```cpp
if constexpr (T == TYPE_CHAR || T == TYPE_VARCHAR || T ==
TYPE_STRING ||
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1047:** +1
```cpp
if constexpr (T == TYPE_CHAR || T == TYPE_VARCHAR || T ==
TYPE_STRING ||
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1050:** +5, including nesting penalty
of 4, nesting level increased to 5
```cpp
RETURN_IF_ERROR(_change_value_range<false>(
^
```
**be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1050:** +6, including nesting penalty
of 5, nesting level increased to 6
```cpp
RETURN_IF_ERROR(_change_value_range<false>(
^
```
**be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1054:** +1, nesting level increased to
4
```cpp
} else {
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1055:** +5, including nesting penalty
of 4, nesting level increased to 5
```cpp
RETURN_IF_ERROR(_change_value_range<false>(
^
```
**be/src/common/status.h:541:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/vec/exec/scan/vscan_node.cpp:1055:** +6, including nesting penalty
of 5, nesting level increased to 6
```cpp
RETURN_IF_ERROR(_change_value_range<false>(
^
```
**be/src/common/status.h:543:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
</details>
##########
be/src/vec/exec/scan/vscan_node.cpp:
##########
@@ -1079,11 +1066,60 @@
}
template <PrimitiveType T>
-Status VScanNode::_normalize_match_in_compound_predicate(vectorized::VExpr*
expr,
- VExprContext*
expr_ctx,
- SlotDescriptor* slot,
- ColumnValueRange<T>&
range,
- PushDownType* pdt) {
+Status
VScanNode::_normalize_in_and_not_in_compound_predicate(vectorized::VExpr* expr,
+ VExprContext*
expr_ctx,
+ SlotDescriptor*
slot,
+
ColumnValueRange<T>& range,
+ PushDownType*
pdt) {
+ if (TExprNodeType::IN_PRED == expr->node_type()) {
+ std::string fn_name =
+ expr->op() == TExprOpcode::type::FILTER_IN ? "in_list" :
"not_in_list";
+
+ HybridSetBase::IteratorBase* iter = nullptr;
+ auto hybrid_set = expr->get_set_func();
+
+ if (hybrid_set != nullptr) {
+ if (hybrid_set->size() <= _max_pushdown_conditions_per_column) {
+ iter = hybrid_set->begin();
+ } else {
+ _filter_predicates.in_filters.emplace_back(slot->col_name(),
expr->get_set_func());
+ *pdt = PushDownType::ACCEPTABLE;
+ return Status::OK();
+ }
+ } else {
+ VInPredicate* pred = static_cast<VInPredicate*>(expr);
Review Comment:
warning: use auto when initializing with a cast to avoid duplicating the
type name [modernize-use-auto]
```suggestion
auto* pred = static_cast<VInPredicate*>(expr);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]