gfphoenix78 commented on code in PR #1056:
URL: https://github.com/apache/cloudberry/pull/1056#discussion_r2126094059


##########
src/include/lib/simplehash.h:
##########
@@ -169,6 +170,14 @@ typedef struct SH_TYPE
 
        /* user defined data, useful for callbacks */
        void       *private_data;
+
+       /*
+        * number of times hash table is expanded
+        *
+        * Since the max size of hash table is UINT32_MAX, uint32 is good
+        * enough for the number of expanded times.
+        */
+       uint32 num_expansions;

Review Comment:
   The new field may be put after `grow_threshold`, so it will be saved at the 
previous padding bytes.



##########
src/backend/executor/nodeAgg.c:
##########
@@ -481,6 +481,8 @@ static void build_pertrans_for_aggref(AggStatePerTrans 
pertrans,
 
 static void ExecEagerFreeAgg(AggState *node);
 
+void agg_hash_explain_extra_message(AggState *aggstate);

Review Comment:
   Make it a static function?



##########
src/include/lib/simplehash.h:
##########
@@ -580,6 +597,7 @@ SH_GROW(SH_TYPE * tb, uint64 newsize)
                }
        }
 
+       (tb->num_expansions)++;

Review Comment:
   There is no need to wrap the expression in `()`.



##########
src/include/lib/simplehash.h:
##########
@@ -1120,6 +1138,69 @@ SH_STAT(SH_TYPE * tb)
                   total_collisions, max_collisions, avg_collisions);
 }
 
+/*
+ * Greenplum specific
+ *
+ * Collect some statistics about the state of the hashtable. Major code was
+ * copied from SH_STAT() with some modifications to keep consistent with GPDB6.
+ */
+SH_SCOPE void

Review Comment:
   Use `static inline` function? The function is defined in the header file.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to