GoGoWen commented on code in PR #19413:
URL: https://github.com/apache/doris/pull/19413#discussion_r1197494256


##########
be/src/vec/data_types/data_type_hll.cpp:
##########
@@ -126,4 +126,30 @@ void DataTypeHLL::to_string(const class 
doris::vectorized::IColumn& column, size
     ostr.write(result.c_str(), result.size());
 }
 
+std::string DataTypeHLL::to_string(const IColumn& column, size_t row_num) 
const {
+    auto col_row = check_column_const_set_readability(column, row_num);
+    ColumnPtr ptr = col_row.first;
+    row_num = col_row.second;
+
+    auto& data = const_cast<HyperLogLog&>(assert_cast<const 
ColumnHLL&>(*ptr).get_element(row_num));
+
+    std::string result(data.max_serialized_size(), '0');
+    data.serialize((uint8_t*)result.data());
+    return result;
+}
+
+Status DataTypeHLL::from_string(ReadBuffer& rb, IColumn* column) const {
+    auto& data_column = assert_cast<ColumnHLL&>(*column);
+    auto& data = data_column.get_data();
+
+    std::string str;
+    str = rb.to_string();
+    HyperLogLog hll;
+    if (!hll.deserialize(Slice(str))) {
+        LOG(WARNING) << "deserialize hll from string fail!";

Review Comment:
   in previous design, if some error hll row deserialize fail can not effect 
other correct hll.    And  now seems  we make it fail fast should be better.



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