jacktengg commented on code in PR #48554:
URL: https://github.com/apache/doris/pull/48554#discussion_r1978701179


##########
be/src/vec/columns/column_string.cpp:
##########
@@ -649,8 +649,11 @@ void ColumnStr<T>::compare_internal(size_t rhs_row_id, 
const IColumn& rhs, int n
         size_t end = simd::find_one(cmp_res, begin + 1);
         for (size_t row_id = begin; row_id < end; row_id++) {
             auto value_a = get_data_at(row_id);
-            int res = memcmp_small_allow_overflow15(value_a.data, 
value_a.size, cmp_base.data,
-                                                    cmp_base.size);
+            // need to covert to unsigned char, orelse the compare semantic is 
not consistent
+            // with other member functions, e.g. get_permutation and 
compare_at,
+            // and will result wrong result.
+            int res = memcmp_small_allow_overflow15((Char*)value_a.data, 
value_a.size,

Review Comment:
   `ColumnString::Char`实际是`UInt8`, `get_data_at`得到的`StringRef::data`是`const 
char*`类型,这里不转换为`UInt8`的话,对于大于127的值,`memcmp_small_allow_overflow15`里面会当成负数,造成比较结果错误。



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