[ 
https://issues.apache.org/jira/browse/SOLR-9691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15605474#comment-15605474
 ] 

Dennis Gove commented on SOLR-9691:
-----------------------------------

I suspect it's seeing count(\*) and considering it an expression representing 
CountMetric. Try quoting the field name to get around this
{code}
sum("count(*)")
{code}

> Streaming expressions need to be able to use a metric computed by the facet 
> stream as a field in other streams.
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-9691
>                 URL: https://issues.apache.org/jira/browse/SOLR-9691
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: Parallel SQL
>    Affects Versions: 6.2.1
>            Reporter: Timothy Potter
>
> 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:
> {code}
> 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(*))
> )
> {code}
> 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:
> {code}
> {
>   "result-set": {
>     "docs": [
>       {
>         "product_id": "1234",
>         "count(*)": 4,
>         "model_num": "X"
>       },
>       {
>         "product_id": "5678",
>         "count(*)": 5,
>         "model_num": "Y"
>       },
>       ...
>     ]
>   }
> }
> {code}
> This works, but the outer rollup doesn't recognize the count(*) as a field. I 
> get this error:
> {code}
> {
>   "result-set": {
>     "docs": [
>       {
>         "EXCEPTION": "Invalid expression sum(count(*)) - expected 
> sum(columnName)",
>         "EOF": true
>       }
>     ]
>   }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to