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

Date statistics: make "sum" a double instead of a long/date

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.0
    • Component/s: None
    • Labels:
      None

      Description

      Currently DateStatsValues#sum is defined as long, and returned as a date. This has two problems: It overflows (with ~6 million values), and the return value can be a date like <date name="sum">122366-06-12T21:06:06Z</date>. I think we should just change this stat to a double. See SOLR-8420.
      I think we can change this only in master, since it will break backward compatibility.

        Activity

        Hide
        tomsolr Tom Hill added a comment -

        This patch requires the patch in SOLR-8420 be applied first, as this patch modifies a test added in the patch for SOLR-8420.

        Show
        tomsolr Tom Hill added a comment - This patch requires the patch in SOLR-8420 be applied first, as this patch modifies a test added in the patch for SOLR-8420 .
        Hide
        tomasflobbe Tomás Fernández Löbbe added a comment -

        I added this change:

        -    return Math.sqrt(((count * sumOfSquares) - (sum * (double)sum))
        +    return Math.sqrt(((count * sumOfSquares) - (sum * sum))
        

        since sum is now a double

        Show
        tomasflobbe Tomás Fernández Löbbe added a comment - I added this change: - return Math.sqrt(((count * sumOfSquares) - (sum * (double)sum)) + return Math.sqrt(((count * sumOfSquares) - (sum * sum)) since sum is now a double
        Hide
        tomasflobbe Tomás Fernández Löbbe added a comment -

        Hmmm, for some reason the commit didn't make it to the Jira, maybe because I used a colon in the commit message.

        commit ae4d77ae488fe3c2edf0f9477d843e2433a07a7c
        Author: Tomás Fernández Löbbe <tflobbe@apache.org>
        Date:   Sat Feb 27 14:02:30 2016 -0800
        
            SOLR-8671: Date statistics: make "sum" a double instead of a long/date
        
        Show
        tomasflobbe Tomás Fernández Löbbe added a comment - Hmmm, for some reason the commit didn't make it to the Jira, maybe because I used a colon in the commit message. commit ae4d77ae488fe3c2edf0f9477d843e2433a07a7c Author: Tomás Fernández Löbbe <tflobbe@apache.org> Date: Sat Feb 27 14:02:30 2016 -0800 SOLR-8671: Date statistics: make "sum" a double instead of a long/date
        Hide
        tomasflobbe Tomás Fernández Löbbe added a comment -

        Thanks Tom!

        Show
        tomasflobbe Tomás Fernández Löbbe added a comment - Thanks Tom!

          People

          • Assignee:
            tomasflobbe Tomás Fernández Löbbe
            Reporter:
            tomasflobbe Tomás Fernández Löbbe
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development