Skip to content

Commit 76a83a1

Browse files
author
liushengsong
committed
fix all test
1 parent b7dffee commit 76a83a1

38 files changed

+3712
-1275
lines changed

src/test/regress/expected/aggregates_optimizer.out

Lines changed: 444 additions & 29 deletions
Large diffs are not rendered by default.

src/test/regress/expected/bfv_cte_optimizer.out

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,13 +512,17 @@ DETAIL: Falling back to Postgres-based planner because GPORCA does not support
512512
-- end_matchsubs
513513
-- Filter out irrelevant LOG messages from segments other than seg2.
514514
\! cat /tmp/bfv_cte.out | grep -P '^(?!LOG)|^(LOG.*seg2)' | grep -vP 'LOG.*fault|decreased xslice state refcount'
515+
SET
516+
SET
517+
SET
515518
LOG: SISC (shareid=0, slice=2): initialized xslice state (seg2 slice2 127.0.1.1:7004 pid=1048240)
516519
LOG: SISC READER (shareid=0, slice=2): wrote notify_done (seg2 slice2 127.0.1.1:7004 pid=1048240)
517520
LOG: SISC READER (shareid=0, slice=4): wrote notify_done (seg2 slice4 127.0.1.1:7004 pid=1048252)
518521
LOG: SISC WRITER (shareid=0, slice=1): No tuplestore yet, creating tuplestore (seg2 slice1 127.0.1.1:7004 pid=1048234)
519522
LOG: SISC WRITER (shareid=0, slice=1): wrote notify_ready (seg2 slice1 127.0.1.1:7004 pid=1048234)
520523
LOG: SISC WRITER (shareid=0, slice=1): got DONE message from 2 readers (seg2 slice1 127.0.1.1:7004 pid=1048234)
521524
LOG: SISC (shareid=0, slice=1): removed xslice state (seg2 slice1 127.0.1.1:7004 pid=1048234)
525+
SET
522526
a | a
523527
---+---
524528
1 | 2

src/test/regress/expected/bfv_joins_optimizer.out

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3526,6 +3526,7 @@ explain (costs off) select * from b, lateral (select * from a, c where b.i = a.i
35263526
---------------------------------------------------------------------------
35273527
Gather Motion 3:1 (slice1; segments: 3)
35283528
-> Nested Loop
3529+
Join Filter: ((a.i + b.i) = c.j)
35293530
-> Broadcast Motion 3:3 (slice2; segments: 3)
35303531
-> Seq Scan on b
35313532
-> Materialize
@@ -3537,7 +3538,7 @@ explain (costs off) select * from b, lateral (select * from a, c where b.i = a.i
35373538
-> Index Only Scan using c_j_i_idx on c
35383539
Index Cond: (j = (a.i + b.i))
35393540
Optimizer: Postgres query optimizer
3540-
(13 rows)
3541+
(14 rows)
35413542

35423543
select * from b, lateral (select * from a, c where b.i = a.i and (a.i + b.i) = c.j) as ac;
35433544
i | i | i | j

src/test/regress/expected/bitmap_index_optimizer.out

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,12 @@ WARNING: consider disabling FTS probes while injecting a panic.
722722
SET client_min_messages='ERROR';
723723
CREATE TABLE trigger_recovery_on_primaries(c int);
724724
RESET client_min_messages;
725+
SELECT pg_sleep(2);
726+
pg_sleep
727+
----------
728+
729+
(1 row)
730+
725731
-- reconnect to the database after restart
726732
\c
727733
SELECT gp_inject_fault('checkpoint', 'reset', dbid) FROM gp_segment_configuration WHERE role = 'p' AND content > -1;
@@ -732,6 +738,12 @@ SELECT gp_inject_fault('checkpoint', 'reset', dbid) FROM gp_segment_configuratio
732738
Success:
733739
(3 rows)
734740

741+
SELECT pg_sleep(2);
742+
pg_sleep
743+
----------
744+
745+
(1 row)
746+
735747
SELECT gp_inject_fault('finish_prepared_after_record_commit_prepared', 'reset', dbid) FROM gp_segment_configuration WHERE role = 'p' AND content > -1;
736748
gp_inject_fault
737749
-----------------

src/test/regress/expected/brin_multi_optimizer_1.out

Lines changed: 148 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ INSERT INTO brintest_multi SELECT
2929
(four + 1.0)/(hundred+1),
3030
odd::float8 / (tenthous + 1),
3131
format('%s:00:%s:00:%s:00', to_hex(odd), to_hex(even), to_hex(hundred))::macaddr,
32-
substr(md5(unique1::text), 1, 16)::macaddr8,
32+
substr(fipshash(unique1::text), 1, 16)::macaddr8,
3333
inet '10.2.3.4/24' + tenthous,
3434
cidr '10.2.3/24' + tenthous,
3535
date '1995-08-15' + tenthous,
@@ -179,7 +179,7 @@ INSERT INTO brinopers_multi VALUES
179179
('macaddr8col', 'macaddr8',
180180
'{>, >=, =, <=, <}',
181181
'{b1:d1:0e:7b:af:a4:42:12, d9:35:91:bd:f7:86:0e:1e, 72:8f:20:6c:2a:01:bf:57, 23:e8:46:63:86:07:ad:cb, 13:16:8e:6a:2e:6c:84:b4}',
182-
'{33, 15, 1, 13, 6}'),
182+
'{31, 17, 1, 11, 4}'),
183183
('inetcol', 'inet',
184184
'{=, <, <=, >, >=}',
185185
'{10.2.14.231/24, 255.255.255.255, 255.255.255.255, 0.0.0.0, 0.0.0.0}',
@@ -322,11 +322,11 @@ WARNING: did not get bitmap indexscan plan for (oidcol,>=,oid,0,100)
322322
WARNING: did not get seqscan plan for (oidcol,=,oid,8800,1)
323323
WARNING: did not get bitmap indexscan plan for (oidcol,<=,oid,9999,100)
324324
WARNING: did not get bitmap indexscan plan for (oidcol,<,oid,9999,100)
325-
WARNING: did not get bitmap indexscan plan for (macaddr8col,>,macaddr8,b1:d1:0e:7b:af:a4:42:12,33)
326-
WARNING: did not get bitmap indexscan plan for (macaddr8col,>=,macaddr8,d9:35:91:bd:f7:86:0e:1e,15)
325+
WARNING: did not get bitmap indexscan plan for (macaddr8col,<,macaddr8,13:16:8e:6a:2e:6c:84:b4,4)
326+
WARNING: did not get bitmap indexscan plan for (macaddr8col,<=,macaddr8,23:e8:46:63:86:07:ad:cb,11)
327327
WARNING: did not get bitmap indexscan plan for (macaddr8col,=,macaddr8,72:8f:20:6c:2a:01:bf:57,1)
328-
WARNING: did not get bitmap indexscan plan for (macaddr8col,<=,macaddr8,23:e8:46:63:86:07:ad:cb,13)
329-
WARNING: did not get bitmap indexscan plan for (macaddr8col,<,macaddr8,13:16:8e:6a:2e:6c:84:b4,6)
328+
WARNING: did not get bitmap indexscan plan for (macaddr8col,>,macaddr8,b1:d1:0e:7b:af:a4:42:12,31)
329+
WARNING: did not get bitmap indexscan plan for (macaddr8col,>=,macaddr8,d9:35:91:bd:f7:86:0e:1e,17)
330330
WARNING: did not get seqscan plan for (cidrcol,=,inet,10.2.14/24,2)
331331
WARNING: did not get bitmap indexscan plan for (cidrcol,<,inet,255.255.255.255,100)
332332
WARNING: did not get bitmap indexscan plan for (cidrcol,<=,inet,255.255.255.255,100)
@@ -478,7 +478,7 @@ INSERT INTO brintest_multi SELECT
478478
(four + 1.0)/(hundred+1),
479479
odd::float8 / (tenthous + 1),
480480
format('%s:00:%s:00:%s:00', to_hex(odd), to_hex(even), to_hex(hundred))::macaddr,
481-
substr(md5(unique1::text), 1, 16)::macaddr8,
481+
substr(fipshash(unique1::text), 1, 16)::macaddr8,
482482
inet '10.2.3.4' + tenthous,
483483
cidr '10.2.3/24' + tenthous,
484484
date '1995-08-15' + tenthous,
@@ -502,6 +502,12 @@ VACUUM brintest_multi; -- force a summarization cycle in brinidx
502502
insert into public.brintest_multi (float4col) values (real 'nan');
503503
insert into public.brintest_multi (float8col) values (real 'nan');
504504
UPDATE brintest_multi SET int8col = int8col * int4col;
505+
-- Test handling of inet netmasks with inet_minmax_multi_ops
506+
CREATE TABLE brin_test_inet (a inet);
507+
CREATE INDEX ON brin_test_inet USING brin (a inet_minmax_multi_ops);
508+
INSERT INTO brin_test_inet VALUES ('127.0.0.1/0');
509+
INSERT INTO brin_test_inet VALUES ('0.0.0.0/12');
510+
DROP TABLE brin_test_inet;
505511
-- Tests for brin_summarize_new_values
506512
SELECT brin_summarize_new_values('brintest_multi'); -- error, not an index
507513
ERROR: "brintest_multi" is not an index
@@ -624,3 +630,138 @@ EXPLAIN (COSTS OFF) SELECT * FROM brin_test_multi WHERE b = 1;
624630
Optimizer: Pivotal Optimizer (GPORCA)
625631
(6 rows)
626632

633+
-- test overflows during CREATE INDEX with extreme timestamp values
634+
CREATE TABLE brin_timestamp_test(a TIMESTAMPTZ);
635+
SET datestyle TO iso;
636+
-- values close to timetamp minimum
637+
INSERT INTO brin_timestamp_test
638+
SELECT '4713-01-01 00:00:01 BC'::timestamptz + (i || ' seconds')::interval
639+
FROM generate_series(1,30) s(i);
640+
-- values close to timetamp maximum
641+
INSERT INTO brin_timestamp_test
642+
SELECT '294276-12-01 00:00:01'::timestamptz + (i || ' seconds')::interval
643+
FROM generate_series(1,30) s(i);
644+
CREATE INDEX ON brin_timestamp_test USING brin (a timestamptz_minmax_multi_ops) WITH (pages_per_range=1);
645+
DROP TABLE brin_timestamp_test;
646+
-- test overflows during CREATE INDEX with extreme date values
647+
CREATE TABLE brin_date_test(a DATE);
648+
-- insert values close to date minimum
649+
INSERT INTO brin_date_test SELECT '4713-01-01 BC'::date + i FROM generate_series(1, 30) s(i);
650+
-- insert values close to date minimum
651+
INSERT INTO brin_date_test SELECT '5874897-12-01'::date + i FROM generate_series(1, 30) s(i);
652+
CREATE INDEX ON brin_date_test USING brin (a date_minmax_multi_ops) WITH (pages_per_range=1);
653+
SET enable_seqscan = off;
654+
-- make sure the ranges were built correctly and 2023-01-01 eliminates all
655+
EXPLAIN (ANALYZE, TIMING OFF, COSTS OFF, SUMMARY OFF)
656+
SELECT * FROM brin_date_test WHERE a = '2023-01-01'::date;
657+
QUERY PLAN
658+
-------------------------------------------------------------------------------
659+
Gather Motion 1:1 (slice1; segments: 1) (actual rows=0 loops=1)
660+
-> Bitmap Heap Scan on brin_date_test (actual rows=0 loops=1)
661+
Recheck Cond: (a = '2023-01-01'::date)
662+
-> Bitmap Index Scan on brin_date_test_a_idx (actual rows=0 loops=1)
663+
Index Cond: (a = '2023-01-01'::date)
664+
Optimizer: Pivotal Optimizer (GPORCA)
665+
(6 rows)
666+
667+
DROP TABLE brin_date_test;
668+
RESET enable_seqscan;
669+
-- test handling of infinite timestamp values
670+
CREATE TABLE brin_timestamp_test(a TIMESTAMP);
671+
INSERT INTO brin_timestamp_test VALUES ('-infinity'), ('infinity');
672+
INSERT INTO brin_timestamp_test
673+
SELECT i FROM generate_series('2000-01-01'::timestamp, '2000-02-09'::timestamp, '1 day'::interval) s(i);
674+
CREATE INDEX ON brin_timestamp_test USING brin (a timestamp_minmax_multi_ops) WITH (pages_per_range=1);
675+
SET enable_seqscan = off;
676+
EXPLAIN (ANALYZE, TIMING OFF, COSTS OFF, SUMMARY OFF)
677+
SELECT * FROM brin_timestamp_test WHERE a = '2023-01-01'::timestamp;
678+
QUERY PLAN
679+
-----------------------------------------------------------------------------------------
680+
Gather Motion 1:1 (slice1; segments: 1) (actual rows=0 loops=1)
681+
-> Bitmap Heap Scan on brin_timestamp_test (actual rows=0 loops=1)
682+
Recheck Cond: (a = '2023-01-01 00:00:00'::timestamp without time zone)
683+
-> Bitmap Index Scan on brin_timestamp_test_a_idx (actual rows=0 loops=1)
684+
Index Cond: (a = '2023-01-01 00:00:00'::timestamp without time zone)
685+
Optimizer: Pivotal Optimizer (GPORCA)
686+
(6 rows)
687+
688+
EXPLAIN (ANALYZE, TIMING OFF, COSTS OFF, SUMMARY OFF)
689+
SELECT * FROM brin_timestamp_test WHERE a = '1900-01-01'::timestamp;
690+
QUERY PLAN
691+
-----------------------------------------------------------------------------------------
692+
Gather Motion 1:1 (slice1; segments: 1) (actual rows=0 loops=1)
693+
-> Bitmap Heap Scan on brin_timestamp_test (actual rows=0 loops=1)
694+
Recheck Cond: (a = '1900-01-01 00:00:00'::timestamp without time zone)
695+
-> Bitmap Index Scan on brin_timestamp_test_a_idx (actual rows=0 loops=1)
696+
Index Cond: (a = '1900-01-01 00:00:00'::timestamp without time zone)
697+
Optimizer: Pivotal Optimizer (GPORCA)
698+
(6 rows)
699+
700+
DROP TABLE brin_timestamp_test;
701+
RESET enable_seqscan;
702+
-- test handling of infinite date values
703+
CREATE TABLE brin_date_test(a DATE);
704+
INSERT INTO brin_date_test VALUES ('-infinity'), ('infinity');
705+
INSERT INTO brin_date_test SELECT '2000-01-01'::date + i FROM generate_series(1, 40) s(i);
706+
CREATE INDEX ON brin_date_test USING brin (a date_minmax_multi_ops) WITH (pages_per_range=1);
707+
SET enable_seqscan = off;
708+
EXPLAIN (ANALYZE, TIMING OFF, COSTS OFF, SUMMARY OFF)
709+
SELECT * FROM brin_date_test WHERE a = '2023-01-01'::date;
710+
QUERY PLAN
711+
-------------------------------------------------------------------------------
712+
Gather Motion 1:1 (slice1; segments: 1) (actual rows=0 loops=1)
713+
-> Bitmap Heap Scan on brin_date_test (actual rows=0 loops=1)
714+
Recheck Cond: (a = '2023-01-01'::date)
715+
-> Bitmap Index Scan on brin_date_test_a_idx (actual rows=0 loops=1)
716+
Index Cond: (a = '2023-01-01'::date)
717+
Optimizer: Pivotal Optimizer (GPORCA)
718+
(6 rows)
719+
720+
EXPLAIN (ANALYZE, TIMING OFF, COSTS OFF, SUMMARY OFF)
721+
SELECT * FROM brin_date_test WHERE a = '1900-01-01'::date;
722+
QUERY PLAN
723+
-------------------------------------------------------------------------------
724+
Gather Motion 1:1 (slice1; segments: 1) (actual rows=0 loops=1)
725+
-> Bitmap Heap Scan on brin_date_test (actual rows=0 loops=1)
726+
Recheck Cond: (a = '1900-01-01'::date)
727+
-> Bitmap Index Scan on brin_date_test_a_idx (actual rows=0 loops=1)
728+
Index Cond: (a = '1900-01-01'::date)
729+
Optimizer: Pivotal Optimizer (GPORCA)
730+
(6 rows)
731+
732+
DROP TABLE brin_date_test;
733+
RESET enable_seqscan;
734+
RESET datestyle;
735+
-- test handling of overflow for interval values
736+
CREATE TABLE brin_interval_test(a INTERVAL);
737+
INSERT INTO brin_interval_test SELECT (i || ' years')::interval FROM generate_series(-178000000, -177999980) s(i);
738+
INSERT INTO brin_interval_test SELECT (i || ' years')::interval FROM generate_series( 177999980, 178000000) s(i);
739+
CREATE INDEX ON brin_interval_test USING brin (a interval_minmax_multi_ops) WITH (pages_per_range=1);
740+
SET enable_seqscan = off;
741+
EXPLAIN (ANALYZE, TIMING OFF, COSTS OFF, SUMMARY OFF)
742+
SELECT * FROM brin_interval_test WHERE a = '-30 years'::interval;
743+
QUERY PLAN
744+
---------------------------------------------------------------------------------------
745+
Gather Motion 1:1 (slice1; segments: 1) (actual rows=0 loops=1)
746+
-> Bitmap Heap Scan on brin_interval_test (actual rows=0 loops=1)
747+
Recheck Cond: (a = '@ 30 years ago'::interval)
748+
-> Bitmap Index Scan on brin_interval_test_a_idx (actual rows=0 loops=1)
749+
Index Cond: (a = '@ 30 years ago'::interval)
750+
Optimizer: Pivotal Optimizer (GPORCA)
751+
(6 rows)
752+
753+
EXPLAIN (ANALYZE, TIMING OFF, COSTS OFF, SUMMARY OFF)
754+
SELECT * FROM brin_interval_test WHERE a = '30 years'::interval;
755+
QUERY PLAN
756+
---------------------------------------------------------------------------------------
757+
Gather Motion 1:1 (slice1; segments: 1) (actual rows=0 loops=1)
758+
-> Bitmap Heap Scan on brin_interval_test (actual rows=0 loops=1)
759+
Recheck Cond: (a = '@ 30 years'::interval)
760+
-> Bitmap Index Scan on brin_interval_test_a_idx (actual rows=0 loops=1)
761+
Index Cond: (a = '@ 30 years'::interval)
762+
Optimizer: Pivotal Optimizer (GPORCA)
763+
(6 rows)
764+
765+
DROP TABLE brin_interval_test;
766+
RESET enable_seqscan;
767+
RESET datestyle;

0 commit comments

Comments
 (0)