You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/07/08 13:33:50 UTC

[GitHub] [doris] BiteTheDDDDt commented on a diff in pull request #10700: [improvement]pre-serialize aggregation keys

BiteTheDDDDt commented on code in PR #10700:
URL: https://github.com/apache/doris/pull/10700#discussion_r916821559


##########
be/src/vec/common/columns_hashing.h:
##########
@@ -111,29 +111,48 @@ struct HashMethodString : public columns_hashing_impl::HashMethodBase<
   * That is, for example, for strings, it contains first the serialized length of the string, and then the bytes.
   * Therefore, when aggregating by several strings, there is no ambiguity.
   */
-template <typename Value, typename Mapped>
+template <typename Value, typename Mapped, bool keys_pre_serialized = false>
 struct HashMethodSerialized
-        : public columns_hashing_impl::HashMethodBase<HashMethodSerialized<Value, Mapped>, Value,
-                                                      Mapped, false> {
-    using Self = HashMethodSerialized<Value, Mapped>;
+        : public columns_hashing_impl::HashMethodBase<
+                  HashMethodSerialized<Value, Mapped, keys_pre_serialized>, Value, Mapped, false> {
+    using Self = HashMethodSerialized<Value, Mapped, keys_pre_serialized>;
     using Base = columns_hashing_impl::HashMethodBase<Self, Value, Mapped, false>;
+    using KeyHolderType =
+            std::conditional_t<keys_pre_serialized, ArenaKeyHolder, SerializedKeyHolder>;
 
     ColumnRawPtrs key_columns;
     size_t keys_size;
+    const StringRef* keys;
 
     HashMethodSerialized(const ColumnRawPtrs& key_columns_, const Sizes& /*key_sizes*/,
                          const HashMethodContextPtr&)
             : key_columns(key_columns_), keys_size(key_columns_.size()) {}
 
+    void set_serialized_keys(StringRef* keys_) { keys = keys_; }

Review Comment:
   Maybe we can add const here.



-- 
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-unsubscribe@doris.apache.org

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


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