This is an automated email from the ASF dual-hosted git repository.

maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git


The following commit(s) were added to refs/heads/main by this push:
     new 48591423d3 Fix directory table ci test unstable.
48591423d3 is described below

commit 48591423d310e2ae189abd1f3d13bbc861d25e6a
Author: zhangwenchao <[email protected]>
AuthorDate: Mon Nov 25 10:56:39 2024 +0800

    Fix directory table ci test unstable.
    
    As two directory schema tables have the approximately the same in tuples
    count, the join plan is unstable. We fix this by adding more tuples to
    one schema table.
    
    Authored-by: Zhang Wenchao [email protected]
---
 src/test/regress/input/directory_table.source      |  13 ++
 src/test/regress/output/directory_table.source     | 218 +++++++++++++++++----
 .../output/directory_table_optimizer.source        | 202 ++++++++++++++++---
 3 files changed, 367 insertions(+), 66 deletions(-)

diff --git a/src/test/regress/input/directory_table.source 
b/src/test/regress/input/directory_table.source
index 2f04341f29..65ad0eef54 100644
--- a/src/test/regress/input/directory_table.source
+++ b/src/test/regress/input/directory_table.source
@@ -318,6 +318,19 @@ SELECT relative_path, size, tag FROM dir_table2 ORDER BY 1;
 \COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation3' WITH TAG 
'nation2';    -- fail
 \COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation4' WITH TAG 
'nation';
 \COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation5' WITH TAG 
'nation' WITH TAG 'nation2';    -- fail
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation6';
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation7';
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation8';
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation9';
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation10';
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation11';
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation12';
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation13';
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation14';
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation15';
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation16';
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation17';
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation18';
 SELECT relative_path, size, tag FROM dir_table1 ORDER BY 1;
 SELECT relative_path, content FROM directory_table('dir_table1') ORDER BY 1;
 
diff --git a/src/test/regress/output/directory_table.source 
b/src/test/regress/output/directory_table.source
index b6cb43a4f8..ea5419ca66 100644
--- a/src/test/regress/output/directory_table.source
+++ b/src/test/regress/output/directory_table.source
@@ -802,23 +802,75 @@ NOTICE:  dir_table1 INSERT AFTER ROW  (seg2 
127.0.1.1:7004 pid=31192)
 ERROR:  syntax error at or near "WITH"
 LINE 1: ...dir_table1 FROM STDIN 'nation5' WITH TAG 'nation' WITH TAG '...
                                                              ^
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation6';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg0 127.0.1.1:7002 pid=21790)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation7';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation8';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation9';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation10';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg2 127.0.1.1:7004 pid=21791)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation11';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg0 127.0.1.1:7002 pid=21790)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation12';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation13';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation14';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg2 127.0.1.1:7004 pid=21791)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation15';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg0 127.0.1.1:7002 pid=21790)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation16';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation17';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation18';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg0 127.0.1.1:7002 pid=21790)
 SELECT relative_path, size, tag FROM dir_table1 ORDER BY 1;
  relative_path | size |  tag   
 ---------------+------+--------
  nation1       | 2199 | 
+ nation10      | 2199 | 
+ nation11      | 2199 | 
+ nation12      | 2199 | 
+ nation13      | 2199 | 
+ nation14      | 2199 | 
+ nation15      | 2199 | 
+ nation16      | 2199 | 
+ nation17      | 2199 | 
+ nation18      | 2199 | 
  nation2       | 2199 | 
  nation3       | 2199 | nation
  nation4       | 2199 | nation
-(4 rows)
+ nation6       | 2199 | 
+ nation7       | 2199 | 
+ nation8       | 2199 | 
+ nation9       | 2199 | 
+(17 rows)
 
 SELECT relative_path, content FROM directory_table('dir_table1') ORDER BY 1;
  relative_path |                                                               
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
 
---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 [...]
  nation1       | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation10      | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation11      | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation12      | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation13      | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation14      | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation15      | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation16      | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation17      | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation18      | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
  nation2       | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
  nation3       | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
  nation4       | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
-(4 rows)
+ nation6       | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation7       | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation8       | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation9       | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+(17 rows)
 
 COPY dir_table2 FROM PROGRAM 'cat @abs_srcdir@/data/nation.csv';     -- fail
 ERROR:  Copy from directory table file name can't be null.
@@ -1182,12 +1234,25 @@ SELECT relative_path, size, tag FROM dir_table1 ORDER 
BY 1;
  relative_path | size |  tag   
 ---------------+------+--------
  nation1       | 2199 | 
+ nation10      | 2199 | 
+ nation11      | 2199 | 
+ nation12      | 2199 | 
+ nation13      | 2199 | 
+ nation14      | 2199 | 
+ nation15      | 2199 | 
+ nation16      | 2199 | 
+ nation17      | 2199 | 
+ nation18      | 2199 | 
  nation2       | 2199 | 
  nation2.txt   | 2199 | 
  nation3       | 2199 | nation
  nation4       | 2199 | nation
+ nation6       | 2199 | 
+ nation7       | 2199 | 
+ nation8       | 2199 | 
+ nation9       | 2199 | 
  nation.txt    | 2199 | 
-(6 rows)
+(19 rows)
 
 SELECT relative_path, size, tag FROM dir_table2 ORDER BY 1;
  relative_path | size |  tag   
@@ -1203,8 +1268,8 @@ ANALYZE dir_table1;
 ANALYZE dir_table2;
 EXPLAIN (COSTS OFF) SELECT dir_table1.relative_path FROM dir_table1, dir_table2
 WHERE dir_table1.relative_path = dir_table2.relative_path ORDER BY 1;
-                                 QUERY PLAN                                 
-----------------------------------------------------------------------------
+                                   QUERY PLAN                                  
 
+--------------------------------------------------------------------------------
  Gather Motion 3:1  (slice1; segments: 3)
    Merge Key: dir_table1.relative_path
    ->  Sort
@@ -1240,11 +1305,11 @@ WHERE dir_table1.size = dir_table2.size ORDER BY 1 
LIMIT 1;
                ->  Sort
                      Sort Key: dir_table1.relative_path
                      ->  Hash Join
-                           Hash Cond: (dir_table2.size = dir_table1.size)
-                           ->  Broadcast Motion 3:3  (slice2; segments: 3)
-                                 ->  Seq Scan on dir_table2
+                           Hash Cond: (dir_table1.size = dir_table2.size)
+                           ->  Seq Scan on dir_table1
                            ->  Hash
-                                 ->  Seq Scan on dir_table1
+                                 ->  Broadcast Motion 3:3  (slice2; segments: 
3)
+                                       ->  Seq Scan on dir_table2
  Optimizer: Postgres query optimizer
 (13 rows)
 
@@ -1259,8 +1324,8 @@ ANALYZE dir_table1;
 ANALYZE dir_table2;
 EXPLAIN (COSTS OFF) SELECT dir_table1.relative_path FROM dir_table1, dir_table2
 WHERE dir_table1.md5 = dir_table2.md5 ORDER BY 1 LIMIT 1;
-                            QUERY PLAN                            
-------------------------------------------------------------------
+                                   QUERY PLAN                                  
  
+---------------------------------------------------------------------------------
  Limit
    ->  Gather Motion 3:1  (slice1; segments: 3)
          Merge Key: dir_table1.relative_path
@@ -1269,15 +1334,12 @@ WHERE dir_table1.md5 = dir_table2.md5 ORDER BY 1 LIMIT 
1;
                      Sort Key: dir_table1.relative_path
                      ->  Hash Join
                            Hash Cond: (dir_table1.md5 = dir_table2.md5)
-                           ->  Redistribute Motion 3:3  (slice2; segments: 3)
-                                 Hash Key: dir_table1.md5
-                                 ->  Seq Scan on dir_table1
+                           ->  Seq Scan on dir_table1
                            ->  Hash
-                                 ->  Redistribute Motion 3:3  (slice3; 
segments: 3)
-                                       Hash Key: dir_table2.md5
+                                 ->  Broadcast Motion 3:3  (slice2; segments: 
3)
                                        ->  Seq Scan on dir_table2
  Optimizer: Postgres query optimizer
-(16 rows)
+(13 rows)
 
 SELECT dir_table1.relative_path FROM dir_table1, dir_table2
 WHERE dir_table1.md5 = dir_table2.md5 ORDER BY 1 LIMIT 1;
@@ -1290,18 +1352,18 @@ ANALYZE dir_table1;
 ANALYZE dir_table2;
 EXPLAIN (COSTS OFF) SELECT dir_table1.relative_path FROM dir_table1, dir_table2
 WHERE dir_table1.tag = dir_table2.tag ORDER BY 1;
-                               QUERY PLAN                               
-------------------------------------------------------------------------
+                             QUERY PLAN                              
+---------------------------------------------------------------------
  Gather Motion 3:1  (slice1; segments: 3)
    Merge Key: dir_table1.relative_path
    ->  Sort
          Sort Key: dir_table1.relative_path
          ->  Hash Join
-               Hash Cond: (dir_table2.tag = dir_table1.tag)
-               ->  Broadcast Motion 3:3  (slice2; segments: 3)
-                     ->  Seq Scan on dir_table2
+               Hash Cond: (dir_table1.tag = dir_table2.tag)
+               ->  Seq Scan on dir_table1
                ->  Hash
-                     ->  Seq Scan on dir_table1
+                     ->  Broadcast Motion 3:3  (slice2; segments: 3)
+                           ->  Seq Scan on dir_table2
  Optimizer: Postgres query optimizer
 (11 rows)
 
@@ -1324,12 +1386,25 @@ SELECT relative_path, size, tag FROM dir_table1 ORDER 
BY 1;
  relative_path | size |  tag   
 ---------------+------+--------
  nation1       | 2199 | 
+ nation10      | 2199 | 
+ nation11      | 2199 | 
+ nation12      | 2199 | 
+ nation13      | 2199 | 
+ nation14      | 2199 | 
+ nation15      | 2199 | 
+ nation16      | 2199 | 
+ nation17      | 2199 | 
+ nation18      | 2199 | 
  nation2       | 2199 | 
  nation2.txt   | 2199 | 
  nation3       | 2199 | nation
  nation4       | 2199 | nation
+ nation6       | 2199 | 
+ nation7       | 2199 | 
+ nation8       | 2199 | 
+ nation9       | 2199 | 
  nation.txt    | 2199 | 
-(6 rows)
+(19 rows)
 
 SELECT relative_path, size, tag FROM dir_table2 ORDER BY 1;
  relative_path | size |  tag   
@@ -1348,12 +1423,25 @@ SELECT relative_path, size, tag FROM dir_table1 ORDER 
BY 1;
  relative_path | size |  tag   
 ---------------+------+--------
  nation1       | 2199 | 
+ nation10      | 2199 | 
+ nation11      | 2199 | 
+ nation12      | 2199 | 
+ nation13      | 2199 | 
+ nation14      | 2199 | 
+ nation15      | 2199 | 
+ nation16      | 2199 | 
+ nation17      | 2199 | 
+ nation18      | 2199 | 
  nation2       | 2199 | 
  nation2.txt   | 2199 | 
  nation3       | 2199 | nation
  nation4       | 2199 | nation
+ nation6       | 2199 | 
+ nation7       | 2199 | 
+ nation8       | 2199 | 
+ nation9       | 2199 | 
  nation.txt    | 2199 | 
-(6 rows)
+(19 rows)
 
 SELECT relative_path, size, tag FROM dir_table2 ORDER BY 1;
  relative_path | size |  tag   
@@ -1381,17 +1469,47 @@ ERROR:  Only allow to update directory "tag" column.
 UPDATE dir_table2 SET md5 = '70f09140d1b83eb3ecf9a0e28494d2a4' WHERE 
relative_path = 'nation4'; -- fail
 ERROR:  Only allow to update directory "tag" column.
 UPDATE dir_table1 SET tag = 'nation_new_tag';  -- ok
-NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=31193)
-NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg2 127.0.1.1:7004 pid=31192)
-NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=31193)
-NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg2 127.0.1.1:7004 pid=31192)
-NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=31193)
-NOTICE:  dir_table1 UPDATE AFTER ROW  (seg2 127.0.1.1:7004 pid=31192)
-NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=31193)
-NOTICE:  dir_table1 UPDATE AFTER ROW  (seg2 127.0.1.1:7004 pid=31192)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg0 127.0.1.1:7002 pid=21790)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=21792)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg2 127.0.1.1:7004 pid=21791)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg0 127.0.1.1:7002 pid=21790)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=21792)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg2 127.0.1.1:7004 pid=21791)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg0 127.0.1.1:7002 pid=21790)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=21792)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg0 127.0.1.1:7002 pid=21790)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=21792)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg2 127.0.1.1:7004 pid=21791)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg0 127.0.1.1:7002 pid=21790)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=21792)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=21792)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg2 127.0.1.1:7004 pid=21791)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg0 127.0.1.1:7002 pid=21790)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=21792)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg2 127.0.1.1:7004 pid=21791)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg0 127.0.1.1:7002 pid=21790)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg0 127.0.1.1:7002 pid=21790)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=21792)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=21792)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg0 127.0.1.1:7002 pid=21790)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg0 127.0.1.1:7002 pid=21790)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg2 127.0.1.1:7004 pid=21791)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg2 127.0.1.1:7004 pid=21791)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg2 127.0.1.1:7004 pid=21791)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg2 127.0.1.1:7004 pid=21791)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg2 127.0.1.1:7004 pid=21791)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
 UPDATE dir_table1 SET tag = 'nation2_new_tag' WHERE relative_path = 'nation2'; 
 -- ok
-NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg2 127.0.1.1:7004 pid=31192)
-NOTICE:  dir_table1 UPDATE AFTER ROW  (seg2 127.0.1.1:7004 pid=31192)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg2 127.0.1.1:7004 pid=21791)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg2 127.0.1.1:7004 pid=21791)
 UPDATE dir_table2 SET tag = 'nation4_new_tag' WHERE relative_path = 'nation3'; 
 -- ok
 UPDATE dir_table1 SET tag = 'failed_tag' WHERE relative_path = 
'not_exist_path';
 UPDATE dir_table2 SET tag = 'no_tag' WHERE relative_path = 'not_exist_path';
@@ -1399,12 +1517,25 @@ SELECT relative_path, size, tag FROM dir_table1 ORDER 
BY 1;
  relative_path | size |       tag       
 ---------------+------+-----------------
  nation1       | 2199 | nation_new_tag
+ nation10      | 2199 | nation_new_tag
+ nation11      | 2199 | nation_new_tag
+ nation12      | 2199 | nation_new_tag
+ nation13      | 2199 | nation_new_tag
+ nation14      | 2199 | nation_new_tag
+ nation15      | 2199 | nation_new_tag
+ nation16      | 2199 | nation_new_tag
+ nation17      | 2199 | nation_new_tag
+ nation18      | 2199 | nation_new_tag
  nation2       | 2199 | nation2_new_tag
  nation2.txt   | 2199 | nation_new_tag
  nation3       | 2199 | nation_new_tag
  nation4       | 2199 | nation_new_tag
+ nation6       | 2199 | nation_new_tag
+ nation7       | 2199 | nation_new_tag
+ nation8       | 2199 | nation_new_tag
+ nation9       | 2199 | nation_new_tag
  nation.txt    | 2199 | nation_new_tag
-(6 rows)
+(19 rows)
 
 SELECT relative_path, size, tag FROM dir_table2 ORDER BY 1;
  relative_path | size |       tag       
@@ -1493,11 +1624,24 @@ SELECT remove_file('dir_table1', 'nation1');    -- fail
 SELECT relative_path, size, tag FROM dir_table1 ORDER BY 1;
  relative_path | size |      tag       
 ---------------+------+----------------
+ nation10      | 2199 | nation_new_tag
+ nation11      | 2199 | nation_new_tag
+ nation12      | 2199 | nation_new_tag
+ nation13      | 2199 | nation_new_tag
+ nation14      | 2199 | nation_new_tag
+ nation15      | 2199 | nation_new_tag
+ nation16      | 2199 | nation_new_tag
+ nation17      | 2199 | nation_new_tag
+ nation18      | 2199 | nation_new_tag
  nation2.txt   | 2199 | nation_new_tag
  nation3       | 2199 | nation_new_tag
  nation4       | 2199 | nation_new_tag
+ nation6       | 2199 | nation_new_tag
+ nation7       | 2199 | nation_new_tag
+ nation8       | 2199 | nation_new_tag
+ nation9       | 2199 | nation_new_tag
  nation.txt    | 2199 | nation_new_tag
-(4 rows)
+(17 rows)
 
 SELECT relative_path, size, tag FROM dir_table2 ORDER BY 1;
  relative_path | size |  tag   
diff --git a/src/test/regress/output/directory_table_optimizer.source 
b/src/test/regress/output/directory_table_optimizer.source
index ddc3ff805a..7b6d0692be 100644
--- a/src/test/regress/output/directory_table_optimizer.source
+++ b/src/test/regress/output/directory_table_optimizer.source
@@ -802,23 +802,75 @@ NOTICE:  dir_table1 INSERT AFTER ROW  (seg2 
127.0.1.1:7004 pid=31192)
 ERROR:  syntax error at or near "WITH"
 LINE 1: ...dir_table1 FROM STDIN 'nation5' WITH TAG 'nation' WITH TAG '...
                                                              ^
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation6';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg0 127.0.1.1:7002 pid=2727)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation7';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=2728)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation8';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=2728)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation9';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=2728)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation10';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg2 127.0.1.1:7004 pid=2729)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation11';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg0 127.0.1.1:7002 pid=2727)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation12';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=2728)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation13';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=2728)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation14';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg2 127.0.1.1:7004 pid=2729)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation15';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg0 127.0.1.1:7002 pid=2727)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation16';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=2728)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation17';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=2728)
+\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation18';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg0 127.0.1.1:7002 pid=2727)
 SELECT relative_path, size, tag FROM dir_table1 ORDER BY 1;
  relative_path | size |  tag   
 ---------------+------+--------
  nation1       | 2199 | 
+ nation10      | 2199 | 
+ nation11      | 2199 | 
+ nation12      | 2199 | 
+ nation13      | 2199 | 
+ nation14      | 2199 | 
+ nation15      | 2199 | 
+ nation16      | 2199 | 
+ nation17      | 2199 | 
+ nation18      | 2199 | 
  nation2       | 2199 | 
  nation3       | 2199 | nation
  nation4       | 2199 | nation
-(4 rows)
+ nation6       | 2199 | 
+ nation7       | 2199 | 
+ nation8       | 2199 | 
+ nation9       | 2199 | 
+(17 rows)
 
 SELECT relative_path, content FROM directory_table('dir_table1') ORDER BY 1;
  relative_path |                                                               
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
 
---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 [...]
  nation1       | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation10      | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation11      | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation12      | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation13      | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation14      | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation15      | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation16      | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation17      | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation18      | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
  nation2       | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
  nation3       | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
  nation4       | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
-(4 rows)
+ nation6       | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation7       | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation8       | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+ nation9       | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
+(17 rows)
 
 COPY dir_table2 FROM PROGRAM 'cat @abs_srcdir@/data/nation.csv';     -- fail
 ERROR:  Copy from directory table file name can't be null.
@@ -1182,12 +1234,25 @@ SELECT relative_path, size, tag FROM dir_table1 ORDER 
BY 1;
  relative_path | size |  tag   
 ---------------+------+--------
  nation1       | 2199 | 
+ nation10      | 2199 | 
+ nation11      | 2199 | 
+ nation12      | 2199 | 
+ nation13      | 2199 | 
+ nation14      | 2199 | 
+ nation15      | 2199 | 
+ nation16      | 2199 | 
+ nation17      | 2199 | 
+ nation18      | 2199 | 
  nation2       | 2199 | 
  nation2.txt   | 2199 | 
  nation3       | 2199 | nation
  nation4       | 2199 | nation
+ nation6       | 2199 | 
+ nation7       | 2199 | 
+ nation8       | 2199 | 
+ nation9       | 2199 | 
  nation.txt    | 2199 | 
-(6 rows)
+(19 rows)
 
 SELECT relative_path, size, tag FROM dir_table2 ORDER BY 1;
  relative_path | size |  tag   
@@ -1203,8 +1268,8 @@ ANALYZE dir_table1;
 ANALYZE dir_table2;
 EXPLAIN (COSTS OFF) SELECT dir_table1.relative_path FROM dir_table1, dir_table2
 WHERE dir_table1.relative_path = dir_table2.relative_path ORDER BY 1;
-                                 QUERY PLAN                                 
-----------------------------------------------------------------------------
+                                   QUERY PLAN                                  
 
+--------------------------------------------------------------------------------
  Gather Motion 3:1  (slice1; segments: 3)
    Merge Key: dir_table1.relative_path
    ->  Sort
@@ -1259,8 +1324,8 @@ ANALYZE dir_table1;
 ANALYZE dir_table2;
 EXPLAIN (COSTS OFF) SELECT dir_table1.relative_path FROM dir_table1, dir_table2
 WHERE dir_table1.md5 = dir_table2.md5 ORDER BY 1 LIMIT 1;
-                            QUERY PLAN                            
-------------------------------------------------------------------
+                                   QUERY PLAN                                  
  
+---------------------------------------------------------------------------------
  Limit
    ->  Gather Motion 3:1  (slice1; segments: 3)
          Merge Key: dir_table1.relative_path
@@ -1287,23 +1352,20 @@ ANALYZE dir_table1;
 ANALYZE dir_table2;
 EXPLAIN (COSTS OFF) SELECT dir_table1.relative_path FROM dir_table1, dir_table2
 WHERE dir_table1.tag = dir_table2.tag ORDER BY 1;
-                               QUERY PLAN                               
-------------------------------------------------------------------------
+                             QUERY PLAN                              
+---------------------------------------------------------------------
  Gather Motion 3:1  (slice1; segments: 3)
    Merge Key: dir_table1.relative_path
    ->  Sort
          Sort Key: dir_table1.relative_path
          ->  Hash Join
                Hash Cond: (dir_table1.tag = dir_table2.tag)
-               ->  Redistribute Motion 3:3  (slice2; segments: 3)
-                     Hash Key: dir_table1.tag
-                     ->  Seq Scan on dir_table1
+               ->  Seq Scan on dir_table1
                ->  Hash
-                     ->  Redistribute Motion 3:3  (slice3; segments: 3)
-                           Hash Key: dir_table2.tag
+                     ->  Broadcast Motion 3:3  (slice2; segments: 3)
                            ->  Seq Scan on dir_table2
  Optimizer: Pivotal Optimizer (GPORCA)
-(14 rows)
+(11 rows)
 
 SELECT dir_table1.relative_path FROM dir_table1, dir_table2
 WHERE dir_table1.tag = dir_table2.tag ORDER BY 1;
@@ -1324,12 +1386,25 @@ SELECT relative_path, size, tag FROM dir_table1 ORDER 
BY 1;
  relative_path | size |  tag   
 ---------------+------+--------
  nation1       | 2199 | 
+ nation10      | 2199 | 
+ nation11      | 2199 | 
+ nation12      | 2199 | 
+ nation13      | 2199 | 
+ nation14      | 2199 | 
+ nation15      | 2199 | 
+ nation16      | 2199 | 
+ nation17      | 2199 | 
+ nation18      | 2199 | 
  nation2       | 2199 | 
  nation2.txt   | 2199 | 
  nation3       | 2199 | nation
  nation4       | 2199 | nation
+ nation6       | 2199 | 
+ nation7       | 2199 | 
+ nation8       | 2199 | 
+ nation9       | 2199 | 
  nation.txt    | 2199 | 
-(6 rows)
+(19 rows)
 
 SELECT relative_path, size, tag FROM dir_table2 ORDER BY 1;
  relative_path | size |  tag   
@@ -1348,12 +1423,25 @@ SELECT relative_path, size, tag FROM dir_table1 ORDER 
BY 1;
  relative_path | size |  tag   
 ---------------+------+--------
  nation1       | 2199 | 
+ nation10      | 2199 | 
+ nation11      | 2199 | 
+ nation12      | 2199 | 
+ nation13      | 2199 | 
+ nation14      | 2199 | 
+ nation15      | 2199 | 
+ nation16      | 2199 | 
+ nation17      | 2199 | 
+ nation18      | 2199 | 
  nation2       | 2199 | 
  nation2.txt   | 2199 | 
  nation3       | 2199 | nation
  nation4       | 2199 | nation
+ nation6       | 2199 | 
+ nation7       | 2199 | 
+ nation8       | 2199 | 
+ nation9       | 2199 | 
  nation.txt    | 2199 | 
-(6 rows)
+(19 rows)
 
 SELECT relative_path, size, tag FROM dir_table2 ORDER BY 1;
  relative_path | size |  tag   
@@ -1381,17 +1469,47 @@ ERROR:  Only allow to update directory "tag" column.
 UPDATE dir_table2 SET md5 = '70f09140d1b83eb3ecf9a0e28494d2a4' WHERE 
relative_path = 'nation4'; -- fail
 ERROR:  Only allow to update directory "tag" column.
 UPDATE dir_table1 SET tag = 'nation_new_tag';  -- ok
-NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=31193)
-NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg2 127.0.1.1:7004 pid=31192)
-NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=31193)
-NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg2 127.0.1.1:7004 pid=31192)
-NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=31193)
-NOTICE:  dir_table1 UPDATE AFTER ROW  (seg2 127.0.1.1:7004 pid=31192)
-NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=31193)
-NOTICE:  dir_table1 UPDATE AFTER ROW  (seg2 127.0.1.1:7004 pid=31192)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=2728)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg2 127.0.1.1:7004 pid=2729)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg0 127.0.1.1:7002 pid=2727)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=2728)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg0 127.0.1.1:7002 pid=2727)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg2 127.0.1.1:7004 pid=2729)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=2728)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg0 127.0.1.1:7002 pid=2727)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg0 127.0.1.1:7002 pid=2727)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=2728)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg2 127.0.1.1:7004 pid=2729)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg0 127.0.1.1:7002 pid=2727)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=2728)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg2 127.0.1.1:7004 pid=2729)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=2728)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg2 127.0.1.1:7004 pid=2729)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg0 127.0.1.1:7002 pid=2727)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=2728)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg0 127.0.1.1:7002 pid=2727)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=2728)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg0 127.0.1.1:7002 pid=2727)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg2 127.0.1.1:7004 pid=2729)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg0 127.0.1.1:7002 pid=2727)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg1 127.0.1.1:7003 pid=2728)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg2 127.0.1.1:7004 pid=2729)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg2 127.0.1.1:7004 pid=2729)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg0 127.0.1.1:7002 pid=2727)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=2728)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg2 127.0.1.1:7004 pid=2729)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg2 127.0.1.1:7004 pid=2729)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=2728)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=2728)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=2728)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=2728)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=2728)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=2728)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=2728)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg1 127.0.1.1:7003 pid=2728)
 UPDATE dir_table1 SET tag = 'nation2_new_tag' WHERE relative_path = 'nation2'; 
 -- ok
-NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg2 127.0.1.1:7004 pid=31192)
-NOTICE:  dir_table1 UPDATE AFTER ROW  (seg2 127.0.1.1:7004 pid=31192)
+NOTICE:  dir_table1 UPDATE BEFORE ROW  (seg2 127.0.1.1:7004 pid=2729)
+NOTICE:  dir_table1 UPDATE AFTER ROW  (seg2 127.0.1.1:7004 pid=2729)
 UPDATE dir_table2 SET tag = 'nation4_new_tag' WHERE relative_path = 'nation3'; 
 -- ok
 UPDATE dir_table1 SET tag = 'failed_tag' WHERE relative_path = 
'not_exist_path';
 UPDATE dir_table2 SET tag = 'no_tag' WHERE relative_path = 'not_exist_path';
@@ -1399,12 +1517,25 @@ SELECT relative_path, size, tag FROM dir_table1 ORDER 
BY 1;
  relative_path | size |       tag       
 ---------------+------+-----------------
  nation1       | 2199 | nation_new_tag
+ nation10      | 2199 | nation_new_tag
+ nation11      | 2199 | nation_new_tag
+ nation12      | 2199 | nation_new_tag
+ nation13      | 2199 | nation_new_tag
+ nation14      | 2199 | nation_new_tag
+ nation15      | 2199 | nation_new_tag
+ nation16      | 2199 | nation_new_tag
+ nation17      | 2199 | nation_new_tag
+ nation18      | 2199 | nation_new_tag
  nation2       | 2199 | nation2_new_tag
  nation2.txt   | 2199 | nation_new_tag
  nation3       | 2199 | nation_new_tag
  nation4       | 2199 | nation_new_tag
+ nation6       | 2199 | nation_new_tag
+ nation7       | 2199 | nation_new_tag
+ nation8       | 2199 | nation_new_tag
+ nation9       | 2199 | nation_new_tag
  nation.txt    | 2199 | nation_new_tag
-(6 rows)
+(19 rows)
 
 SELECT relative_path, size, tag FROM dir_table2 ORDER BY 1;
  relative_path | size |       tag       
@@ -1493,11 +1624,24 @@ SELECT remove_file('dir_table1', 'nation1');    -- fail
 SELECT relative_path, size, tag FROM dir_table1 ORDER BY 1;
  relative_path | size |      tag       
 ---------------+------+----------------
+ nation10      | 2199 | nation_new_tag
+ nation11      | 2199 | nation_new_tag
+ nation12      | 2199 | nation_new_tag
+ nation13      | 2199 | nation_new_tag
+ nation14      | 2199 | nation_new_tag
+ nation15      | 2199 | nation_new_tag
+ nation16      | 2199 | nation_new_tag
+ nation17      | 2199 | nation_new_tag
+ nation18      | 2199 | nation_new_tag
  nation2.txt   | 2199 | nation_new_tag
  nation3       | 2199 | nation_new_tag
  nation4       | 2199 | nation_new_tag
+ nation6       | 2199 | nation_new_tag
+ nation7       | 2199 | nation_new_tag
+ nation8       | 2199 | nation_new_tag
+ nation9       | 2199 | nation_new_tag
  nation.txt    | 2199 | nation_new_tag
-(4 rows)
+(17 rows)
 
 SELECT relative_path, size, tag FROM dir_table2 ORDER BY 1;
  relative_path | size |  tag   


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to