Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
6.2.1
-
None
-
None
Description
Using 6.2.1, I want to use a facet stream to do an intermediate count and then sum up the counts in a rollup stream, i.e. something like:
rollup( sort( hashJoin( search(products, q="*:*", fl="product_id,model_num", sort="product_id asc", qt="/export", partitionKeys="product_id"), hashed=facet(transactions, q="*:*", buckets="product_id", bucketSizeLimit=1000000, bucketSorts="product_id asc", count(*)), on="product_id" ), by="model_num asc" ), over="model_num", sum(count(*)) )
Basically, I want to get a count of each product_id from the transactions collection (# of transactions per product) and then join that with the products table to generate a projection containing:
{ "result-set": { "docs": [ { "product_id": "1234", "count(*)": 4, "model_num": "X" }, { "product_id": "5678", "count(*)": 5, "model_num": "Y" }, ... ] } }
This works, but the outer rollup doesn't recognize the count as a field. I get this error:
{ "result-set": { "docs": [ { "EXCEPTION": "Invalid expression sum(count(*)) - expected sum(columnName)", "EOF": true } ] } }