Apache Lucene open-source search software
LUCENE-5799: optimize numeric docvalues merging
Robert Muirb0b4c711e84f
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex d6de0d8d076..d004f16d5fa 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -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).diff --git a/lucene/core/src/java/org/apache/lucene/codecs/DocValuesConsumer.java b/lucene/core/src/java/org/apache/lucene/codecs/DocValuesConsumer.javaindex 3b187bc910b..fea9e252500 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/DocValuesConsumer.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/DocValuesConsumer.java@@ -133,7 +133,8 @@ public abstract class DocValuesConsumer implements Closeable {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 implements Closeable {}assert nextIsSet;nextIsSet = false;- return nextValue;+ return nextHasValue ? nextValue : null;}private boolean setNext() {@@ -180,10 +181,11 @@ public abstract class DocValuesConsumer implements Closeable {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;