From: | James Coleman <jtc331(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Teach predtest about IS [NOT] <boolean> proofs |
Date: | 2024-01-18 00:34:36 |
Message-ID: | CAAaqYe93AkueRS-=yH7VgD+6c2gz+ip=oW3nWSqZXmf-ieW4hQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Dec 22, 2023 at 2:48 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> James Coleman <jtc331(at)gmail(dot)com> writes:
> > I've not yet applied all of your feedback, but I wanted to get an
> > initial read on your thoughts on how using switch statements ends up
> > looking. Attached is a single (pure refactor) patch that converts the
> > various if/else levels that check things like node tag and
> > boolean/null test type into switch statements. I've retained 'default'
> > keyword usages for now for simplicity (my intuition is that we
> > generally prefer to list out all options for compiler safety benefits,
> > though I'm not 100% sure that's useful in the outer node tag check
> > since it's unlikely that someone adding a new node would modify
> > this...).
>
> > My big question is: are you comfortable with the indentation explosion
> > this creates? IMO it's a lot wordier, but it is also more obvious what
> > the structural goal is. I'm not sure how we want to make the right
> > trade-off though.
>
> Yeah, I see what you mean. Also, I'd wanted to shove most of
> the text in the function header in-line and get rid of the short
> restatements of those paras. I carried that through just for
> predicate_implied_by_simple_clause, as attached. The structure is
> definitely clearer, but we end up with an awful lot of indentation,
> which makes the comments less readable than I'd like. (I did some
> minor rewording to make them flow better.)
>
> On balance I think this is probably better than what we have, but
> maybe we'd be best off to avoid doubly nested switches? I think
> there's a good argument for the outer switch on nodeTag, but
> maybe we're getting diminishing returns from an inner switch.
>
> regards, tom lane
>
Apologies for the long delay.
Attached is a new patch series.
0001 does the initial pure refactor. 0003 makes a lot of modifications
to what we can prove about implication and refutation. Finally, 0003
isn't intended to be committed, but attempts to validate more
holistically that none of the changes creates any invalid proofs
beyond the mostly happy-path tests added in 0004.
I ended up not tackling changing how test_predtest tests run for now.
That's plausibly still useful, and I'd be happy to add that if you
generally agree with the direction of the patch and with that
abstraction being useful.
I added some additional verifications to the test_predtest module to
prevent additional obvious flaws.
Regards,
James Coleman
Attachment | Content-Type | Size |
---|---|---|
v4-0003-Add-temporary-all-permutations-test.patch | application/octet-stream | 32.9 KB |
v4-0001-Use-switch-statements-in-predicate_-implied-refut.patch | application/octet-stream | 14.6 KB |
v4-0002-Teach-predtest.c-about-BooleanTest.patch | application/octet-stream | 51.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | David Rowley | 2024-01-18 00:34:46 | Re: Strange Bitmapset manipulation in DiscreteKnapsack() |
Previous Message | Cedric Villemain | 2024-01-18 00:25:41 | linux cachestat in file Readv and Prefetch |