You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "github-actions[bot] (via GitHub)" <gi...@apache.org> on 2023/04/17 14:45:30 UTC

[GitHub] [doris] github-actions[bot] commented on a diff in pull request #18051: [feature](agg) Support spill to disk in aggregation

github-actions[bot] commented on code in PR #18051:
URL: https://github.com/apache/doris/pull/18051#discussion_r1168831780


##########
be/src/vec/exec/vaggregation_node.h:
##########
@@ -974,6 +786,44 @@ struct AggregateDataContainer {
     bool _inited = false;
 };
 
+struct AggSpillContext {
+    bool has_data = false;
+    bool readers_prepared = false;
+
+    /// stream ids of writers/readers
+    std::vector<int64_t> stream_ids;
+    std::vector<BlockSpillReaderUPtr> readers;
+    RuntimeProfile* runtime_profile;
+
+    size_t read_cursor {};
+
+    Status prepare_for_reading();
+
+    ~AggSpillContext() {
+        for (auto& reader : readers) {
+            if (reader) {
+                reader->close();
+                reader.reset();
+            }
+        }
+    }
+};
+
+struct SpillPartitionHelper {
+    const size_t partition_count_bits;
+    const size_t partition_count;
+    const size_t max_partition_index;
+
+    SpillPartitionHelper(const size_t partition_count_bits_)
+            : partition_count_bits(partition_count_bits_),
+              partition_count(1 << partition_count_bits),
+              max_partition_index(partition_count - 1) {}
+
+    size_t get_index(size_t hash_value) {
+        return (hash_value >> (32 - partition_count_bits)) & max_partition_index;
+    }

Review Comment:
   warning: method 'get_index' can be made const [readability-make-member-function-const]
   
   ```suggestion
       size_t get_index(size_t hash_value) const {
   ```
   



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