From: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Martin Kalcher <martin(dot)kalcher(at)aboutsource(dot)net>, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, Andres Freund <andres(at)anarazel(dot)de>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, John Naylor <john(dot)naylor(at)enterprisedb(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: [PATCH] Introduce array_shuffle() and array_sample() |
Date: | 2023-04-03 21:25:39 |
Message-ID: | 110FCCA3-8159-4A06-9876-815D8E5218C9@yesql.se |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
> On 29 Sep 2022, at 21:33, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Martin Kalcher <martin(dot)kalcher(at)aboutsource(dot)net> writes:
>> New patch: array_shuffle() and array_sample() use pg_global_prng_state now.
>
> I took a closer look at the patch today.
Since this seems pretty close to going in, and seems like quite useful
functions, I took a look to see if I could get it across the line (although I
noticed that CFM beat me to the clock in sending this =)).
> I find this behavior a bit surprising:
>
> +SELECT array_dims(array_sample('[-1:2][2:3]={{1,2},{3,NULL},{5,6},{7,8}}'::int[], 3));
> + array_dims
> +-------------
> + [-1:1][2:3]
> +(1 row)
>
> I can buy preserving the lower bound in array_shuffle(), but
> array_sample() is not preserving the first-dimension indexes of
> the array, so ISTM it ought to reset the first lower bound to 1.
I might be daft but I'm not sure I follow why not preserving here, can you
explain?
The rest of your comments have been addressed in the attached v6 I think
(although I'm pretty sure the docs part is just as bad now, explaining these in
concise words is hard, will take another look with fresh eyes tomorrow).
--
Daniel Gustafsson
Attachment | Content-Type | Size |
---|---|---|
v6-0001-Introduce-array_shuffle-and-array_sample.patch | application/octet-stream | 10.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2023-04-03 21:46:57 | Re: [PATCH] Introduce array_shuffle() and array_sample() |
Previous Message | Gregory Stark (as CFM) | 2023-04-03 21:16:22 | Re: [PATCH] Introduce array_shuffle() and array_sample() |
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2023-04-03 21:26:09 | Re: zstd compression for pg_dump |
Previous Message | Gregory Stark (as CFM) | 2023-04-03 21:16:22 | Re: [PATCH] Introduce array_shuffle() and array_sample() |