Tanya-W commented on code in PR #17629:
URL: https://github.com/apache/doris/pull/17629#discussion_r1131903066


##########
be/src/olap/match_predicate.h:
##########
@@ -46,7 +46,7 @@ class MatchPredicate : public ColumnPredicate {
                     roaring::Roaring* bitmap) const override;
 
 private:
-    InvertedIndexQueryType _to_inverted_index_query_type(MatchType match_type) 
const;
+    InvertedIndexQueryOp _to_inverted_index_query_type(MatchType match_type) 
const;

Review Comment:
   It would be better to change function name together



##########
be/src/olap/rowset/segment_v2/inverted_index_cache.h:
##########
@@ -164,28 +164,26 @@ class InvertedIndexCacheHandle {
     DISALLOW_COPY_AND_ASSIGN(InvertedIndexCacheHandle);
 };
 
-enum class InvertedIndexQueryType;
+enum class InvertedIndexQueryOp;
 
 class InvertedIndexQueryCacheHandle;
 
 class InvertedIndexQueryCache {
 public:
     // cache key
     struct CacheKey {
-        io::Path index_path;               // index file path
-        std::string column_name;           // column name
-        InvertedIndexQueryType query_type; // query type
-        std::wstring value;                // query value
+        io::Path index_path; // index file path
+        std::string column_name;
+        std::string query;

Review Comment:
   add some note



##########
be/src/olap/match_predicate.cpp:
##########
@@ -45,53 +45,84 @@ Status MatchPredicate::evaluate(const Schema& schema, 
InvertedIndexIterator* ite
     roaring::Roaring roaring;
     Status s = Status::OK();
     auto inverted_index_query_type = 
_to_inverted_index_query_type(_match_type);

Review Comment:
   variable `inverted_index_query_type` and function 
`_to_inverted_index_query_type` all need change name, to avoid ambiguity with 
below `InvertedIndexQueryType`, other places may also need to be checked and 
changed.



##########
be/src/olap/rowset/segment_v2/inverted_index_reader.h:
##########
@@ -61,6 +67,520 @@ enum class InvertedIndexQueryType {
     MATCH_PHRASE_QUERY = 7,
 };
 
+inline std::string inverted_index_query_op_to_string(InvertedIndexQueryOp op) {
+    switch (op) {
+    case InvertedIndexQueryOp::EQUAL_QUERY:
+        return "=";
+    case InvertedIndexQueryOp::LESS_EQUAL_QUERY:
+        return "<=";
+    case InvertedIndexQueryOp::LESS_THAN_QUERY:
+        return "<<";
+    case InvertedIndexQueryOp::GREATER_THAN_QUERY:
+        return ">>";
+    case InvertedIndexQueryOp::GREATER_EQUAL_QUERY:
+        return ">=";
+    case InvertedIndexQueryOp::MATCH_ANY_QUERY:
+        return "match_any";
+    case InvertedIndexQueryOp::MATCH_ALL_QUERY:
+        return "match_all";
+    case InvertedIndexQueryOp::MATCH_PHRASE_QUERY:
+        return "match_phrase";
+    default:
+        return "";
+    }
+}
+
+inline bool is_match_query(InvertedIndexQueryOp query_op) {
+    return (query_op == InvertedIndexQueryOp::MATCH_ANY_QUERY ||
+            query_op == InvertedIndexQueryOp::MATCH_ALL_QUERY ||
+            query_op == InvertedIndexQueryOp::MATCH_PHRASE_QUERY);
+}
+
+inline bool is_equal_query(InvertedIndexQueryOp query_op) {
+    return (query_op == InvertedIndexQueryOp::EQUAL_QUERY);
+}
+
+inline bool is_range_query(InvertedIndexQueryOp query_op) {
+    return (query_op == InvertedIndexQueryOp::LESS_EQUAL_QUERY ||
+            query_op == InvertedIndexQueryOp::LESS_THAN_QUERY ||
+            query_op == InvertedIndexQueryOp::GREATER_THAN_QUERY ||
+            query_op == InvertedIndexQueryOp::GREATER_EQUAL_QUERY);
+}
+
+template <PrimitiveType Type>
+//template <FieldType field_type>
+class InvertedIndexQuery {
+    using CppType = typename 
PredicatePrimitiveTypeTraits<Type>::PredicateFieldType;
+
+public:
+    /*class QueryEncodedValue {
+    public:
+        QueryEncodedValue() = default;
+        QueryEncodedValue(const uint8_t* encoded_value) : 
_encoded_value(encoded_value) {}
+        QueryEncodedValue Operator = (const std::string& encoded_value) {
+            _encoded_value = (const uint8_t*)encoded_value.c_str();
+        }
+        ~QueryEncodedValue() = default;
+
+        const uint8_t* encoded_value() const { return _encoded_value; }
+
+        bool operator<(const QueryEncodedValue& value) const { return 
cmp(value) < 0; }
+
+        bool operator<=(const QueryEncodedValue& value) const { return 
cmp(value) <= 0; }
+
+        bool operator>(const QueryEncodedValue& value) const { return 
cmp(value) > 0; }
+
+        bool operator>=(const QueryEncodedValue& value) const { return 
cmp(value) >= 0; }
+
+        bool operator==(const QueryEncodedValue& value) const { return 
cmp(value) == 0; }
+
+        bool operator!=(const QueryEncodedValue& value) const { return 
cmp(value) != 0; }
+
+        int32_t cmp(const QueryEncodedValue& other) const {
+            return lucene::util::FutureArrays::CompareUnsigned(
+                    (const uint8_t*)encoded_value().c_str(), 0, 0 + 
sizeof(CppType),
+                    (const uint8_t*)other.encoded_value().c_str(), 0, 0 + 
sizeof(CppType));
+        }
+
+    private:
+        const uint8_t* _encoded_value;
+    };*/
+
+    InvertedIndexQuery(const TypeInfo* type_info)
+            : _low_value(TYPE_MIN),
+              _high_value(TYPE_MAX),
+              _low_op(InvertedIndexQueryOp::GREATER_THAN_QUERY),
+              _high_op(InvertedIndexQueryOp::LESS_THAN_QUERY),
+              _type_info(type_info) {
+        //FieldTypeTraits<field_type>::set_to_max(&_high_value);
+        //FieldTypeTraits<field_type>::set_to_min(&_low_value);
+        _value_key_coder = get_key_coder(_type_info->type());
+        _value_key_coder->full_encode_ascending(&TYPE_MAX, 
&_high_value_encoded);
+        _value_key_coder->full_encode_ascending(&TYPE_MIN, 
&_low_value_encoded);
+    }
+
+    // if op is match, we just need to add match_value to fixed_values_str, no 
need to add to fixed_values.
+    // because fulltext match only uses fixed_values_str.
+    Status add_match_value(InvertedIndexQueryOp op, const std::string& 
match_value) {

Review Comment:
   no place to call `add_match_value`? I see in function `add_value` and 
`add_value_str` process match_query



##########
be/src/olap/match_predicate.cpp:
##########
@@ -45,53 +45,84 @@ Status MatchPredicate::evaluate(const Schema& schema, 
InvertedIndexIterator* ite
     roaring::Roaring roaring;
     Status s = Status::OK();
     auto inverted_index_query_type = 
_to_inverted_index_query_type(_match_type);
+    InvertedIndexQueryType* query = nullptr;
+    bool skip_try_inverted_index = false;
 
-    if (is_string_type(column_desc->type()) ||
-        (column_desc->type() == OLAP_FIELD_TYPE_ARRAY &&
-         is_string_type(column_desc->get_sub_field(0)->type_info()->type()))) {
-        StringRef match_value;
-        int32_t length = _value.length();
-        char* buffer = const_cast<char*>(_value.c_str());
-        match_value.replace(buffer, length); //is it safe?
-        s = iterator->read_from_inverted_index(column_desc->name(), 
&match_value,
-                                               inverted_index_query_type, 
num_rows, &roaring);
-    } else if (column_desc->type() == OLAP_FIELD_TYPE_ARRAY &&
-               
is_numeric_type(column_desc->get_sub_field(0)->type_info()->type())) {
-        char buf[column_desc->get_sub_field(0)->type_info()->size()];
-        column_desc->get_sub_field(0)->from_string(buf, _value);
-        s = iterator->read_from_inverted_index(column_desc->name(), buf, 
inverted_index_query_type,
-                                               num_rows, &roaring, true);
+    if (is_string_type(column_desc->type())) {
+        
RETURN_IF_ERROR(InvertedIndexQueryRangeTypeFactory::create_inverted_index_query(
+                column_desc->type_info(), &query));
+        RETURN_IF_ERROR(std::visit(
+                [&](auto& q) -> Status {
+                    return q.add_value_str(inverted_index_query_type, _value,

Review Comment:
   inverted_index_query_type need change name



##########
be/src/olap/rowset/segment_v2/inverted_index_reader.h:
##########
@@ -61,6 +67,520 @@ enum class InvertedIndexQueryType {
     MATCH_PHRASE_QUERY = 7,
 };
 
+inline std::string inverted_index_query_op_to_string(InvertedIndexQueryOp op) {
+    switch (op) {
+    case InvertedIndexQueryOp::EQUAL_QUERY:
+        return "=";
+    case InvertedIndexQueryOp::LESS_EQUAL_QUERY:
+        return "<=";
+    case InvertedIndexQueryOp::LESS_THAN_QUERY:
+        return "<<";
+    case InvertedIndexQueryOp::GREATER_THAN_QUERY:
+        return ">>";
+    case InvertedIndexQueryOp::GREATER_EQUAL_QUERY:
+        return ">=";
+    case InvertedIndexQueryOp::MATCH_ANY_QUERY:
+        return "match_any";
+    case InvertedIndexQueryOp::MATCH_ALL_QUERY:
+        return "match_all";
+    case InvertedIndexQueryOp::MATCH_PHRASE_QUERY:
+        return "match_phrase";
+    default:
+        return "";
+    }
+}
+
+inline bool is_match_query(InvertedIndexQueryOp query_op) {
+    return (query_op == InvertedIndexQueryOp::MATCH_ANY_QUERY ||
+            query_op == InvertedIndexQueryOp::MATCH_ALL_QUERY ||
+            query_op == InvertedIndexQueryOp::MATCH_PHRASE_QUERY);
+}
+
+inline bool is_equal_query(InvertedIndexQueryOp query_op) {
+    return (query_op == InvertedIndexQueryOp::EQUAL_QUERY);
+}
+
+inline bool is_range_query(InvertedIndexQueryOp query_op) {
+    return (query_op == InvertedIndexQueryOp::LESS_EQUAL_QUERY ||
+            query_op == InvertedIndexQueryOp::LESS_THAN_QUERY ||
+            query_op == InvertedIndexQueryOp::GREATER_THAN_QUERY ||
+            query_op == InvertedIndexQueryOp::GREATER_EQUAL_QUERY);
+}
+
+template <PrimitiveType Type>
+//template <FieldType field_type>
+class InvertedIndexQuery {
+    using CppType = typename 
PredicatePrimitiveTypeTraits<Type>::PredicateFieldType;
+
+public:
+    /*class QueryEncodedValue {
+    public:
+        QueryEncodedValue() = default;
+        QueryEncodedValue(const uint8_t* encoded_value) : 
_encoded_value(encoded_value) {}
+        QueryEncodedValue Operator = (const std::string& encoded_value) {
+            _encoded_value = (const uint8_t*)encoded_value.c_str();
+        }
+        ~QueryEncodedValue() = default;
+
+        const uint8_t* encoded_value() const { return _encoded_value; }
+
+        bool operator<(const QueryEncodedValue& value) const { return 
cmp(value) < 0; }
+
+        bool operator<=(const QueryEncodedValue& value) const { return 
cmp(value) <= 0; }
+
+        bool operator>(const QueryEncodedValue& value) const { return 
cmp(value) > 0; }
+
+        bool operator>=(const QueryEncodedValue& value) const { return 
cmp(value) >= 0; }
+
+        bool operator==(const QueryEncodedValue& value) const { return 
cmp(value) == 0; }
+
+        bool operator!=(const QueryEncodedValue& value) const { return 
cmp(value) != 0; }
+
+        int32_t cmp(const QueryEncodedValue& other) const {
+            return lucene::util::FutureArrays::CompareUnsigned(
+                    (const uint8_t*)encoded_value().c_str(), 0, 0 + 
sizeof(CppType),
+                    (const uint8_t*)other.encoded_value().c_str(), 0, 0 + 
sizeof(CppType));
+        }
+
+    private:
+        const uint8_t* _encoded_value;
+    };*/
+
+    InvertedIndexQuery(const TypeInfo* type_info)
+            : _low_value(TYPE_MIN),
+              _high_value(TYPE_MAX),
+              _low_op(InvertedIndexQueryOp::GREATER_THAN_QUERY),
+              _high_op(InvertedIndexQueryOp::LESS_THAN_QUERY),
+              _type_info(type_info) {
+        //FieldTypeTraits<field_type>::set_to_max(&_high_value);
+        //FieldTypeTraits<field_type>::set_to_min(&_low_value);
+        _value_key_coder = get_key_coder(_type_info->type());
+        _value_key_coder->full_encode_ascending(&TYPE_MAX, 
&_high_value_encoded);
+        _value_key_coder->full_encode_ascending(&TYPE_MIN, 
&_low_value_encoded);
+    }
+
+    // if op is match, we just need to add match_value to fixed_values_str, no 
need to add to fixed_values.
+    // because fulltext match only uses fixed_values_str.
+    Status add_match_value(InvertedIndexQueryOp op, const std::string& 
match_value) {
+        DCHECK(op == InvertedIndexQueryOp::MATCH_ANY_QUERY ||
+               op == InvertedIndexQueryOp::MATCH_ALL_QUERY ||
+               op == InvertedIndexQueryOp::MATCH_PHRASE_QUERY);
+        _fixed_values_str.insert(match_value);
+        _high_op = _low_op = op;
+        _high_value = TYPE_MIN;
+        _low_value = TYPE_MAX;
+        return Status::OK();
+    }
+
+    Status add_fixed_value(InvertedIndexQueryOp op, const CppType& value,

Review Comment:
   Why need two function `add_fixed_value`? Can we use one function with 
default parameters of `value_str`?



##########
be/src/olap/rowset/segment_v2/inverted_index_reader.h:
##########
@@ -61,6 +67,457 @@ enum class InvertedIndexQueryType {
     MATCH_PHRASE_QUERY = 7,
 };
 
+inline std::string inverted_index_query_op_to_string(InvertedIndexQueryOp op) {
+    switch (op) {
+    case InvertedIndexQueryOp::EQUAL_QUERY:
+        return "=";
+    case InvertedIndexQueryOp::LESS_EQUAL_QUERY:
+        return "<=";
+    case InvertedIndexQueryOp::LESS_THAN_QUERY:
+        return "<<";
+    case InvertedIndexQueryOp::GREATER_THAN_QUERY:
+        return ">>";
+    case InvertedIndexQueryOp::GREATER_EQUAL_QUERY:
+        return ">=";
+    case InvertedIndexQueryOp::MATCH_ANY_QUERY:
+        return "match_any";
+    case InvertedIndexQueryOp::MATCH_ALL_QUERY:
+        return "match_all";
+    case InvertedIndexQueryOp::MATCH_PHRASE_QUERY:
+        return "match_phrase";
+    default:
+        return "";
+    }
+}
+
+inline bool is_match_query(InvertedIndexQueryOp query_op) {
+    return (query_op == InvertedIndexQueryOp::MATCH_ANY_QUERY ||
+            query_op == InvertedIndexQueryOp::MATCH_ALL_QUERY ||
+            query_op == InvertedIndexQueryOp::MATCH_PHRASE_QUERY);
+}
+
+inline bool is_equal_query(InvertedIndexQueryOp query_op) {
+    return (query_op == InvertedIndexQueryOp::EQUAL_QUERY);
+}
+
+inline bool is_range_query(InvertedIndexQueryOp query_op) {
+    return (query_op == InvertedIndexQueryOp::LESS_EQUAL_QUERY ||
+            query_op == InvertedIndexQueryOp::LESS_THAN_QUERY ||
+            query_op == InvertedIndexQueryOp::GREATER_THAN_QUERY ||
+            query_op == InvertedIndexQueryOp::GREATER_EQUAL_QUERY);
+}
+
+template <PrimitiveType Type>
+//template <FieldType field_type>
+class InvertedIndexQuery {
+    using CppType = typename 
PredicatePrimitiveTypeTraits<Type>::PredicateFieldType;
+
+public:
+    /*class QueryEncodedValue {
+    public:
+        QueryEncodedValue() = default;
+        QueryEncodedValue(const uint8_t* encoded_value) : 
_encoded_value(encoded_value) {}
+        QueryEncodedValue Operator = (const std::string& encoded_value) {
+            _encoded_value = (const uint8_t*)encoded_value.c_str();
+        }
+        ~QueryEncodedValue() = default;
+
+        const uint8_t* encoded_value() const { return _encoded_value; }
+
+        bool operator<(const QueryEncodedValue& value) const { return 
cmp(value) < 0; }
+
+        bool operator<=(const QueryEncodedValue& value) const { return 
cmp(value) <= 0; }
+
+        bool operator>(const QueryEncodedValue& value) const { return 
cmp(value) > 0; }
+
+        bool operator>=(const QueryEncodedValue& value) const { return 
cmp(value) >= 0; }
+
+        bool operator==(const QueryEncodedValue& value) const { return 
cmp(value) == 0; }
+
+        bool operator!=(const QueryEncodedValue& value) const { return 
cmp(value) != 0; }
+
+        int32_t cmp(const QueryEncodedValue& other) const {
+            return lucene::util::FutureArrays::CompareUnsigned(
+                    (const uint8_t*)encoded_value().c_str(), 0, 0 + 
sizeof(CppType),
+                    (const uint8_t*)other.encoded_value().c_str(), 0, 0 + 
sizeof(CppType));
+        }
+
+    private:
+        const uint8_t* _encoded_value;
+    };*/
+
+    InvertedIndexQuery(const TypeInfo* type_info)
+            : _low_value(TYPE_MIN),
+              _high_value(TYPE_MAX),
+              _low_op(InvertedIndexQueryOp::GREATER_THAN_QUERY),
+              _high_op(InvertedIndexQueryOp::LESS_THAN_QUERY),
+              _type_info(type_info) {
+        //FieldTypeTraits<field_type>::set_to_max(&_high_value);
+        //FieldTypeTraits<field_type>::set_to_min(&_low_value);
+        _value_key_coder = get_key_coder(_type_info->type());
+        _value_key_coder->full_encode_ascending(&TYPE_MAX, 
&_high_value_encoded);
+        _value_key_coder->full_encode_ascending(&TYPE_MIN, 
&_low_value_encoded);
+    }
+
+    // if op is match, we just need to add match_value to fixed_values_str, no 
need to add to fixed_values.
+    // because fulltext match only uses fixed_values_str.
+    Status add_match_value(InvertedIndexQueryOp op, const std::string& 
match_value) {
+        DCHECK(op == InvertedIndexQueryOp::MATCH_ANY_QUERY ||
+               op == InvertedIndexQueryOp::MATCH_ALL_QUERY ||
+               op == InvertedIndexQueryOp::MATCH_PHRASE_QUERY);
+        _fixed_values_str.insert(match_value);
+        _high_op = _low_op = op;
+        _high_value = TYPE_MIN;
+        _low_value = TYPE_MAX;
+        return Status::OK();
+    }
+
+    Status add_fixed_value(InvertedIndexQueryOp op, const CppType& value,
+                           const std::string& value_str);
+    Status add_fixed_value(InvertedIndexQueryOp op, const CppType& value) {
+        _fixed_values.insert(value);
+        std::string tmp;
+        _value_key_coder->full_encode_ascending(&value, &tmp);
+        _fixed_values_encoded.insert(tmp);
+
+        _high_value = value;
+        _low_value = value;
+        _high_op = op;
+        _low_op = op;
+
+        return Status::OK();
+    }
+
+    Status from_string(const std::string& str_value, CppType& value, int 
precision, int scale);
+    Status add_value(InvertedIndexQueryOp op, const CppType& value) {
+        if (is_match_query(op) || is_equal_query(op)) {
+            return add_fixed_value(op, value);
+        }
+        if (_high_value > _low_value) {
+            switch (op) {
+            case InvertedIndexQueryOp::GREATER_THAN_QUERY: {
+                if (value >= _low_value) {
+                    _low_value = value;
+                    _low_value_encoded.clear();
+                    _value_key_coder->full_encode_ascending(&value, 
&_low_value_encoded);
+                    _low_op = op;
+                }
+                break;
+            }
+
+            case InvertedIndexQueryOp::GREATER_EQUAL_QUERY: {
+                if (value > _low_value) {
+                    _low_value = value;
+                    _low_value_encoded.clear();
+                    _value_key_coder->full_encode_ascending(&value, 
&_low_value_encoded);
+                    _low_op = op;
+                }
+                break;
+            }
+
+            case InvertedIndexQueryOp::LESS_THAN_QUERY: {
+                if (value <= _high_value) {
+                    _high_value = value;
+                    _high_value_encoded.clear();
+                    _value_key_coder->full_encode_ascending(&value, 
&_high_value_encoded);
+                    _high_op = op;
+                }
+                break;
+            }
+
+            case InvertedIndexQueryOp::LESS_EQUAL_QUERY: {
+                if (value < _high_value) {
+                    _high_value = value;
+                    _high_value_encoded.clear();
+                    _value_key_coder->full_encode_ascending(&value, 
&_high_value_encoded);
+                    _high_op = op;
+                }
+                break;
+            }
+
+            default: {
+                return Status::InternalError(
+                        "Add value failed! Unsupported InvertedIndexQueryOp 
{}", op);
+            }
+            }
+        }
+
+        return Status::OK();
+    }
+    //NOTE: value_str intentionally copy here
+    Status add_value_str(InvertedIndexQueryOp op, std::string value_str, int 
precision, int scale) {
+        CppType value;
+        from_string(value_str, value, precision, scale);
+
+        if (is_match_query(op) || is_equal_query(op)) {
+            return add_fixed_value(op, value, value_str);
+        }
+        if (_high_value > _low_value) {
+            switch (op) {
+            case InvertedIndexQueryOp::GREATER_THAN_QUERY: {
+                if (value >= _low_value) {
+                    _low_value = value;
+                    _low_value_str = value_str;
+                    // NOTE:full_encode_ascending will append encoded data to 
the end of buffer.
+                    // so we need to clear buffer first.
+                    _low_value_encoded.clear();
+                    _value_key_coder->full_encode_ascending(&value, 
&_low_value_encoded);
+                    _low_op = op;
+                }
+                break;
+            }
+
+            case InvertedIndexQueryOp::GREATER_EQUAL_QUERY: {
+                if (value > _low_value) {
+                    _low_value = value;
+                    _low_value_str = value_str;
+                    _low_value_encoded.clear();
+                    _value_key_coder->full_encode_ascending(&value, 
&_low_value_encoded);
+                    _low_op = op;
+                }
+                break;
+            }
+
+            case InvertedIndexQueryOp::LESS_THAN_QUERY: {
+                if (value <= _high_value) {
+                    _high_value = value;
+                    _high_value_str = value_str;
+                    _high_value_encoded.clear();
+                    _value_key_coder->full_encode_ascending(&value, 
&_high_value_encoded);
+                    _high_op = op;
+                }
+                break;
+            }
+
+            case InvertedIndexQueryOp::LESS_EQUAL_QUERY: {
+                if (value < _high_value) {
+                    _high_value = value;
+                    _high_value_str = value_str;
+                    _high_value_encoded.clear();
+                    _value_key_coder->full_encode_ascending(&value, 
&_high_value_encoded);
+                    _high_op = op;
+                }
+                break;
+            }
+
+            default: {
+                return Status::InternalError(
+                        "Add value string fail! Unsupported 
InvertedIndexQueryOp {}", op);
+            }
+            }
+        }
+
+        return Status::OK();
+    }
+    bool is_point_query() const { return _fixed_values.size() != 0; }
+    bool is_range_query() const { return _high_value > _low_value; }
+    CppType& lower_value() { return _low_value; }
+    CppType& upper_value() { return _high_value; }
+    std::string& lower_value_string() { return _low_value_str; }
+    std::string& upper_value_string() { return _high_value_str; }
+    std::string& lower_value_encoded() { return _low_value_encoded; }
+    std::string& upper_value_encoded() { return _high_value_encoded; }
+    InvertedIndexQueryOp lower_op() const { return _low_op; }
+    InvertedIndexQueryOp upper_op() const { return _high_op; }
+    bool get_include_lower() {
+        return _low_op == InvertedIndexQueryOp::GREATER_EQUAL_QUERY ||
+               _low_op == InvertedIndexQueryOp::EQUAL_QUERY;
+    }
+    bool get_include_upper() {
+        return _high_op == InvertedIndexQueryOp::LESS_EQUAL_QUERY ||
+               _high_op == InvertedIndexQueryOp::EQUAL_QUERY;
+    }
+    bool has_upper_bound() { return _high_value != TYPE_MAX; }
+    bool has_lower_bound() { return _low_value != TYPE_MIN; }
+    InvertedIndexQueryOp point_op() const {
+        DCHECK(_low_op == _high_op);
+        return _low_op;
+    }
+    size_t get_fixed_value_size() { return _fixed_values.size(); }
+    const std::set<CppType>& get_fixed_value_set() { return _fixed_values; }
+    const std::set<std::string>& get_fixed_value_string_set() { return 
_fixed_values_str; }
+    const std::set<std::string>& get_fixed_value_encoded_set() { return 
_fixed_values_encoded; }
+
+    CppType get_fixed_value() {
+        DCHECK(get_fixed_value_size() > 0);
+        return *_fixed_values.begin();
+    }
+    std::string get_fixed_value_string() {
+        DCHECK(get_fixed_value_size() > 0);
+        return *_fixed_values_str.begin();
+    }
+    std::string get_fixed_value_encoded() {
+        DCHECK(get_fixed_value_size() > 0);
+        return *_fixed_values_encoded.begin();
+    }
+    std::string to_string() {
+        //convert query range to string
+        std::stringstream ss;
+        if (is_point_query()) {
+            ss << inverted_index_query_op_to_string(point_op()) << " ";
+            for (auto& value : get_fixed_value_string_set()) {
+                ss << value << ",";
+            }
+            //ss << inverted_index_query_op_to_string(point_op()) << " " << 
get_fixed_value_string();
+        } else if (is_range_query()) {
+            if (has_lower_bound()) {
+                ss << lower_value_string() << " " << 
inverted_index_query_op_to_string(lower_op())

Review Comment:
   why the query splicing format is different from the above is_point_query 
branch?



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to