Github user hbdeshmukh commented on a diff in the pull request:
https://github.com/apache/incubator-quickstep/pull/121#discussion_r84793516
--- Diff: storage/AggregationOperationState.hpp ---
@@ -172,12 +173,44 @@ class AggregationOperationState {
**/
void destroyAggregationHashTablePayload();
+ /**
+ * @brief Generate the final results for the aggregates managed by this
+ * AggregationOperationState and write them out to
StorageBlock(s).
+ * In this implementation, each thread picks a hash table
belonging to
+ * a partition and writes its values to StorageBlock(s). There is
no
+ * need to merge multiple hash tables in one, because there is no
+ * overlap in the keys across two hash tables.
+ *
+ * @param partition_id The ID of the partition for which finalize is
being
+ * performed.
+ * @param output_destination An InsertDestination where the finalized
output
+ * tuple(s) from this aggregate are to be written.
+ **/
+ void finalizeAggregatePartitioned(
+ const std::size_t partition_id, InsertDestination
*output_destination);
+
static void mergeGroupByHashTables(AggregationStateHashTableBase *src,
AggregationStateHashTableBase *dst);
+ bool isAggregatePartitioned() const {
+ return is_aggregate_partitioned_;
+ }
+
+ /**
+ * @note This method is relevant only when the aggregate is partitioned.
+ **/
+ std::size_t getNumPartitions() const {
+ return is_aggregate_partitioned_
+ ? partitioned_group_by_hashtable_pool_->getNumPartitions()
+ : 1;
+ }
+
int dflag;
private:
+ static constexpr std::size_t kPartitionedAggregateThreshold = 100;
+ static constexpr std::size_t kNumPartitionsForAggregate = 40;
--- End diff --
Convert these two constants to GFLAG arguments. That will allow us to
experiment with an optimal configuration.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---