From 2b93c2ec5ef151e2c3238209bb4c8bbedba31a1b Mon Sep 17 00:00:00 2001 From: Zhang Mingli Date: Tue, 24 Oct 2023 14:31:39 +0800 Subject: [PATCH] Try to fix hashjoin_spill avg result diff in parallel mode It's hard to reproduce stably, the possible reason may be related to avg() within parallel workers. Commit 11c8669c0cc7abc7a7702594cf13452c378d2517 adds parallel query support functions for assorted aggregates. Add a cast ::numeric to workaround avg(int), like commit 77a3be32f7c16538bc4e05edad85560d9f88369b Authored-by: Zhang Mingli avamingli@gmail.com --- src/test/regress/expected/workfile/hashjoin_spill.out | 4 ++-- src/test/regress/sql/workfile/hashjoin_spill.sql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/regress/expected/workfile/hashjoin_spill.out b/src/test/regress/expected/workfile/hashjoin_spill.out index 56cc159ca6b..486155aabe8 100644 --- a/src/test/regress/expected/workfile/hashjoin_spill.out +++ b/src/test/regress/expected/workfile/hashjoin_spill.out @@ -40,7 +40,7 @@ insert into test_hj_spill SELECT i,i,i%1000,i,i,i,i,i from SET statement_mem=1024; set gp_resqueue_print_operator_memory_limits=on; set gp_workfile_compression = on; -select avg(i3) from (SELECT t1.* FROM test_hj_spill AS t1 RIGHT JOIN test_hj_spill AS t2 ON t1.i1=t2.i2) foo; +select avg(i3::numeric) from (SELECT t1.* FROM test_hj_spill AS t1 RIGHT JOIN test_hj_spill AS t2 ON t1.i1=t2.i2) foo; avg ---------------------- 499.5000000000000000 @@ -59,7 +59,7 @@ select * from hashjoin_spill.is_workfile_created('explain (analyze, verbose) SEL (1 row) set gp_workfile_compression = off; -select avg(i3) from (SELECT t1.* FROM test_hj_spill AS t1 RIGHT JOIN test_hj_spill AS t2 ON t1.i1=t2.i2) foo; +select avg(i3::numeric) from (SELECT t1.* FROM test_hj_spill AS t1 RIGHT JOIN test_hj_spill AS t2 ON t1.i1=t2.i2) foo; avg ---------------------- 499.5000000000000000 diff --git a/src/test/regress/sql/workfile/hashjoin_spill.sql b/src/test/regress/sql/workfile/hashjoin_spill.sql index f5bd3782abc..731cc52849b 100644 --- a/src/test/regress/sql/workfile/hashjoin_spill.sql +++ b/src/test/regress/sql/workfile/hashjoin_spill.sql @@ -44,12 +44,12 @@ SET statement_mem=1024; set gp_resqueue_print_operator_memory_limits=on; set gp_workfile_compression = on; -select avg(i3) from (SELECT t1.* FROM test_hj_spill AS t1 RIGHT JOIN test_hj_spill AS t2 ON t1.i1=t2.i2) foo; +select avg(i3::numeric) from (SELECT t1.* FROM test_hj_spill AS t1 RIGHT JOIN test_hj_spill AS t2 ON t1.i1=t2.i2) foo; select * from hashjoin_spill.is_workfile_created('explain (analyze, verbose) SELECT t1.* FROM test_hj_spill AS t1 RIGHT JOIN test_hj_spill AS t2 ON t1.i1=t2.i2'); select * from hashjoin_spill.is_workfile_created('explain (analyze, verbose) SELECT t1.* FROM test_hj_spill AS t1 RIGHT JOIN test_hj_spill AS t2 ON t1.i1=t2.i2 LIMIT 15000;'); set gp_workfile_compression = off; -select avg(i3) from (SELECT t1.* FROM test_hj_spill AS t1 RIGHT JOIN test_hj_spill AS t2 ON t1.i1=t2.i2) foo; +select avg(i3::numeric) from (SELECT t1.* FROM test_hj_spill AS t1 RIGHT JOIN test_hj_spill AS t2 ON t1.i1=t2.i2) foo; select * from hashjoin_spill.is_workfile_created('explain (analyze, verbose) SELECT t1.* FROM test_hj_spill AS t1 RIGHT JOIN test_hj_spill AS t2 ON t1.i1=t2.i2'); select * from hashjoin_spill.is_workfile_created('explain (analyze, verbose) SELECT t1.* FROM test_hj_spill AS t1 RIGHT JOIN test_hj_spill AS t2 ON t1.i1=t2.i2 LIMIT 15000;');