citusdata / citus

Distributed PostgreSQL as an extension
https://www.citusdata.com
GNU Affero General Public License v3.0
10.42k stars 662 forks source link

EXPLAIN ANALYZE fails for distributed custom aggregates with 'ERROR: column "field_0" has pseudo-type cstring' #4043

Open bsatzger opened 4 years ago

bsatzger commented 4 years ago

sum2 is a user-defined aggregate whose execution can be pushed down to worker nodes. Regular execution succeeds, but EXPLAIN ANALYZE fails:

explain analyze select sum2(val1) from inttbl;
ERROR:  column "field_0" has pseudo-type cstring
CONTEXT:  while executing command on localhost:9702

Corresponding plan:

explain verbose select sum2(val1) from inttbl;
                                                               QUERY PLAN                                                                
-----------------------------------------------------------------------------------------------------------------------------------------
 Aggregate  (cost=250.00..250.01 rows=1 width=4)
   Output: coord_combine_agg('25135'::oid, remote_scan.sum2, NULL::integer)
   ->  Custom Scan (Citus Adaptive)  (cost=0.00..0.00 rows=100000 width=32)
         Output: remote_scan.sum2
         Task Count: 32
         Tasks Shown: One of 32
         ->  Task
               Query: SELECT worker_partial_agg('public.sum2(integer)'::regprocedure, val1) AS sum2 FROM inttbl_102168 inttbl WHERE true
               Node: host=localhost port=9701 dbname=postgres
               ->  Aggregate  (cost=35.50..35.51 rows=1 width=32)
                     Output: worker_partial_agg('25139'::oid, val1)
                     ->  Seq Scan on public.inttbl_102168 inttbl  (cost=0.00..30.40 rows=2040 width=4)
                           Output: id, val1, val2
(13 rows)
onderkalaci commented 4 years ago

I think some related failures:

explain analyze select row(user_id) FROM users_table;
ERROR:  type modifier is not allowed for type "record"
CONTEXT:  while executing command on localhost:9700

 explain analyze select *, pg_sleep(0.5) FROM users_table;
ERROR:  column "field_6" has pseudo-type void
CONTEXT:  while executing command on localhost:9700