You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2014/07/01 15:06:23 UTC

svn commit: r1607065 - in /lucene/dev/trunk/lucene: CHANGES.txt core/src/java/org/apache/lucene/codecs/DocValuesConsumer.java

Author: rmuir
Date: Tue Jul  1 13:06:23 2014
New Revision: 1607065

URL: http://svn.apache.org/r1607065
Log:
LUCENE-5799: optimize numeric docvalues merging

Modified:
    lucene/dev/trunk/lucene/CHANGES.txt
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/DocValuesConsumer.java

Modified: lucene/dev/trunk/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/CHANGES.txt?rev=1607065&r1=1607064&r2=1607065&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/CHANGES.txt Tue Jul  1 13:06:23 2014
@@ -115,6 +115,8 @@ Optimizations
 
 * LUCENE-5798: Optimize MultiDocsEnum reuse. (Robert Muir)
 
+* LUCENE-5799: Optimize numeric docvalues merging. (Robert Muir)
+
 Test Framework
 
 * LUCENE-5786: Unflushed/ truncated events file (hung testing subprocess).

Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/DocValuesConsumer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/DocValuesConsumer.java?rev=1607065&r1=1607064&r2=1607065&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/DocValuesConsumer.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/DocValuesConsumer.java Tue Jul  1 13:06:23 2014
@@ -133,7 +133,8 @@ public abstract class DocValuesConsumer 
                         return new Iterator<Number>() {
                           int readerUpto = -1;
                           int docIDUpto;
-                          Long nextValue;
+                          long nextValue;
+                          boolean nextHasValue;
                           AtomicReader currentReader;
                           NumericDocValues currentValues;
                           Bits currentLiveDocs;
@@ -157,7 +158,7 @@ public abstract class DocValuesConsumer 
                             }
                             assert nextIsSet;
                             nextIsSet = false;
-                            return nextValue;
+                            return nextHasValue ? nextValue : null;
                           }
 
                           private boolean setNext() {
@@ -180,10 +181,11 @@ public abstract class DocValuesConsumer 
 
                               if (currentLiveDocs == null || currentLiveDocs.get(docIDUpto)) {
                                 nextIsSet = true;
-                                if (currentDocsWithField.get(docIDUpto)) {
-                                  nextValue = currentValues.get(docIDUpto);
+                                nextValue = currentValues.get(docIDUpto);
+                                if (nextValue == 0 && currentDocsWithField.get(docIDUpto) == false) {
+                                  nextHasValue = false;
                                 } else {
-                                  nextValue = null;
+                                  nextHasValue = true;
                                 }
                                 docIDUpto++;
                                 return true;