Skip to content

Commit 12174a9

Browse files
committed
Fix some answer files for pax
1 parent 38768ab commit 12174a9

11 files changed

Lines changed: 217 additions & 251 deletions

File tree

contrib/pax_storage/src/test/regress/expected/btree_index.out

Lines changed: 74 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,58 @@
11
--
22
-- BTREE_INDEX
3+
--
4+
-- directory paths are passed to us in environment variables
5+
\getenv abs_srcdir PG_ABS_SRCDIR
6+
CREATE TABLE bt_i4_heap (
7+
seqno int4,
8+
random int4
9+
);
10+
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'seqno' as the Apache Cloudberry data distribution key for this table.
11+
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
12+
CREATE TABLE bt_name_heap (
13+
seqno name,
14+
random int4
15+
);
16+
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'seqno' as the Apache Cloudberry data distribution key for this table.
17+
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
18+
CREATE TABLE bt_txt_heap (
19+
seqno text,
20+
random int4
21+
);
22+
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'seqno' as the Apache Cloudberry data distribution key for this table.
23+
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
24+
CREATE TABLE bt_f8_heap (
25+
seqno float8,
26+
random int4
27+
);
28+
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'seqno' as the Apache Cloudberry data distribution key for this table.
29+
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
30+
\set filename :abs_srcdir '/data/desc.data'
31+
COPY bt_i4_heap FROM :'filename';
32+
\set filename :abs_srcdir '/data/hash.data'
33+
COPY bt_name_heap FROM :'filename';
34+
\set filename :abs_srcdir '/data/desc.data'
35+
COPY bt_txt_heap FROM :'filename';
36+
\set filename :abs_srcdir '/data/hash.data'
37+
COPY bt_f8_heap FROM :'filename';
38+
ANALYZE bt_i4_heap;
39+
ANALYZE bt_name_heap;
40+
ANALYZE bt_txt_heap;
41+
ANALYZE bt_f8_heap;
42+
--
43+
-- BTREE ascending/descending cases
44+
--
45+
-- we load int4/text from pure descending data (each key is a new
46+
-- low key) and name/f8 from pure ascending data (each key is a new
47+
-- high key). we had a bug where new low keys would sometimes be
48+
-- "lost".
49+
--
50+
CREATE INDEX bt_i4_index ON bt_i4_heap USING btree (seqno int4_ops);
51+
CREATE INDEX bt_name_index ON bt_name_heap USING btree (seqno name_ops);
52+
CREATE INDEX bt_txt_index ON bt_txt_heap USING btree (seqno text_ops);
53+
CREATE INDEX bt_f8_index ON bt_f8_heap USING btree (seqno float8_ops);
54+
--
55+
-- BTREE_INDEX
356
-- test retrieval of min/max keys for each index
457
--
558
SELECT b.*
@@ -206,7 +259,7 @@ reset enable_sort;
206259
-- Also check LIKE optimization with binary-compatible cases
207260
create temp table btree_bpchar (f1 text collate "C");
208261
create index on btree_bpchar(f1 bpchar_ops) WITH (deduplicate_items=on);
209-
insert into btree_bpchar values ('foo'), ('foo '), ('fool'), ('bar'), ('quux');
262+
insert into btree_bpchar values ('foo'), ('fool'), ('bar'), ('quux');
210263
-- doesn't match index:
211264
explain (costs off)
212265
select * from btree_bpchar where f1 like 'foo';
@@ -233,12 +286,11 @@ select * from btree_bpchar where f1 like 'foo%';
233286
(3 rows)
234287

235288
select * from btree_bpchar where f1 like 'foo%';
236-
f1
237-
-------
238-
foo
289+
f1
290+
------
239291
foo
240292
fool
241-
(3 rows)
293+
(2 rows)
242294

243295
-- these do match the index:
244296
explain (costs off)
@@ -267,49 +319,30 @@ select * from btree_bpchar where f1::bpchar like 'foo%';
267319
Filter: ((f1)::bpchar ~~ 'foo%'::text)
268320
-> Bitmap Index Scan on btree_bpchar_f1_idx
269321
Index Cond: (((f1)::bpchar >= 'foo'::bpchar) AND ((f1)::bpchar < 'fop'::bpchar))
270-
(5 rows)
271-
272-
select * from btree_bpchar where f1::bpchar like 'foo%';
273-
f1
274-
-------
275-
foo
276-
fool
277-
foo
278-
(3 rows)
279-
280-
explain (costs off)
281-
select * from btree_bpchar where f1::bpchar ='foo';
282-
QUERY PLAN
283-
----------------------------------------------------------
284-
Gather Motion 3:1 (slice1; segments: 3)
285-
-> Bitmap Heap Scan on btree_bpchar
286-
Recheck Cond: ((f1)::bpchar = 'foo'::bpchar)
287-
-> Bitmap Index Scan on btree_bpchar_f1_idx
288-
Index Cond: ((f1)::bpchar = 'foo'::bpchar)
289322
Optimizer: Postgres query optimizer
290323
(6 rows)
291324

292-
select * from btree_bpchar where f1::bpchar ='foo';
293-
f1
294-
-------
295-
foo
325+
select * from btree_bpchar where f1::bpchar like 'foo%';
326+
f1
327+
------
296328
foo
329+
fool
297330
(2 rows)
298331

299332
-- get test coverage for "single value" deduplication strategy:
300333
insert into btree_bpchar select 'foo' from generate_series(1,1500);
301334
--
302335
-- Perform unique checking, with and without the use of deduplication
303336
--
304-
CREATE TABLE dedup_unique_test_table (a int) WITH (autovacuum_enabled=false);
337+
CREATE TABLE dedup_unique_test_table (a int);
305338
CREATE UNIQUE INDEX dedup_unique ON dedup_unique_test_table (a) WITH (deduplicate_items=on);
306339
CREATE UNIQUE INDEX plain_unique ON dedup_unique_test_table (a) WITH (deduplicate_items=off);
307340
-- Generate enough garbage tuples in index to ensure that even the unique index
308341
-- with deduplication enabled has to check multiple leaf pages during unique
309342
-- checking (at least with a BLCKSZ of 8192 or less)
310343
DO $$
311344
BEGIN
312-
FOR r IN 1..1350 LOOP
345+
FOR r IN 1..50 LOOP
313346
DELETE FROM dedup_unique_test_table;
314347
INSERT INTO dedup_unique_test_table SELECT 1;
315348
END LOOP;
@@ -355,7 +388,8 @@ VACUUM delete_test_table;
355388
--
356389
-- The vacuum above should've turned the leaf page into a fast root. We just
357390
-- need to insert some rows to cause the fast root page to split.
358-
INSERT INTO delete_test_table SELECT i, 1, 2, 3 FROM generate_series(1,1000) i;
391+
-- Pax not support IndexDeleteTuples
392+
-- INSERT INTO delete_test_table SELECT i, 1, 2, 3 FROM generate_series(1,1000) i;
359393
--
360394
-- GPDB: Test correctness of B-tree stats in consecutively VACUUM.
361395
--
@@ -383,8 +417,9 @@ SELECT reltuples FROM pg_class WHERE relname='btree_stats_idx';
383417
0
384418
(1 row)
385419

386-
-- 1st VACUUM, expect reltuples = 2
387-
vacuum btree_stats_tbl;
420+
-- 1st ANALYZE, expect reltuples = 2
421+
-- Pax not support VACUUM yet, replace VACUUM with ANALYZE
422+
ANALYZE btree_stats_tbl;
388423
SELECT reltuples FROM pg_class WHERE relname='btree_stats_tbl';
389424
reltuples
390425
-----------
@@ -406,8 +441,8 @@ SELECT reltuples FROM pg_class WHERE relname='btree_stats_idx';
406441
2
407442
(1 row)
408443

409-
-- 2nd VACUUM, expect reltuples = 2
410-
vacuum btree_stats_tbl;
444+
-- 2nd ANALYZE, expect reltuples = 2
445+
ANALYZE btree_stats_tbl;
411446
SELECT reltuples FROM pg_class WHERE relname='btree_stats_tbl';
412447
reltuples
413448
-----------
@@ -443,42 +478,8 @@ SELECT reltuples FROM pg_class WHERE relname='btree_stats_idx';
443478
-- from the 3rd time of consecutively VACUUM after fresh inserts due to above skipping index scan
444479
-- criteria.
445480
-- 3rd VACUUM, expect reltuples = 2
446-
vacuum btree_stats_tbl;
447-
SELECT reltuples FROM pg_class WHERE relname='btree_stats_tbl';
448-
reltuples
449-
-----------
450-
2
451-
(1 row)
452-
481+
-- VACUUM btree_stats_tbl;
482+
-- SELECT reltuples FROM pg_class WHERE relname='btree_stats_tbl';
453483
-- inspect the state of the stats on segments
454-
SELECT gp_segment_id, relname, reltuples FROM gp_dist_random('pg_class') WHERE relname = 'btree_stats_idx';
455-
gp_segment_id | relname | reltuples
456-
---------------+-----------------+-----------
457-
0 | btree_stats_idx | 1
458-
1 | btree_stats_idx | 1
459-
2 | btree_stats_idx | 0
460-
(3 rows)
461-
462-
SELECT reltuples FROM pg_class WHERE relname='btree_stats_idx';
463-
reltuples
464-
-----------
465-
2
466-
(1 row)
467-
468-
-- Test unsupported btree opclass parameters
469-
create index on btree_tall_tbl (id int4_ops(foo=1));
470-
ERROR: operator class int4_ops has no options
471-
-- Test case of ALTER INDEX with abuse of column names for indexes.
472-
-- This grammar is not officially supported, but the parser allows it.
473-
CREATE INDEX btree_tall_idx2 ON btree_tall_tbl (id);
474-
ALTER INDEX btree_tall_idx2 ALTER COLUMN id SET (n_distinct=100);
475-
ERROR: ALTER action ALTER COLUMN ... SET cannot be performed on relation "btree_tall_idx2"
476-
DETAIL: This operation is not supported for indexes.
477-
DROP INDEX btree_tall_idx2;
478-
-- Partitioned index
479-
CREATE TABLE btree_part (id int4) PARTITION BY RANGE (id);
480-
CREATE INDEX btree_part_idx ON btree_part(id);
481-
ALTER INDEX btree_part_idx ALTER COLUMN id SET (n_distinct=100);
482-
ERROR: ALTER action ALTER COLUMN ... SET cannot be performed on relation "btree_part_idx"
483-
DETAIL: This operation is not supported for partitioned indexes.
484-
DROP TABLE btree_part;
484+
-- SELECT gp_segment_id, relname, reltuples FROM gp_dist_random('pg_class') WHERE relname = 'btree_stats_idx';
485+
-- SELECT reltuples FROM pg_class WHERE relname='btree_stats_idx';

contrib/pax_storage/src/test/regress/expected/gin.out

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
-- There are other tests to test different GIN opclasses. This is for testing
55
-- GIN itself.
66
-- Create and populate a test table with a GIN index.
7-
create table gin_test_tbl(i int4[]) with (autovacuum_enabled = off);
7+
create table gin_test_tbl(i int4[]);
88
create index gin_test_idx on gin_test_tbl using gin (i)
99
with (fastupdate = on, gin_pending_list_limit = 4096);
1010
insert into gin_test_tbl select array[1, 2, g] from generate_series(1, 20000) g;
@@ -20,12 +20,13 @@ select gin_clean_pending_list('gin_test_idx')>10 as many; -- flush the fastupdat
2020

2121
insert into gin_test_tbl select array[3, 1, g] from generate_series(1, 1000) g;
2222
vacuum gin_test_tbl; -- flush the fastupdate buffers
23+
-- PAX have not impl vacuum yet
2324
select gin_clean_pending_list('gin_test_idx'); -- nothing to flush
2425
gin_clean_pending_list
2526
------------------------
26-
0
27-
0
28-
0
27+
1
28+
1
29+
1
2930
(3 rows)
3031

3132
-- Test vacuuming

contrib/pax_storage/src/test/regress/expected/groupingsets.out

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1969,8 +1969,7 @@ select v||'a', case when grouping(v||'a') = 1 then 1 else 0 end, count(*)
19691969
-- Bug #16784
19701970
create table bug_16784(i int, j int);
19711971
analyze bug_16784;
1972-
alter table bug_16784 set (autovacuum_enabled = 'false');
1973-
WARNING: autovacuum is not supported in Cloudberry
1972+
-- alter table bug_16784 set (autovacuum_enabled = 'false');
19741973
update pg_class set reltuples = 10 where relname='bug_16784';
19751974
ERROR: permission denied: "pg_class" is a system catalog
19761975
insert into bug_16784 select g/10, g from generate_series(1,40) g;
@@ -2166,8 +2165,7 @@ create table gs_data_1 as
21662165
select g%1000 as g1000, g%100 as g100, g%10 as g10, g
21672166
from generate_series(0,1999) g;
21682167
analyze gs_data_1;
2169-
alter table gs_data_1 set (autovacuum_enabled = 'false');
2170-
WARNING: autovacuum is not supported in Cloudberry
2168+
-- alter table gs_data_1 set (autovacuum_enabled = 'false');
21712169
update pg_class set reltuples = 10 where relname='gs_data_1';
21722170
ERROR: permission denied: "pg_class" is a system catalog
21732171
set work_mem='64kB';

contrib/pax_storage/src/test/regress/expected/rangefuncs.out

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,17 +1731,15 @@ select * from tt;
17311731
----+----------
17321732
1 | foo
17331733
2 | bar
1734-
3 | fool
1735-
4 | foolfool
1736-
5 | foolish
1737-
6 | barrish
17381734
7 | baz
17391735
8 | quux
17401736
9 | foolish
17411737
10 | barrish
1742-
11 | foolme
1743-
12 | barme
1744-
(12 rows)
1738+
4 | foolfool
1739+
5 | foolish
1740+
3 | fool
1741+
6 | barrish
1742+
(10 rows)
17451743

17461744
-- and rules work
17471745
create temp table tt_log(f1 int, data text);
@@ -2310,7 +2308,7 @@ select x from int8_tbl, extractq2(int8_tbl) f(x);
23102308
-> Nested Loop
23112309
Output: f.x
23122310
-> Seq Scan on public.int8_tbl
2313-
Output: int8_tbl.q1, int8_tbl.q2
2311+
Output: int8_tbl.q2
23142312
-> Function Scan on f
23152313
Output: f.x
23162314
Function Call: int8_tbl.q2

contrib/pax_storage/src/test/regress/expected/rowsecurity.out

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
-- Suppress NOTICE messages when users/groups don't exist
66
SET client_min_messages TO 'warning';
77
SET gp_enable_relsize_collection to on;
8-
set optimizer_trace_fallback to on;
8+
-- Pax filter will call the f_leak, then output is not right
9+
set pax_enable_sparse_filter to off;
910
DROP USER IF EXISTS regress_rls_alice;
1011
DROP USER IF EXISTS regress_rls_bob;
1112
DROP USER IF EXISTS regress_rls_carol;
@@ -1991,6 +1992,7 @@ DELETE FROM only t1 WHERE f_leak(b) RETURNING tableoid::regclass, *, t1;
19911992
NOTICE: f_leak => bbbbbb_updt
19921993
ERROR: not implemented yet on pax relations: TupleFetchRowVersion (seg0 slice1 127.0.1.1:7002 pid=1173366)
19931994
DELETE FROM t1 WHERE f_leak(b) RETURNING tableoid::regclass, *, t1;
1995+
NOTICE: f_leak => bcdbcd
19941996
NOTICE: f_leak => bbbbbb_updt
19951997
NOTICE: f_leak => defdef
19961998
ERROR: not implemented yet on pax relations: TupleFetchRowVersion (seg0 slice1 127.0.1.1:7002 pid=1173366)
@@ -3156,28 +3158,11 @@ NOTICE: f_leak => fgh_updt
31563158
NOTICE: f_leak => fgh_updt
31573159
a | b | c
31583160
---+---------------+-------------------
3159-
3 | cde_updt | regress_rls_carol
3160-
7 | fgh_updt | regress_rls_carol
3161-
2 | bcd_updt_updt | regress_rls_bob
3162-
4 | def_updt_updt | regress_rls_carol
31633161
6 | fgh_updt_updt | regress_rls_bob
3164-
8 | fgh_updt_updt | regress_rls_carol
3165-
(6 rows)
3166-
3167-
DELETE FROM x1 WHERE f_leak(b) RETURNING *;
3168-
NOTICE: f_leak => cde_updt
3169-
NOTICE: f_leak => fgh_updt
3170-
NOTICE: f_leak => bcd_updt_updt
3171-
NOTICE: f_leak => def_updt_updt
3172-
NOTICE: f_leak => fgh_updt_updt
3173-
NOTICE: f_leak => fgh_updt_updt
3174-
a | b | c
3175-
---+---------------+-------------------
31763162
3 | cde_updt | regress_rls_carol
31773163
7 | fgh_updt | regress_rls_carol
31783164
2 | bcd_updt_updt | regress_rls_bob
31793165
4 | def_updt_updt | regress_rls_carol
3180-
6 | fgh_updt_updt | regress_rls_bob
31813166
8 | fgh_updt_updt | regress_rls_carol
31823167
(6 rows)
31833168

0 commit comments

Comments
 (0)