Fix outdated code comments in nodeAgg.c

Started by Zhang Mingli11 months ago4 messages
#1Zhang Mingli
zmlpostgres@gmail.com
1 attachment(s)

Hi,

By reading the codes in nodeAgg.c, I found that some comments are outdated.
The comments referred to the function lookup_hash_entry(), which has been removed in commit b563594.
I've adjusted the comments to refer to the correct function to make it clear.

--
Zhang Mingli
HashData

Attachments:

v0-0001-fix-update-outdated-comments-in-nodeAgg.c.patchapplication/octet-streamDownload
From 892252cfb311d6fec8520136d6f4739b0645be85 Mon Sep 17 00:00:00 2001
From: Zhang Mingli <avamingli@gmail.com>
Date: Sun, 9 Feb 2025 23:08:44 +0800
Subject: [PATCH] fix: update outdated comments in nodeAgg.c

Replaced references to the removed function lookup_hash_entry() in
comments with the appropriate current function.

Authored-by: Zhang Mingli avamingli@gmail.com
---
 src/backend/executor/nodeAgg.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index 3005b5c0e3..aa8de946ed 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -1453,7 +1453,7 @@ find_cols_walker(Node *node, FindColsContext *context)
  * To implement hashed aggregation, we need a hashtable that stores a
  * representative tuple and an array of AggStatePerGroup structs for each
  * distinct set of GROUP BY column values.  We compute the hash key from the
- * GROUP BY columns.  The per-group data is allocated in lookup_hash_entry(),
+ * GROUP BY columns.  The per-group data is allocated in initialize_hash_entry(),
  * for each entry.
  *
  * We have a separate hashtable and associated perhash data structure for each
@@ -1542,7 +1542,7 @@ build_hash_table(AggState *aggstate, int setno, long nbuckets)
  * at all.  Only columns of the first two types need to be stored in the
  * hashtable, and getting rid of the others can make the table entries
  * significantly smaller.  The hashtable only contains the relevant columns,
- * and is packed/unpacked in lookup_hash_entry() / agg_retrieve_hash_table()
+ * and is packed/unpacked in lookup_hash_entries() / agg_retrieve_hash_table()
  * into the format of the normal input descriptor.
  *
  * Additional columns, in addition to the columns grouped by, come from two
@@ -2077,8 +2077,6 @@ initialize_hash_entry(AggState *aggstate, TupleHashTable hashtable,
 /*
  * Look up hash entries for the current tuple in all hashed grouping sets.
  *
- * Be aware that lookup_hash_entry can reset the tmpcontext.
- *
  * Some entries may be left NULL if we are in "spill mode". The same tuple
  * will belong to different groups for each grouping set, so may match a group
  * already in memory for one set and match a group not in memory for another
-- 
2.34.1

#2Richard Guo
guofenglinux@gmail.com
In reply to: Zhang Mingli (#1)
Re: Fix outdated code comments in nodeAgg.c

On Sun, Feb 9, 2025 at 11:15 PM Zhang Mingli <zmlpostgres@gmail.com> wrote:

By reading the codes in nodeAgg.c, I found that some comments are outdated.
The comments referred to the function lookup_hash_entry(), which has been removed in commit b563594.
I've adjusted the comments to refer to the correct function to make it clear.

LGTM. This seems to be an oversight from 200f6100a, in which the
function lookup_hash_entry() was removed.

Thanks
Richard

#3Zhang Mingli
zmlpostgres@gmail.com
In reply to: Richard Guo (#2)
Re: Fix outdated code comments in nodeAgg.c

On Feb 10, 2025 at 16:45 +0800, Richard Guo <guofenglinux@gmail.com>, wrote:

On Sun, Feb 9, 2025 at 11:15 PM Zhang Mingli <zmlpostgres@gmail.com> wrote:

By reading the codes in nodeAgg.c, I found that some comments are outdated.
The comments referred to the function lookup_hash_entry(), which has been removed in commit b563594.
I've adjusted the comments to refer to the correct function to make it clear.

LGTM. This seems to be an oversight from 200f6100a, in which the
function lookup_hash_entry() was removed.

Thanks
Richard

Hi,

Thanks for review, added it to commitfest https://commitfest.postgresql.org/patch/5580/

--
Zhang Mingli
HashData

#4Jeff Davis
pgsql@j-davis.com
In reply to: Zhang Mingli (#3)
Re: Fix outdated code comments in nodeAgg.c

On Tue, 2025-02-18 at 20:11 +0800, Zhang Mingli wrote:

Thanks for review, added it to
commitfest https://commitfest.postgresql.org/patch/5580/

Committed. Thank you!

Regards,
Jeff Davis