You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ro...@apache.org on 2019/01/15 10:38:22 UTC
[lucene-solr] 03/09: Remove deprecated BlockJoinSelector helper
methods
This is an automated email from the ASF dual-hosted git repository.
romseygeek pushed a commit to branch master-deprecations
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
commit 28e50115bd903fe4e335cf1a58171ce6864764fc
Author: Alan Woodward <ro...@apache.org>
AuthorDate: Mon Jan 14 14:20:54 2019 +0000
Remove deprecated BlockJoinSelector helper methods
---
.../lucene/search/join/BlockJoinSelector.java | 38 ----------------------
.../search/join/ToParentBlockJoinSortField.java | 11 ++++---
.../lucene/search/join/TestBlockJoinSelector.java | 17 ++++++----
3 files changed, 17 insertions(+), 49 deletions(-)
diff --git a/lucene/join/src/java/org/apache/lucene/search/join/BlockJoinSelector.java b/lucene/join/src/java/org/apache/lucene/search/join/BlockJoinSelector.java
index 79c35b8..9f45fdc 100644
--- a/lucene/join/src/java/org/apache/lucene/search/join/BlockJoinSelector.java
+++ b/lucene/join/src/java/org/apache/lucene/search/join/BlockJoinSelector.java
@@ -25,7 +25,6 @@ import org.apache.lucene.search.SortField;
import org.apache.lucene.search.SortedNumericSelector;
import org.apache.lucene.search.SortedSetSelector;
import org.apache.lucene.util.BitSet;
-import org.apache.lucene.util.BitSetIterator;
import org.apache.lucene.util.Bits;
/** Select a value from a block of documents.
@@ -77,14 +76,6 @@ public class BlockJoinSelector {
/** Wraps the provided {@link SortedSetDocValues} in order to only select
* one value per parent among its {@code children} using the configured
* {@code selection} type. */
- @Deprecated
- public static SortedDocValues wrap(SortedSetDocValues sortedSet, Type selection, BitSet parents, BitSet children) {
- return wrap(sortedSet, selection, parents, toIter(children));
- }
-
- /** Wraps the provided {@link SortedSetDocValues} in order to only select
- * one value per parent among its {@code children} using the configured
- * {@code selection} type. */
public static SortedDocValues wrap(SortedSetDocValues sortedSet, Type selection, BitSet parents, DocIdSetIterator children) {
SortedDocValues values;
switch (selection) {
@@ -99,14 +90,6 @@ public class BlockJoinSelector {
}
return wrap(values, selection, parents, children);
}
-
- /** Wraps the provided {@link SortedDocValues} in order to only select
- * one value per parent among its {@code children} using the configured
- * {@code selection} type. */
- @Deprecated
- public static SortedDocValues wrap(final SortedDocValues values, Type selection, BitSet parents, BitSet children) {
- return wrap(values, selection, parents, toIter(children));
- }
/** Wraps the provided {@link SortedDocValues} in order to only select
* one value per parent among its {@code children} using the configured
@@ -117,19 +100,6 @@ public class BlockJoinSelector {
}
return ToParentDocValues.wrap(values, selection, parents, children);
}
-
- /** Wraps the provided {@link SortedNumericDocValues} in order to only select
- * one value per parent among its {@code children} using the configured
- * {@code selection} type. */
- @Deprecated
- public static NumericDocValues wrap(SortedNumericDocValues sortedNumerics, Type selection, BitSet parents, BitSet children) {
- return wrap(sortedNumerics, selection, parents, toIter(children));
- }
-
- /** creates an iterator for the given bitset */
- protected static BitSetIterator toIter(BitSet children) {
- return new BitSetIterator(children, 0);
- }
/** Wraps the provided {@link SortedNumericDocValues} in order to only select
* one value per parent among its {@code children} using the configured
@@ -152,14 +122,6 @@ public class BlockJoinSelector {
/** Wraps the provided {@link NumericDocValues}, iterating over only
* child documents, in order to only select one value per parent among
* its {@code children} using the configured {@code selection} type. */
- @Deprecated
- public static NumericDocValues wrap(final NumericDocValues values, Type selection, BitSet parents, BitSet children) {
- return wrap(values,selection, parents, toIter(children));
- }
-
- /** Wraps the provided {@link NumericDocValues}, iterating over only
- * child documents, in order to only select one value per parent among
- * its {@code children} using the configured {@code selection} type. */
public static NumericDocValues wrap(final NumericDocValues values, Type selection, BitSet parents, DocIdSetIterator children) {
if (values.docID() != -1) {
throw new IllegalArgumentException("values iterator was already consumed: values.docID=" + values.docID());
diff --git a/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinSortField.java b/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinSortField.java
index fef167e..9c0450a 100644
--- a/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinSortField.java
+++ b/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinSortField.java
@@ -28,6 +28,7 @@ import org.apache.lucene.index.SortedSetDocValues;
import org.apache.lucene.search.FieldComparator;
import org.apache.lucene.search.SortField;
import org.apache.lucene.util.BitSet;
+import org.apache.lucene.util.BitSetIterator;
import org.apache.lucene.util.NumericUtils;
/**
@@ -118,7 +119,7 @@ public class ToParentBlockJoinSortField extends SortField {
if (children == null) {
return DocValues.emptySorted();
}
- return BlockJoinSelector.wrap(sortedSet, type, parents, children);
+ return BlockJoinSelector.wrap(sortedSet, type, parents, new BitSetIterator(children, 0));
}
};
@@ -137,7 +138,7 @@ public class ToParentBlockJoinSortField extends SortField {
if (children == null) {
return DocValues.emptyNumeric();
}
- return BlockJoinSelector.wrap(sortedNumeric, type, parents, children);
+ return BlockJoinSelector.wrap(sortedNumeric, type, parents, new BitSetIterator(children, 0));
}
};
}
@@ -155,7 +156,7 @@ public class ToParentBlockJoinSortField extends SortField {
if (children == null) {
return DocValues.emptyNumeric();
}
- return BlockJoinSelector.wrap(sortedNumeric, type, parents, children);
+ return BlockJoinSelector.wrap(sortedNumeric, type, parents, new BitSetIterator(children, 0));
}
};
}
@@ -173,7 +174,7 @@ public class ToParentBlockJoinSortField extends SortField {
if (children == null) {
return DocValues.emptyNumeric();
}
- return new FilterNumericDocValues(BlockJoinSelector.wrap(sortedNumeric, type, parents, children)) {
+ return new FilterNumericDocValues(BlockJoinSelector.wrap(sortedNumeric, type, parents, new BitSetIterator(children, 0))) {
@Override
public long longValue() throws IOException {
// undo the numericutils sortability
@@ -197,7 +198,7 @@ public class ToParentBlockJoinSortField extends SortField {
if (children == null) {
return DocValues.emptyNumeric();
}
- return new FilterNumericDocValues(BlockJoinSelector.wrap(sortedNumeric, type, parents, children)) {
+ return new FilterNumericDocValues(BlockJoinSelector.wrap(sortedNumeric, type, parents, new BitSetIterator(children, 0))) {
@Override
public long longValue() throws IOException {
// undo the numericutils sortability
diff --git a/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinSelector.java b/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinSelector.java
index 838826f..502ed64 100644
--- a/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinSelector.java
+++ b/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinSelector.java
@@ -16,8 +16,6 @@
*/
package org.apache.lucene.search.join;
-import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
-
import java.io.IOException;
import java.util.Arrays;
import java.util.Random;
@@ -27,11 +25,14 @@ import org.apache.lucene.index.NumericDocValues;
import org.apache.lucene.index.SortedDocValues;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.util.BitSet;
+import org.apache.lucene.util.BitSetIterator;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.FixedBitSet;
import org.apache.lucene.util.LuceneTestCase;
+import static org.apache.lucene.search.DocIdSetIterator.NO_MORE_DOCS;
+
public class TestBlockJoinSelector extends LuceneTestCase {
public void testDocsWithValue() {
@@ -132,14 +133,16 @@ public class TestBlockJoinSelector extends LuceneTestCase {
ords[12] = 10;
ords[18] = 10;
- final SortedDocValues mins = BlockJoinSelector.wrap(DocValues.singleton(new CannedSortedDocValues(ords)), BlockJoinSelector.Type.MIN, parents, children);
+ final SortedDocValues mins = BlockJoinSelector.wrap(DocValues.singleton(new CannedSortedDocValues(ords)),
+ BlockJoinSelector.Type.MIN, parents, new BitSetIterator(children, 0));
assertEquals(5, nextDoc(mins,5));
assertEquals(3, mins.ordValue());
assertEquals(15, nextDoc(mins,15));
assertEquals(10, mins.ordValue());
assertNoMoreDoc(mins, 20);
- final SortedDocValues maxs = BlockJoinSelector.wrap(DocValues.singleton(new CannedSortedDocValues(ords)), BlockJoinSelector.Type.MAX, parents, children);
+ final SortedDocValues maxs = BlockJoinSelector.wrap(DocValues.singleton(new CannedSortedDocValues(ords)),
+ BlockJoinSelector.Type.MAX, parents, new BitSetIterator(children, 0));
assertEquals(5, nextDoc(maxs,5));
assertEquals(7, maxs.ordValue());
assertEquals(15, nextDoc(maxs,15));
@@ -246,14 +249,16 @@ public class TestBlockJoinSelector extends LuceneTestCase {
docsWithValue.set(18);
longs[18] = 10;
- final NumericDocValues mins = BlockJoinSelector.wrap(DocValues.singleton(new CannedNumericDocValues(longs, docsWithValue)), BlockJoinSelector.Type.MIN, parents, children);
+ final NumericDocValues mins = BlockJoinSelector.wrap(DocValues.singleton(new CannedNumericDocValues(longs, docsWithValue)),
+ BlockJoinSelector.Type.MIN, parents, new BitSetIterator(children, 0));
assertEquals(5, nextDoc(mins,5));
assertEquals(3, mins.longValue());
assertEquals(15, nextDoc(mins,15));
assertEquals(10, mins.longValue());
assertNoMoreDoc(mins, 20);
- final NumericDocValues maxs = BlockJoinSelector.wrap(DocValues.singleton(new CannedNumericDocValues(longs, docsWithValue)), BlockJoinSelector.Type.MAX, parents, children);
+ final NumericDocValues maxs = BlockJoinSelector.wrap(DocValues.singleton(new CannedNumericDocValues(longs, docsWithValue)),
+ BlockJoinSelector.Type.MAX, parents, new BitSetIterator(children, 0));
assertEquals(5, nextDoc(maxs, 5));
assertEquals(7, maxs.longValue());
assertEquals(15, nextDoc(maxs, 15));