Problems with RANK()
Looks like I'm running into a problem with RANK()
. The following works:
SELECT r2_1.store__id, r2_1.month_of_year__id,
r2_1.fact_sales_sales_amt AS "amount",
RANK() OVER (PARTITION BY r2_1.store__id ORDER BY r2_1.fact_sales_sales_amt) AS "__window_pred1"
FROM
(
-- leaf_node(a, fact_sales)
SELECT fact_sales.store_id AS store__id, max_dim_date.the_month AS month_of_year__id,
SUM(fact_sales.sales_amt) AS fact_sales_sales_amt, SUM(fact_sales.tax_amt) AS fact_sales_tax_amt
FROM fact_sales
JOIN max_dim_date
ON max_dim_date.the_date = fact_sales.the_date
GROUP BY fact_sales.store_id, max_dim_date.the_month
) AS r2_1
But the following gives me an error: TIOStreamTransport.java:read:130:org.apache.thrift.transport.TTransportException: Socket is closed by peer.
SELECT r2_1.store__id, r2_1.month_of_year__id,
r2_1.fact_sales_sales_amt AS "amount",
RANK() OVER (PARTITION BY r2_1.store__id ORDER BY r2_1.fact_sales_sales_amt) AS "__window_pred1"
FROM
(
-- leaf_node(a, fact_sales)
SELECT fact_sales.store_id AS store__id, max_dim_date.the_month AS month_of_year__id,
SUM(fact_sales.sales_amt) AS fact_sales_sales_amt, SUM(fact_sales.tax_amt) AS fact_sales_tax_amt
FROM fact_sales
JOIN max_dim_date
ON max_dim_date.the_date = fact_sales.the_date
GROUP BY fact_sales.store_id, max_dim_date.the_month
) AS r2_1
I consistently lose my connection (using DBeaver) when I run this query. Is there a way to find out more details about the Omnisci error? I'm guessing that RANK()
has problems when I introduce that second node that I join to.
Please sign in to leave a comment.
Comments
1 comment