@@ -621,6 +621,10 @@ begin
621
621
perform test.pathman_equal((plan->0->'Plan'->'Plans'->1->'Relation Name')::text,
622
622
'"runtime_test_1_1"',
623
623
'wrong partition');
624
+
625
+ select count(*) from jsonb_array_elements_text(plan->0->'Plan'->'Plans') into num;
626
+ perform test.pathman_equal(num::text, '2', 'expected 2 child plans for custom scan');
627
+
624
628
return 'ok';
625
629
end;
626
630
$$ language plpgsql;
@@ -629,7 +633,7 @@ declare
629
633
plan jsonb;
630
634
num int;
631
635
begin
632
- plan = test.pathman_test('select * from test.runtime_test_1 where id = any (select * from test.run_values limit 6 )');
636
+ plan = test.pathman_test('select * from test.runtime_test_1 where id = any (select * from test.run_values limit 4 )');
633
637
634
638
perform test.pathman_equal((plan->0->'Plan'->'Node Type')::text,
635
639
'"Nested Loop"',
@@ -644,9 +648,9 @@ begin
644
648
'wrong plan provider');
645
649
646
650
select count(*) from jsonb_array_elements_text(plan->0->'Plan'->'Plans'->1->'Plans') into num;
647
- perform test.pathman_equal(num::text, '6 ', 'expected 6 child plans for custom scan');
651
+ perform test.pathman_equal(num::text, '4 ', 'expected 4 child plans for custom scan');
648
652
649
- for i in 0..5 loop
653
+ for i in 0..3 loop
650
654
perform test.pathman_equal((plan->0->'Plan'->'Plans'->1->'Plans'->i->'Relation Name')::text,
651
655
format('"runtime_test_1_%s"', i + 1),
652
656
'wrong partition');
@@ -678,11 +682,11 @@ begin
678
682
'wrong plan provider');
679
683
680
684
select count(*) from jsonb_array_elements_text(plan->0->'Plan'->'Plans'->1->'Plans') into num;
681
- perform test.pathman_equal(num::text, '128 ', 'expected 128 child plans for custom scan');
685
+ perform test.pathman_equal(num::text, '6 ', 'expected 6 child plans for custom scan');
682
686
683
- for i in 0..127 loop
687
+ for i in 0..5 loop
684
688
num = plan->0->'Plan'->'Plans'->1->'Plans'->i->'Actual Loops';
685
- perform test.pathman_assert(num <= 79 , 'expected no more than 79 loops');
689
+ perform test.pathman_assert(num > 0 and num <= 1667 , 'expected no more than 1667 loops');
686
690
end loop;
687
691
688
692
return 'ok';
@@ -694,7 +698,7 @@ declare
694
698
num int;
695
699
begin
696
700
plan = test.pathman_test('select * from test.category c, lateral' ||
697
- '(select * from test.runtime_test_2 g where g.category_id = c.id order by rating limit 10 ) as tg');
701
+ '(select * from test.runtime_test_2 g where g.category_id = c.id order by rating limit 4 ) as tg');
698
702
699
703
perform test.pathman_equal((plan->0->'Plan'->'Node Type')::text,
700
704
'"Nested Loop"',
@@ -710,9 +714,9 @@ begin
710
714
'wrong plan provider');
711
715
712
716
select count(*) from jsonb_array_elements_text(plan->0->'Plan'->'Plans'->1->'Plans'->0->'Plans') into num;
713
- perform test.pathman_equal(num::text, '10 ', 'expected 10 child plans for custom scan');
717
+ perform test.pathman_equal(num::text, '4 ', 'expected 4 child plans for custom scan');
714
718
715
- for i in 0..9 loop
719
+ for i in 0..3 loop
716
720
perform test.pathman_equal((plan->0->'Plan'->'Plans'->1->'Plans'->0->'Plans'->i->'Relation Name')::text,
717
721
format('"runtime_test_2_%s"', i + 1),
718
722
'wrong partition');
@@ -727,26 +731,26 @@ $$ language plpgsql;
727
731
create table test.run_values as select generate_series(1, 10000) val;
728
732
create table test.runtime_test_1(id serial primary key, val real);
729
733
insert into test.runtime_test_1 select generate_series(1, 10000), random();
730
- select pathman.create_hash_partitions('test.runtime_test_1', 'id', 128 );
734
+ select pathman.create_hash_partitions('test.runtime_test_1', 'id', 6 );
731
735
NOTICE: function test.runtime_test_1_insert_trigger_func() does not exist, skipping
732
736
NOTICE: function test.runtime_test_1_update_trigger_func() does not exist, skipping
733
737
NOTICE: Copying data to partitions...
734
738
create_hash_partitions
735
739
------------------------
736
- 128
740
+ 6
737
741
(1 row)
738
742
739
- create table test.category as (select id, 'cat' || id::text as name from generate_series(1, 10 ) id);
743
+ create table test.category as (select id, 'cat' || id::text as name from generate_series(1, 4 ) id);
740
744
create table test.runtime_test_2 (id serial, category_id int not null, name text, rating real);
741
- insert into test.runtime_test_2 (select id, (id % 10 ) + 1 as category_id, 'good' || id::text as name, random() as rating from generate_series(1, 1000000 ) id);
745
+ insert into test.runtime_test_2 (select id, (id % 6 ) + 1 as category_id, 'good' || id::text as name, random() as rating from generate_series(1, 100000 ) id);
742
746
create index on test.runtime_test_2 (category_id, rating);
743
- select pathman.create_hash_partitions('test.runtime_test_2', 'category_id', 128 );
747
+ select pathman.create_hash_partitions('test.runtime_test_2', 'category_id', 6 );
744
748
NOTICE: function test.runtime_test_2_insert_trigger_func() does not exist, skipping
745
749
NOTICE: function test.runtime_test_2_update_trigger_func() does not exist, skipping
746
750
NOTICE: Copying data to partitions...
747
751
create_hash_partitions
748
752
------------------------
749
- 128
753
+ 6
750
754
(1 row)
751
755
752
756
analyze test.run_values;
@@ -784,7 +788,7 @@ set pg_pathman.enable_runtimemergeappend = off;
784
788
set enable_mergejoin = on;
785
789
set enable_hashjoin = on;
786
790
drop table test.run_values, test.runtime_test_1, test.runtime_test_2 cascade;
787
- NOTICE: drop cascades to 256 other objects
791
+ NOTICE: drop cascades to 12 other objects
788
792
/*
789
793
* Test split and merge
790
794
*/
0 commit comments