morningman commented on a change in pull request #3694:
URL: https://github.com/apache/incubator-doris/pull/3694#discussion_r430967592



##########
File path: be/src/exec/olap_scan_node.cpp
##########
@@ -838,39 +851,52 @@ Status 
OlapScanNode::normalize_in_predicate(SlotDescriptor* slot, ColumnValueRan
                         != TExprNodeType::SLOT_REF) {
                     continue;
                 }
+
+                std::vector<SlotId> slot_ids;
+                if (pred->get_child(child_idx)->get_slot_ids(&slot_ids) != 1) {
+                    // not a single column predicate
+                    continue;
+                }
+
+                if (slot_ids[0] != slot->id()) {
+                    // predicate not related to current column
+                    continue;
+                }
+
                 if (pred->get_child(child_idx)->type().type != 
slot->type().type) {
                     if (!ignore_cast(slot, pred->get_child(child_idx))) {
+                        // the type of predicate not match the slot's type
                         continue;
                     }
                 }
 
-                std::vector<SlotId> slot_ids;
-                if (1 == pred->get_child(child_idx)->get_slot_ids(&slot_ids)) {
-                    if (slot_ids[0] != slot->id()) {
-                        continue;
-                    }
-
-                    Expr* expr = pred->get_child(1 - child_idx);
-                    if (!expr->is_constant()) {
-                        continue;
-                    }
+                Expr* expr = pred->get_child(1 - child_idx);
+                if (!expr->is_constant()) {
+                    // only handle constant value
+                    continue;
+                }
 
-                    void* value = _conjunct_ctxs[conj_idx]->get_value(expr, 
NULL);
-                    // for case: where col = null
-                    if (value == NULL) {
-                        continue;
-                    }
+                void* value = _conjunct_ctxs[conj_idx]->get_value(expr, NULL);
+                // for case: where col = null
+                if (value == NULL) {
+                    continue;
+                }
 
-                    switch (slot->type().type) {
+                // begin to push condition value into ColumnValueRange
+                // clear the ColumnValueRange before adding new fixed values.
+                // because for AND compound predicates, it can overwrite 
previous conditions
+                switch (slot->type().type) {
                     case TYPE_TINYINT: {
                         int32_t v = *reinterpret_cast<int8_t*>(value);
+                        range->clear();

Review comment:
       OK




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to