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

Export handler returns zero for numeric fields that are not in the original doc

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 6.4, 7.0
    • None
    • None

    Description

      From the dev list discussion:

      My original post.
      Zero is different from not
      existing. And let's claim that I want to process a stream and, say,
      facet on in integer field over the result set. There's no way on the
      client side to distinguish between a document that has a zero in the
      field and one that didn't have the field in the first place so I'll
      over-count the zero bucket.

      From Dennis Gove:
      Is this true for non-numeric fields as well? I agree that this seems like a very bad thing.

      I can't imagine that a fix would cause a problem with Streaming Expressions, ParallelSQL, or other given that the /select handler is not returning 0 for these missing fields (the /select handler is the default handler for the Streaming API so if nulls were a problem I imagine we'd have already seen it).

      That said, within Streaming Expressions there is a select(...) function which supports a replace(...) operation which allows you to replace one value (or null) with some other value. If a 0 were necessary one could use a select(...) to replace null with 0 using an expression like this
      select(<stream>, replace(fieldA, null, withValue=0)).
      The end result of that would be that the field fieldA would never have a null value and for all tuples where a null value existed it would be replaced with 0.

      Details on the select function can be found at https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61330338#StreamingExpressions-select.

      And to answer Denis' question, null gets returned for string DocValues fields.

      Attachments

        1. SOLR-9166-6x.patch
          14 kB
          Erick Erickson
        2. SOLR-9166.patch
          2 kB
          Erick Erickson
        3. SOLR-9166.patch
          27 kB
          Erick Erickson
        4. SOLR-9166.patch
          13 kB
          Erick Erickson
        5. SOLR-9166.patch
          14 kB
          Erick Erickson

        Issue Links

          Activity

            People

              erickerickson Erick Erickson
              erickerickson Erick Erickson
              Votes:
              3 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: