Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-9691

Streaming expressions need to be able to use a metric computed by the facet stream as a field in other streams.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 6.2.1
    • None
    • Parallel SQL
    • 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
            }
          ]
        }
      }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            thelabdude Timothy Potter
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: