Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregation error over a citus distributed table #53

Open
aykut-bozkurt opened this issue Jun 2, 2022 · 1 comment
Open

Aggregation error over a citus distributed table #53

aykut-bozkurt opened this issue Jun 2, 2022 · 1 comment
Labels

Comments

@aykut-bozkurt
Copy link

I have encountered with an error when I execute a query stated in TopN Readme page, over a citus distributed table. The same query worked when I used a reference or a local table instead of distributed one.

postgres version: pg14

Citus repo: citus-enterprise
Branch: release-11.0 (bea69bce45b1621bf4e27d2559e9e2b9755e3771)

TopN branch: master (865c827)

Reproducing steps:

  1. Created a cluster of 2 worker nodes using citus dev tool:
citus_dev make --destroy testCluster
  1. Connect to the coordinator node.
pgsql -p 9700
  1. Execute the commands in below.
CREATE EXTENSION topn;

CREATE TABLE customer_reviews
(
    customer_id TEXT,
    review_date DATE,
    review_rating INTEGER,
    review_votes INTEGER,
    review_helpful_votes INTEGER,
    product_id CHAR(10),
    product_title TEXT,
    product_sales_rank BIGINT,
    product_group TEXT,
    product_category TEXT,
    product_subcategory TEXT,
    similar_product_ids CHAR(10)[]
);

\COPY customer_reviews FROM 'customer_reviews_2000.csv' WITH CSV;

CREATE TABLE popular_products
(
  review_date date UNIQUE,
  agg_data jsonb
);

SELECT create_distributed_table('popular_products', 'review_date');

INSERT INTO popular_products
    SELECT review_date, topn_add_agg(product_id)
    FROM customer_reviews
    GROUP BY review_date;

SELECT review_date, (topn(agg_data, 1)).*
FROM popular_products
ORDER BY review_date;


SELECT (topn(topn_union_agg(agg_data), 10)).*
FROM popular_products
WHERE review_date >= '2000-01-01' AND review_date < '2000-02-01'
ORDER BY 2 DESC;

Error:

ERROR:  set-valued function called in context that cannot accept a set
LINE 1: SELECT (topn(topn_union_agg(agg_data), 10)).*
@onderkalaci
Copy link
Member

looks similar to #32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants