public inbox for [email protected]  
help / color / mirror / Atom feed
From: g l <[email protected]>
To: [email protected] <[email protected]>
Subject:  回复: are the 2 if-statements in join_is_legal() removable?
Date: Sun, 11 May 2025 08:26:38 +0000
Message-ID: <SY6P282MB3797A6DF372EAB398EFA5D6EDA94A@SY6P282MB3797.AUSP282.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <[email protected]>
References: <SY6P282MB3797B4D591EE5A3953F40C9EDA95A@SY6P282MB3797.AUSP282.PROD.OUTLOOK.COM>
	<[email protected]>


Hi Tom:
Thanks for your reply! I add  logs like this:
            if (bms_is_subset(sjinfo->min_lefthand, rel1->relids) &&
                  bms_is_subset(sjinfo->min_righthand, rel2->relids))
            {
                  if (match_sjinfo) {
                        elog(LOG, "gunkris111111111111");
                        return false;     /* invalid join path */
                  }
                  match_sjinfo = sjinfo;
                  reversed = false;
            }
            else if (bms_is_subset(sjinfo->min_lefthand, rel2->relids) &&
                         bms_is_subset(sjinfo->min_righthand, rel1->relids))
            {
                  if (match_sjinfo) {
                        elog(LOG, "gunkris222222222222");
                        return false;     /* invalid join path */
                  }
                  match_sjinfo = sjinfo;
                  reversed = true;
            }
            else if (sjinfo->jointype == JOIN_SEMI &&
                         bms_equal(sjinfo->syn_righthand, rel2->relids) &&
                         create_unique_path(root, rel2, rel2->cheapest_total_path,
                                                      sjinfo) != NULL)
            {

                  if (match_sjinfo) {
                        elog(LOG, "gunkris33333333333333");
                        return false;     /* invalid join path */
                  }
                  match_sjinfo = sjinfo;
                  reversed = false;
                  unique_ified = true;
            }
            else if (sjinfo->jointype == JOIN_SEMI &&
                         bms_equal(sjinfo->syn_righthand, rel1->relids) &&
                         create_unique_path(root, rel1, rel1->cheapest_total_path,
                                                      sjinfo) != NULL)
            {
                  /* Reversed semijoin case */
                  if (match_sjinfo) {
                        elog(LOG, "gunkris4444444444444444");
                        return false;     /* invalid join path */
                  }
                  match_sjinfo = sjinfo;
                  reversed = true;
                  unique_ified = true;
            }
Then I run the core regression tests with "make installcheck-parallel
" for v18beta1 as the document dictates. When the regression test is done, only the last 2 log entries are found in logfile, the first 2 entries are not printed at all. I run core regression also with v14.15 and v17.2, the results are the same. What test suite do I need to run to cover the first 2 branches, or could you please show me a example query that can cover them? Thank you very much.

________________________________
发件人: Tom Lane <[email protected]>
发送时间: 2025年5月10日 18:47
收件人: g l <[email protected]>
抄送: [email protected] <[email protected]>
主题: Re: are the 2 if-statements in join_is_legal() removable?

g l <[email protected]> writes:
> In join_is_legal(), there are 2 decision-making statements based on match_sjinfo. I    wonder wether their conditions can ever test possitive.

The code coverage report says yes.

https://coverage.postgresql.org/src/backend/optimizer/path/joinrels.c.gcov.html#350

                        regards, tom lane


view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re:  回复: are the 2 if-statements in join_is_legal() removable?
  In-Reply-To: <SY6P282MB3797A6DF372EAB398EFA5D6EDA94A@SY6P282MB3797.AUSP282.PROD.OUTLOOK.COM>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox