Re: [HACKERS] Hash support for grouping sets - Mailing list pgsql-hackers

From Mark Dilger
Subject Re: [HACKERS] Hash support for grouping sets
Date
Msg-id DB8AEAC1-83EB-4A4C-BD4A-6B5326FF9DBE@gmail.com
Whole thread Raw
In response to Re: [HACKERS] Hash support for grouping sets  (Mark Dilger <hornschnorter@gmail.com>)
Responses Re: [HACKERS] Hash support for grouping sets  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-hackers
Hi Andrew,

Reviewing the patch a bit more, I find it hard to understand the comment about
passing -1 as a flag for finalize_aggregates.  Any chance you can spend a bit
more time word-smithing that code comment?


@@ -1559,7 +1647,9 @@ prepare_projection_slot(AggState *aggstate, TupleTableSlot *slot, int currentSet/* * Compute the
finalvalue of all aggregates for one group. * 
- * This function handles only one grouping set at a time.
+ * This function handles only one grouping set at a time.  But in the hash
+ * case, it's the caller's responsibility to have selected the set already, and
+ * we pass in -1 here to flag that and to control the indexing into pertrans. * * Results are stored in the output
econtextaggvalues/aggnulls. */ 
@@ -1575,10 +1665,11 @@ finalize_aggregates(AggState *aggstate,   int         aggno;   int         transno;

-   Assert(currentSet == 0 ||
-          ((Agg *) aggstate->ss.ps.plan)->aggstrategy != AGG_HASHED);
-
-   aggstate->current_set = currentSet;
+   /* ugly hack for hash */
+   if (currentSet >= 0)
+       select_current_set(aggstate, currentSet, false);
+   else
+       currentSet = 0;


> On Mar 8, 2017, at 8:00 AM, Mark Dilger <hornschnorter@gmail.com> wrote:
>
>
>> On Mar 8, 2017, at 5:47 AM, Andrew Gierth <andrew@tao11.riddles.org.uk> wrote:
>>
>>>>>>> "Mark" == Mark Dilger <hornschnorter@gmail.com> writes:
>>
>> Mark> On my MacBook, `make check-world` gives differences in the
>> Mark> contrib modules:
>>
>> Thanks! Latest cleaned up version of patch is attached.
>
> This fixes both the warning and the contrib tests on linux and mac.
>




pgsql-hackers by date:

Previous
From: Andreas Karlsson
Date:
Subject: Re: [HACKERS] adding an immutable variant of to_date
Next
From: Pavel Stehule
Date:
Subject: Re: [HACKERS] patch: function xmltable