Skip to content

Commit

Permalink
Move test bitmap_union from isolation2 to regress.
Browse files Browse the repository at this point in the history
This case does not need to be under isolation2 also modify the ansfile
in this commit.
  • Loading branch information
kainwen authored and yjhjstz committed Dec 25, 2024
1 parent 8425ed1 commit 9389da3
Show file tree
Hide file tree
Showing 7 changed files with 163 additions and 165 deletions.
69 changes: 0 additions & 69 deletions src/test/isolation2/expected/bitmap_union.out

This file was deleted.

68 changes: 0 additions & 68 deletions src/test/isolation2/expected/bitmap_union_optimizer.out

This file was deleted.

1 change: 0 additions & 1 deletion src/test/isolation2/isolation2_schedule
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ test: ao_blkdir
test: bitmap_index_concurrent
test: bitmap_index_crash
test: bitmap_update_words_backup_block
test: bitmap_union
test: bitmap_index_inspect

# below test utilizes fault injectors so it needs to be in a group by itself
Expand Down
27 changes: 0 additions & 27 deletions src/test/isolation2/sql/bitmap_union.sql

This file was deleted.

67 changes: 67 additions & 0 deletions src/test/regress/expected/bitmap_index.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
create extension if not exists gp_inject_fault;
SET enable_seqscan = OFF;
SET enable_indexscan = ON;
SET enable_bitmapscan = ON;
Expand Down Expand Up @@ -998,3 +999,69 @@ select count(*) from bm_test_ao where i = 2;
(1 row)

DROP TABLE bm_test_ao;

--
-- test union bitmap batch words for multivalues index scan like where x in (x1, x2) or x > v
-- which creates bitmapand plan on two bitmap indexs that match multiple keys by using in in where clause
--
create table bmunion (a int, b int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
insert into bmunion
select (r%53), (r%59)
from generate_series(1,70000) r;
create index i_bmtest2_a on bmunion using bitmap(a);
create index i_bmtest2_b on bmunion using bitmap(b);
insert into bmunion select 53, 1 from generate_series(1, 1000);
set optimizer_enable_tablescan=off;
set optimizer_enable_dynamictablescan=off;
-- inject fault for planner so that it could produce bitmapand plan node.
select gp_inject_fault('simulate_bitmap_and', 'skip', dbid) from gp_segment_configuration where role = 'p' and content = -1;
gp_inject_fault
-----------------
Success:
(1 row)

explain (costs off) select count(*) from bmunion where a = 53 and b < 3;
QUERY PLAN
----------------------------------------------------------------
Finalize Aggregate
-> Gather Motion 3:1 (slice1; segments: 3)
-> Partial Aggregate
-> Bitmap Heap Scan on bmunion
Recheck Cond: ((b < 3) AND (a = 53))
-> BitmapAnd
-> Bitmap Index Scan on i_bmtest2_b
Index Cond: (b < 3)
-> Bitmap Index Scan on i_bmtest2_a
Index Cond: (a = 53)
Optimizer: Postgres query optimizer
(11 rows)

select gp_inject_fault('simulate_bitmap_and', 'reset', dbid) from gp_segment_configuration where role = 'p' and content = -1;
gp_inject_fault
-----------------
Success:
(1 row)

select gp_inject_fault('simulate_bitmap_and', 'skip', dbid) from gp_segment_configuration where role = 'p' and content = -1;
gp_inject_fault
-----------------
Success:
(1 row)

select count(*) from bmunion where a = 53 and b < 3;
count
-------
1000
(1 row)

select gp_inject_fault('simulate_bitmap_and', 'reset', dbid) from gp_segment_configuration where role = 'p' and content = -1;
gp_inject_fault
-----------------
Success:
(1 row)

reset optimizer_enable_tablescan;
reset optimizer_enable_dynamictablescan;
drop table bmunion;
67 changes: 67 additions & 0 deletions src/test/regress/expected/bitmap_index_optimizer.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
create extension if not exists gp_inject_fault;
SET enable_seqscan = OFF;
SET enable_indexscan = ON;
SET enable_bitmapscan = ON;
Expand Down Expand Up @@ -1005,3 +1006,69 @@ select count(*) from bm_test_ao where i = 2;
(1 row)

DROP TABLE bm_test_ao;

--
-- test union bitmap batch words for multivalues index scan like where x in (x1, x2) or x > v
-- which creates bitmapand plan on two bitmap indexs that match multiple keys by using in in where clause
--
create table bmunion (a int, b int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
insert into bmunion
select (r%53), (r%59)
from generate_series(1,70000) r;
create index i_bmtest2_a on bmunion using bitmap(a);
create index i_bmtest2_b on bmunion using bitmap(b);
insert into bmunion select 53, 1 from generate_series(1, 1000);
set optimizer_enable_tablescan=off;
set optimizer_enable_dynamictablescan=off;
-- inject fault for planner so that it could produce bitmapand plan node.
select gp_inject_fault('simulate_bitmap_and', 'skip', dbid) from gp_segment_configuration where role = 'p' and content = -1;
gp_inject_fault
-----------------
Success:
(1 row)

explain (costs off) select count(*) from bmunion where a = 53 and b < 3;
QUERY PLAN
----------------------------------------------------------------
Finalize Aggregate
-> Gather Motion 1:1 (slice1; segments: 1)
-> Partial Aggregate
-> Bitmap Heap Scan on bmunion
Recheck Cond: ((a = 53) AND (b < 3))
-> BitmapAnd
-> Bitmap Index Scan on i_bmtest2_a
Index Cond: (a = 53)
-> Bitmap Index Scan on i_bmtest2_b
Index Cond: (b < 3)
Optimizer: Pivotal Optimizer (GPORCA)
(11 rows)

select gp_inject_fault('simulate_bitmap_and', 'reset', dbid) from gp_segment_configuration where role = 'p' and content = -1;
gp_inject_fault
-----------------
Success:
(1 row)

select gp_inject_fault('simulate_bitmap_and', 'skip', dbid) from gp_segment_configuration where role = 'p' and content = -1;
gp_inject_fault
-----------------
Success:
(1 row)

select count(*) from bmunion where a = 53 and b < 3;
count
-------
1000
(1 row)

select gp_inject_fault('simulate_bitmap_and', 'reset', dbid) from gp_segment_configuration where role = 'p' and content = -1;
gp_inject_fault
-----------------
Success:
(1 row)

reset optimizer_enable_tablescan;
reset optimizer_enable_dynamictablescan;
drop table bmunion;
29 changes: 29 additions & 0 deletions src/test/regress/sql/bitmap_index.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
create extension if not exists gp_inject_fault;

SET enable_seqscan = OFF;
SET enable_indexscan = ON;
SET enable_bitmapscan = ON;
Expand Down Expand Up @@ -419,3 +421,30 @@ explain select count(*) from bm_test_ao where i =2;
select count(*) from bm_test_ao where i = 2;

DROP TABLE bm_test_ao;
--
-- test union bitmap batch words for multivalues index scan like where x in (x1, x2) or x > v
-- which creates bitmapand plan on two bitmap indexs that match multiple keys by using in in where clause
--
create table bmunion (a int, b int);
insert into bmunion
select (r%53), (r%59)
from generate_series(1,70000) r;
create index i_bmtest2_a on bmunion using bitmap(a);
create index i_bmtest2_b on bmunion using bitmap(b);
insert into bmunion select 53, 1 from generate_series(1, 1000);

set optimizer_enable_tablescan=off;
set optimizer_enable_dynamictablescan=off;
-- inject fault for planner so that it could produce bitmapand plan node.
select gp_inject_fault('simulate_bitmap_and', 'skip', dbid) from gp_segment_configuration where role = 'p' and content = -1;
explain (costs off) select count(*) from bmunion where a = 53 and b < 3;
select gp_inject_fault('simulate_bitmap_and', 'reset', dbid) from gp_segment_configuration where role = 'p' and content = -1;

select gp_inject_fault('simulate_bitmap_and', 'skip', dbid) from gp_segment_configuration where role = 'p' and content = -1;
select count(*) from bmunion where a = 53 and b < 3;
select gp_inject_fault('simulate_bitmap_and', 'reset', dbid) from gp_segment_configuration where role = 'p' and content = -1;

reset optimizer_enable_tablescan;
reset optimizer_enable_dynamictablescan;

drop table bmunion;

0 comments on commit 9389da3

Please sign in to comment.