Hi hackers.
On Wed, Jun 5, 2024 at 9:15?AM Fujii.Yuki@df.MitsubishiElectric.co.jp <Fujii.Yuki@df.mitsubishielectric.co.jp> wrote:
> Requirement2. Consider appropriate position of the new keyword "PARTIAL_AGGREGATE". (with Robert)
> Existing patch: Before the target expression. Ex. avg(PARTIAL_AGGREGATE c1)
> Ideal: Before the aggregate function. Ex. PARTIAL_AGGREGATE avg(c1)
> Requirement3. Consider to avoid to make the new keyword "PARTIAL_AGGREGATE" become a reserved word. (with Robert)
> In the existing patch, "PARTIAL_AGGREGATE" is a reserved word.
I considered the above two requirement.
Based on my research, there is no way to use PARTIAL_AGGREGATE in front of a function name without making it a reserved
word.
Instead, I can make PARTIAL_AGGREGATE an unreserved word by placing it after the FILTER clause, like avg(c1) FILTER
(WHEREc2 > 0) PARTIAL_AGGREGATE, and by marking it as an ASLABEL word like FILTER.
I attached the patch of the method.
If there are no objections, I would like to proceed with the method described above.
I'd appreciate it if anyone comment the method.
I have addressed several comments, though not all of them.
On Mon, Jun 24, 2024 at 6:09?PM Jelte Fennema-Nio <postgres@jeltef.nl> wrote:
> 4. Related to 3, I think it would be good to have some tests of
> PARTIAL_AGGREGATE that don't involve postgres_fdw at all. I also
> spotted some comments too that mention FDW, even though they apply to
> the "pure" PARTIAL_AGGREGATE code.
> 5. This comment now seems incorrect:
> - * Apply the agg's finalfn if one is provided, else return transValue.
> + * If the agg's finalfn is provided and PARTIAL_AGGREGATE keyword is
> + * not specified, apply the agg's finalfn.
> + * If PARTIAL_AGGREGATE keyword is specified and the transValue type
> + * is internal, apply the agg's serialfn. In this case the agg's
> + * serialfn must not be invalid. Otherwise return transValue.
>
> 6. These errors are not on purpose afaict (if they are a comment in
> the test would be good to explain why)
>
> +SELECT b, avg(a), max(a), count(*) FROM pagg_tab GROUP BY b ORDER BY 1;
> +ERROR: could not connect to server "loopback"
> +DETAIL: invalid connection option "partial_aggregate_support"
Fixed.
Best regards, Yuki Fujii
--
Yuki Fujii
Information Technology R&D Center, Mitsubishi Electric Corporation