apache / cloudberry

One advanced and mature open-source MPP (Massively Parallel Processing) database. Open source alternative to Greenplum Database.
https://cloudberry.apache.org
Apache License 2.0
417 stars 104 forks source link

Cherry-pick gporca commits to fix Bug 669 #708

Open leborchuk opened 1 week ago

leborchuk commented 1 week ago

Here I chery-picked

Jul 30, 2022 Fix qp_with_clause testcase without asserts (#13878) Oct 4, 2022 [ORCA] Avoid pushdown of predicate with set-returning function (#14201)

fix #669


Change logs

Describe your change clearly, including what problem is being solved or what feature is being added.

If it has some breaking backward or forward compatibility, please clary.

Why are the changes needed?

Describe why the changes are necessary.

Does this PR introduce any user-facing change?

If yes, please clarify the previous behavior and the change this PR proposes.

How was this patch tested?

Please detail how the changes were tested, including manual tests and any relevant unit or integration tests.

Contributor's Checklist

Here are some reminders and checklists before/when submitting your pull request, please check them:

leborchuk commented 1 week ago

Tests still failed - patch did not help

The good news it's stable reproduced in my dev env, script for it -

CREATE TABLE city (
    id integer NOT NULL,
    name text NOT NULL,
    countrycode character(3) NOT NULL,
    district text NOT NULL,
    population integer NOT NULL
) distributed by(id);

CREATE TABLE country (
    code character(3) NOT NULL,
    name text NOT NULL,
    continent text NOT NULL,
    region text NOT NULL,
    surfacearea numeric(10,2) NOT NULL,
    indepyear smallint,
    population integer NOT NULL,
    lifeexpectancy real,
    gnp numeric(10,2),
    gnpold numeric(10,2),
    localname text NOT NULL,
    governmentform text NOT NULL,
    headofstate text,
    capital integer,
    code2 character(2) NOT NULL
) distributed by (code);

CREATE TABLE countrylanguage (
    countrycode character(3) NOT NULL,
    "language" text NOT NULL,
    isofficial boolean NOT NULL,
    percentage real NOT NULL
)distributed by (countrycode,language);

with diversecountries as
(select country.code,country.name,country.capital,d.CNT
 from country,
 (select countrylanguage.countrycode,count(*) as CNT from countrylanguage group by countrycode
  HAVING count(*) > 6) d
 where d.countrycode = country.code and country.gnp > 100000)
select * from
(
select
(select max(CNT) from diversecountries where  diversecountries.code = country.code) CNT,country.name COUNTRY,city.name CAPITAL
from country,city where country.capital = city.id) FOO where FOO.CNT is not null;
leborchuk commented 1 week ago

Commit Oct 4, 2022 "[ORCA] Avoid pushdown of predicate with set-returning function (#14201)" fixed the issue

Tests in my dev env:

parallel group (8 tests):  qp_executor qp_bitmapscan qp_olap_windowerr qp_with_clause qp_misc_jiras qp_olap_window qp_derived_table qp_dropped_cols
     qp_misc_jiras                ... ok        57522 ms (diff  643 ms)
     qp_with_clause               ... ok        33078 ms (diff  914 ms)
     qp_executor                  ... ok          679 ms (diff  100 ms)
     qp_olap_windowerr            ... ok        12873 ms (diff  639 ms)
     qp_olap_window               ... ok        57660 ms (diff 7267 ms)
     qp_derived_table             ... ok        89545 ms (diff 11761 ms)
     qp_bitmapscan                ... ok         7488 ms (diff 1297 ms)
     qp_dropped_cols              ... ok       101175 ms (diff 1328 ms)

PR could be reviewed now

leborchuk commented 22 hours ago

I fixed the tests, but it may need to be run again. I cannot do it by myself (and force-push does not work).

my-ship-it commented 22 hours ago

I fixed the tests, but it may need to be run again. I cannot do it by myself (and force-push does not work).

No worries :). Already approve and return.