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

Null pointerException in AbstractStatsValues.accumulate

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 4.7, 6.0
    • Fix Version/s: 4.7, 6.0
    • Component/s: None
    • Labels:
      None

      Description

      It happens when there is a string field with docValues="true" and default="".
      Then, with documents that have empty string value in the field,
      values.exists(docID) is true but values.strVal(docID) is null, and it throws null pointer exception when trying to add the value to distinctValues set.
      the solr query is stats=true&stats.field=X&stats.calcdistinct=true

      stack trace:
      java.lang.NullPointerException at java.util.TreeMap.put(TreeMap.java:567) at java.util.TreeSet.add(TreeSet.java:266) at org.apache.solr.handler.component.AbstractStatsValues.accumulate(StatsValuesFactory.java:164) at org.apache.solr.handler.component.StringStatsValues.accumulate(StatsValuesFactory.java:535) at org.apache.solr.handler.component.SimpleStats.getFieldCacheStats(StatsComponent.java:274) at org.apache.solr.handler.component.SimpleStats.getStatsFields(StatsComponent.java:225) at org.apache.solr.handler.component.SimpleStats.getStatsCounts(StatsComponent.java:200) at org.apache.solr.handler.component.StatsComponent.process(StatsComponent.java:68) at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:208) at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135) at org.apache.solr.core.SolrCore.execute(SolrCore.java:1904) at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:659) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:362) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:158) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.Server.handle(Server.java:370) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489) at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:949) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1011) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72) at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) at java.lang.Thread.run(Thread.java:804)

      1. SOLR-5690.patch
        0.8 kB
        Elran Dvir

        Issue Links

          Activity

          Hide
          elrand Elran Dvir added a comment -

          Patch resolving the issue is attached.

          Show
          elrand Elran Dvir added a comment - Patch resolving the issue is attached.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 1565106 from shalin@apache.org in branch 'dev/trunk'
          [ https://svn.apache.org/r1565106 ]

          SOLR-5690: Fix NPE in AbstractStatsValues.accumulate with docValues and docs with empty field

          Show
          jira-bot ASF subversion and git services added a comment - Commit 1565106 from shalin@apache.org in branch 'dev/trunk' [ https://svn.apache.org/r1565106 ] SOLR-5690 : Fix NPE in AbstractStatsValues.accumulate with docValues and docs with empty field
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 1565108 from shalin@apache.org in branch 'dev/branches/branch_4x'
          [ https://svn.apache.org/r1565108 ]

          SOLR-5690: Fix NPE in AbstractStatsValues.accumulate with docValues and docs with empty field

          Show
          jira-bot ASF subversion and git services added a comment - Commit 1565108 from shalin@apache.org in branch 'dev/branches/branch_4x' [ https://svn.apache.org/r1565108 ] SOLR-5690 : Fix NPE in AbstractStatsValues.accumulate with docValues and docs with empty field
          Hide
          shalinmangar Shalin Shekhar Mangar added a comment -

          Thanks Elran!

          Show
          shalinmangar Shalin Shekhar Mangar added a comment - Thanks Elran!

            People

            • Assignee:
              shalinmangar Shalin Shekhar Mangar
              Reporter:
              elrand Elran Dvir
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development