This is an automated email from the ASF dual-hosted git repository.
chenjinbao1989 pushed a commit to branch cbdb-postgres-merge
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
The following commit(s) were added to refs/heads/cbdb-postgres-merge by this
push:
new 043ea113995 Fix some answer files
043ea113995 is described below
commit 043ea113995dffaeb1c58033af975be8df23a32e
Author: Jinbao Chen <[email protected]>
AuthorDate: Sun Nov 23 23:10:34 2025 +0800
Fix some answer files
---
src/backend/nodes/copyfuncs.funcs.c | 21 ++++
src/backend/nodes/copyfuncs.switch.c | 4 +
src/test/regress/expected/aocs_sample.out | 4 +-
src/test/regress/expected/appendonly_sample.out | 4 +-
src/test/regress/expected/groupingsets.out | 156 ++++++++----------------
src/test/regress/expected/tablesample.out | 7 +-
src/test/regress/serial_schedule | 10 +-
src/test/regress/sql/groupingsets.sql | 3 -
src/test/regress/sql/tablesample.sql | 7 +-
9 files changed, 84 insertions(+), 132 deletions(-)
diff --git a/src/backend/nodes/copyfuncs.funcs.c
b/src/backend/nodes/copyfuncs.funcs.c
index 786098c15b1..02ee4d0f556 100644
--- a/src/backend/nodes/copyfuncs.funcs.c
+++ b/src/backend/nodes/copyfuncs.funcs.c
@@ -6727,3 +6727,24 @@ _copyCursorPosInfo(const CursorPosInfo *from)
return newnode;
}
+
+/*
+ * _copyPathTarget
+ */
+static PathTarget *
+_copyPathTarget(const PathTarget *from)
+{
+ PathTarget *newnode = makeNode(PathTarget);
+
+ COPY_NODE_FIELD(exprs);
+ if (from->sortgrouprefs)
+ {
+ int numCols = list_length(from->exprs);
+ if (numCols > 0)
+ COPY_POINTER_FIELD(sortgrouprefs, numCols *
sizeof(Index));
+ }
+ COPY_SCALAR_FIELD(cost);
+ COPY_SCALAR_FIELD(width);
+
+ return newnode;
+}
diff --git a/src/backend/nodes/copyfuncs.switch.c
b/src/backend/nodes/copyfuncs.switch.c
index cd010c03c10..2df2df3cfa4 100644
--- a/src/backend/nodes/copyfuncs.switch.c
+++ b/src/backend/nodes/copyfuncs.switch.c
@@ -1182,3 +1182,7 @@
case T_CursorPosInfo:
retval = _copyCursorPosInfo(from);
break;
+
+ case T_PathTarget:
+ retval = _copyPathTarget(from);
+ break;
diff --git a/src/test/regress/expected/aocs_sample.out
b/src/test/regress/expected/aocs_sample.out
index 3d687ac2ef0..d87ddcdd424 100644
--- a/src/test/regress/expected/aocs_sample.out
+++ b/src/test/regress/expected/aocs_sample.out
@@ -112,7 +112,7 @@ CREATE VIEW test_aocs_tablesample_append_v2 AS
--------+---------+-----------+----------+---------+---------+-------------
id | integer | | | | plain |
View definition:
- SELECT test_aocs_tablesample_append.id
+ SELECT id
FROM test_aocs_tablesample_append TABLESAMPLE system ((10 * 2)) REPEATABLE
(2);
\d+ test_aocs_tablesample_append_v2
@@ -121,7 +121,7 @@ View definition:
--------+---------+-----------+----------+---------+---------+-------------
id | integer | | | | plain |
View definition:
- SELECT test_aocs_tablesample_append.id
+ SELECT id
FROM test_aocs_tablesample_append TABLESAMPLE system (99);
-- check a sampled query doesn't affect cursor in progress
diff --git a/src/test/regress/expected/appendonly_sample.out
b/src/test/regress/expected/appendonly_sample.out
index 08069913c0d..5e79e96bfd7 100644
--- a/src/test/regress/expected/appendonly_sample.out
+++ b/src/test/regress/expected/appendonly_sample.out
@@ -112,7 +112,7 @@ CREATE VIEW test_tablesample_append_v2 AS
--------+---------+-----------+----------+---------+---------+-------------
id | integer | | | | plain |
View definition:
- SELECT test_tablesample_append.id
+ SELECT id
FROM test_tablesample_append TABLESAMPLE system ((10 * 2)) REPEATABLE (2);
\d+ test_tablesample_append_v2
@@ -121,7 +121,7 @@ View definition:
--------+---------+-----------+----------+---------+---------+-------------
id | integer | | | | plain |
View definition:
- SELECT test_tablesample_append.id
+ SELECT id
FROM test_tablesample_append TABLESAMPLE system (99);
-- check a sampled query doesn't affect cursor in progress
diff --git a/src/test/regress/expected/groupingsets.out
b/src/test/regress/expected/groupingsets.out
index 92413eac30a..b4a0711291c 100644
--- a/src/test/regress/expected/groupingsets.out
+++ b/src/test/regress/expected/groupingsets.out
@@ -513,12 +513,11 @@ select * from (
where x = 1 and q1 = 123;
QUERY PLAN
------------------------------------------------------------------------------------------
- Subquery Scan on ss
+ Gather Motion 3:1 (slice1; segments: 3)
Output: ss.x, ss.q1, ss.sum
- Filter: ((ss.x = 1) AND (ss.q1 = 123))
- -> Gather Motion 3:1 (slice1; segments: 3)
- Output: 1, i1.q1, (sum(i1.q2))
- Merge Key: i1.q1
+ -> Subquery Scan on ss
+ Output: ss.x, ss.q1, ss.sum
+ Filter: ((ss.x = 1) AND (ss.q1 = 123))
-> Finalize GroupAggregate
Output: (1), i1.q1, sum(i1.q2)
Group Key: 1, i1.q1, (GROUPINGSET_ID())
@@ -537,7 +536,7 @@ where x = 1 and q1 = 123;
Output: 1, i1.q1, i1.q2
Settings: enable_hashagg = 'off', optimizer = 'off'
Optimizer: Postgres query optimizer
-(24 rows)
+(23 rows)
select * from (
select 1 as x, q1, sum(q2)
@@ -555,7 +554,6 @@ select grouping(ss.x)
from int8_tbl i1
cross join lateral (select (select i1.q1) as x) ss
group by ss.x;
-<<<<<<< HEAD
QUERY PLAN
------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
@@ -577,22 +575,6 @@ group by ss.x;
Settings: enable_hashagg = 'off', optimizer = 'off'
Optimizer: Postgres query optimizer
(18 rows)
-=======
- QUERY PLAN
-------------------------------------------------
- GroupAggregate
- Output: GROUPING((SubPlan 1)), ((SubPlan 2))
- Group Key: ((SubPlan 2))
- -> Sort
- Output: ((SubPlan 2)), i1.q1
- Sort Key: ((SubPlan 2))
- -> Seq Scan on public.int8_tbl i1
- Output: (SubPlan 2), i1.q1
- SubPlan 2
- -> Result
- Output: i1.q1
-(11 rows)
->>>>>>> REL_16_9
select grouping(ss.x)
from int8_tbl i1
@@ -609,7 +591,6 @@ select (select grouping(ss.x))
from int8_tbl i1
cross join lateral (select (select i1.q1) as x) ss
group by ss.x;
-<<<<<<< HEAD
QUERY PLAN
------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
@@ -634,25 +615,6 @@ group by ss.x;
Settings: enable_hashagg = 'off', optimizer = 'off'
Optimizer: Postgres query optimizer
(21 rows)
-=======
- QUERY PLAN
---------------------------------------------
- GroupAggregate
- Output: (SubPlan 2), ((SubPlan 3))
- Group Key: ((SubPlan 3))
- -> Sort
- Output: ((SubPlan 3)), i1.q1
- Sort Key: ((SubPlan 3))
- -> Seq Scan on public.int8_tbl i1
- Output: (SubPlan 3), i1.q1
- SubPlan 3
- -> Result
- Output: i1.q1
- SubPlan 2
- -> Result
- Output: GROUPING((SubPlan 1))
-(14 rows)
->>>>>>> REL_16_9
select (select grouping(ss.x))
from int8_tbl i1
@@ -1715,22 +1677,26 @@ explain (costs off)
BEGIN;
SET LOCAL enable_hashagg = false;
EXPLAIN (COSTS OFF) SELECT a, b, count(*), max(a), max(b) FROM gstest3 GROUP
BY GROUPING SETS(a, b,()) ORDER BY a, b;
- QUERY PLAN
-------------------------------------------------------------------
- Finalize GroupAggregate
- Group Key: a, b, (GROUPINGSET_ID())
- -> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: a, b, (GROUPINGSET_ID())
- -> Sort
- Sort Key: a, b, (GROUPINGSET_ID())
- -> Partial GroupAggregate
- Group Key: a
- Group Key: ()
- Sort Key: b
- Group Key: b
- -> Index Scan using gstest3_pkey on gstest3
+ QUERY PLAN
+------------------------------------------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: a, b
+ -> Sort
+ Sort Key: a, b
+ -> Finalize GroupAggregate
+ Group Key: a, b, (GROUPINGSET_ID())
+ -> Sort
+ Sort Key: a, b, (GROUPINGSET_ID())
+ -> Redistribute Motion 3:3 (slice2; segments: 3)
+ Hash Key: a, b, (GROUPINGSET_ID())
+ -> Partial GroupAggregate
+ Group Key: a
+ Group Key: ()
+ Sort Key: b
+ Group Key: b
+ -> Index Scan using gstest3_pkey on gstest3
Optimizer: Postgres query optimizer
-(13 rows)
+(17 rows)
SELECT a, b, count(*), max(a), max(b) FROM gstest3 GROUP BY GROUPING SETS(a,
b,()) ORDER BY a, b;
a | b | count | max | max
@@ -1744,22 +1710,26 @@ SELECT a, b, count(*), max(a), max(b) FROM gstest3
GROUP BY GROUPING SETS(a, b,(
SET LOCAL enable_seqscan = false;
EXPLAIN (COSTS OFF) SELECT a, b, count(*), max(a), max(b) FROM gstest3 GROUP
BY GROUPING SETS(a, b,()) ORDER BY a, b;
- QUERY PLAN
-------------------------------------------------------------------
- Finalize GroupAggregate
- Group Key: a, b, (GROUPINGSET_ID())
- -> Gather Motion 3:1 (slice1; segments: 3)
- Merge Key: a, b, (GROUPINGSET_ID())
- -> Sort
- Sort Key: a, b, (GROUPINGSET_ID())
- -> Partial GroupAggregate
- Group Key: a
- Group Key: ()
- Sort Key: b
- Group Key: b
- -> Index Scan using gstest3_pkey on gstest3
+ QUERY PLAN
+------------------------------------------------------------------------------
+ Gather Motion 3:1 (slice1; segments: 3)
+ Merge Key: a, b
+ -> Sort
+ Sort Key: a, b
+ -> Finalize GroupAggregate
+ Group Key: a, b, (GROUPINGSET_ID())
+ -> Sort
+ Sort Key: a, b, (GROUPINGSET_ID())
+ -> Redistribute Motion 3:3 (slice2; segments: 3)
+ Hash Key: a, b, (GROUPINGSET_ID())
+ -> Partial GroupAggregate
+ Group Key: a
+ Group Key: ()
+ Sort Key: b
+ Group Key: b
+ -> Index Scan using gstest3_pkey on gstest3
Optimizer: Postgres query optimizer
-(13 rows)
+(17 rows)
SELECT a, b, count(*), max(a), max(b) FROM gstest3 GROUP BY GROUPING SETS(a,
b,()) ORDER BY a, b;
a | b | count | max | max
@@ -2009,7 +1979,6 @@ analyze bug_16784;
alter table bug_16784 set (autovacuum_enabled = 'false');
WARNING: autovacuum is not supported in Cloudberry
update pg_class set reltuples = 10 where relname='bug_16784';
-ERROR: permission denied: "pg_class" is a system catalog
insert into bug_16784 select g/10, g from generate_series(1,40) g;
set work_mem='64kB';
set enable_sort = false;
@@ -2206,7 +2175,6 @@ analyze gs_data_1;
alter table gs_data_1 set (autovacuum_enabled = 'false');
WARNING: autovacuum is not supported in Cloudberry
update pg_class set reltuples = 10 where relname='gs_data_1';
-ERROR: permission denied: "pg_class" is a system catalog
set work_mem='64kB';
-- Produce results with sorting.
set enable_sort = true;
@@ -2276,12 +2244,8 @@ group by cube (g1000,g100,g10) distributed by (g1000);
set jit_above_cost to default;
set enable_sort = true;
set work_mem to default;
-<<<<<<< HEAD
--- Compare results of ORCA plan that relies on "IS NOT DISTINCT FROM" HASH Join
-=======
set hash_mem_multiplier to default;
--- Compare results
->>>>>>> REL_16_9
+-- Compare results of ORCA plan that relies on "IS NOT DISTINCT FROM" HASH Join
(select * from gs_hash_1 except select * from gs_group_1)
union all
(select * from gs_group_1 except select * from gs_hash_1);
@@ -2406,32 +2370,18 @@ order by a, b, c;
-- test handling of outer GroupingFunc within subqueries
explain (costs off)
select (select grouping(v1)) from (values ((select 1))) v(v1) group by
cube(v1);
-<<<<<<< HEAD
- QUERY PLAN
+ QUERY PLAN
-------------------------------------
MixedAggregate
Hash Key: $2
Group Key: ()
-=======
- QUERY PLAN
----------------------------
- MixedAggregate
- Hash Key: $2
- Group Key: ()
- InitPlan 1 (returns $1)
- -> Result
->>>>>>> REL_16_9
InitPlan 3 (returns $2)
-> Result
-> Result
SubPlan 2
-> Result
-<<<<<<< HEAD
Optimizer: Postgres query optimizer
(9 rows)
-=======
-(10 rows)
->>>>>>> REL_16_9
select (select grouping(v1)) from (values ((select 1))) v(v1) group by
cube(v1);
grouping
@@ -2442,13 +2392,9 @@ select (select grouping(v1)) from (values ((select 1)))
v(v1) group by cube(v1);
explain (costs off)
select (select grouping(v1)) from (values ((select 1))) v(v1) group by v1;
- QUERY PLAN
----------------------------
+ QUERY PLAN
+-------------------------------------
GroupAggregate
-<<<<<<< HEAD
- Group Key: $2
-=======
->>>>>>> REL_16_9
InitPlan 1 (returns $1)
-> Result
InitPlan 3 (returns $2)
@@ -2456,11 +2402,8 @@ select (select grouping(v1)) from (values ((select 1)))
v(v1) group by v1;
-> Result
SubPlan 2
-> Result
-<<<<<<< HEAD
+ Optimizer: Postgres query optimizer
(9 rows)
-=======
-(8 rows)
->>>>>>> REL_16_9
select (select grouping(v1)) from (values ((select 1))) v(v1) group by v1;
grouping
@@ -2468,7 +2411,6 @@ select (select grouping(v1)) from (values ((select 1)))
v(v1) group by v1;
0
(1 row)
-<<<<<<< HEAD
select a, rank(a+3) within group (order by b nulls last)
from (values (1,1),(1,4),(1,5),(3,1),(3,2)) v(a,b)
group by rollup (a) order by a;
@@ -2514,6 +2456,4 @@ group by rollup (a,b) order by a;
| | 6
(8 rows)
-=======
->>>>>>> REL_16_9
-- end
diff --git a/src/test/regress/expected/tablesample.out
b/src/test/regress/expected/tablesample.out
index 36acf7b4a9e..ee69f3aa3af 100644
--- a/src/test/regress/expected/tablesample.out
+++ b/src/test/regress/expected/tablesample.out
@@ -131,13 +131,8 @@ View definition:
-- check a sampled query doesn't affect cursor in progress
BEGIN;
-<<<<<<< HEAD
-DECLARE tablesample_cur CURSOR FOR
- SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (50) REPEATABLE (0) ORDER
BY id;
-=======
DECLARE tablesample_cur SCROLL CURSOR FOR
- SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (50) REPEATABLE (0);
->>>>>>> REL_16_9
+ SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (50) REPEATABLE (0) ORDER
BY id;
FETCH FIRST FROM tablesample_cur;
id
----
diff --git a/src/test/regress/serial_schedule b/src/test/regress/serial_schedule
index a64936e87fd..b404d439942 100644
--- a/src/test/regress/serial_schedule
+++ b/src/test/regress/serial_schedule
@@ -117,11 +117,11 @@ test: lock
test: replica_identity
test: rowsecurity
test: object_address
-# test: tablesample
-# test: task
-# test: appendonly_sample
-# test: aocs_sample
-# test: groupingsets
+test: tablesample
+test: task
+test: appendonly_sample
+test: aocs_sample
+test: groupingsets
# test: drop_operator
# test: password
# test: identity
diff --git a/src/test/regress/sql/groupingsets.sql
b/src/test/regress/sql/groupingsets.sql
index 995df185b25..a0a0fe14c80 100644
--- a/src/test/regress/sql/groupingsets.sql
+++ b/src/test/regress/sql/groupingsets.sql
@@ -701,7 +701,6 @@ explain (costs off)
select (select grouping(v1)) from (values ((select 1))) v(v1) group by v1;
select (select grouping(v1)) from (values ((select 1))) v(v1) group by v1;
-<<<<<<< HEAD
select a, rank(a+3) within group (order by b nulls last)
from (values (1,1),(1,4),(1,5),(3,1),(3,2)) v(a,b)
group by rollup (a) order by a;
@@ -718,6 +717,4 @@ select a, b, rank(b) within group (order by b nulls last)
from (values (1,1),(1,4),(1,5),(3,1),(3,2)) v(a,b)
group by rollup (a,b) order by a;
-=======
->>>>>>> REL_16_9
-- end
diff --git a/src/test/regress/sql/tablesample.sql
b/src/test/regress/sql/tablesample.sql
index 8d5cbf5b30e..9dd57f6e949 100644
--- a/src/test/regress/sql/tablesample.sql
+++ b/src/test/regress/sql/tablesample.sql
@@ -29,13 +29,8 @@ CREATE VIEW test_tablesample_v2 AS
-- check a sampled query doesn't affect cursor in progress
BEGIN;
-<<<<<<< HEAD
-DECLARE tablesample_cur CURSOR FOR
- SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (50) REPEATABLE (0) ORDER
BY id;
-=======
DECLARE tablesample_cur SCROLL CURSOR FOR
- SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (50) REPEATABLE (0);
->>>>>>> REL_16_9
+ SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (50) REPEATABLE (0) ORDER
BY id;
FETCH FIRST FROM tablesample_cur;
FETCH NEXT FROM tablesample_cur;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]