Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

package org.elasticsearch.search.aggregations;

import com.carrotsearch.hppc.IntIntHashMap;
import com.carrotsearch.hppc.IntIntMap;

import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
Expand All @@ -20,7 +17,9 @@
import org.elasticsearch.test.ESIntegTestCase;
import org.hamcrest.Matchers;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
import static org.elasticsearch.search.aggregations.AggregationBuilders.missing;
Expand All @@ -44,7 +43,7 @@ public void testMultipleAggsOnSameField_WithDifferentRequiredValueSourceType() t

createIndex("idx");
IndexRequestBuilder[] builders = new IndexRequestBuilder[randomInt(30)];
IntIntMap values = new IntIntHashMap();
Map<Integer, Integer> values = new HashMap<>();
long missingValues = 0;
for (int i = 0; i < builders.length; i++) {
String name = "name_" + randomIntBetween(1, 10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

package org.elasticsearch.search.aggregations;

import com.carrotsearch.hppc.IntHashSet;

import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
Expand Down Expand Up @@ -39,9 +37,11 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;

import static org.elasticsearch.search.aggregations.AggregationBuilders.extendedStats;
Expand Down Expand Up @@ -207,7 +207,7 @@ public void testDuelTerms() throws Exception {
final int numDocs = scaledRandomIntBetween(1000, 2000);
final int maxNumTerms = randomIntBetween(10, 5000);

final IntHashSet valuesSet = new IntHashSet();
final Set<Integer> valuesSet = new HashSet<>();
cluster().wipeIndices("idx");
prepareCreate("idx").setMapping(
jsonBuilder().startObject()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
*/
package org.elasticsearch.search.aggregations.bucket;

import com.carrotsearch.hppc.ObjectIntHashMap;
import com.carrotsearch.hppc.ObjectIntMap;
import com.carrotsearch.hppc.cursors.ObjectIntCursor;

import org.elasticsearch.Version;
import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
Expand All @@ -29,8 +25,10 @@

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;

Expand All @@ -53,8 +51,8 @@ protected boolean forbidPrivateIndexSettings() {

private Version version = VersionUtils.randomIndexCompatibleVersion(random());

static ObjectIntMap<String> expectedDocCountsForGeoHash = null;
static ObjectIntMap<String> multiValuedExpectedDocCountsForGeoHash = null;
static Map<String, Integer> expectedDocCountsForGeoHash = null;
static Map<String, Integer> multiValuedExpectedDocCountsForGeoHash = null;
static int numDocs = 100;

static String smallestGeoHash = null;
Expand Down Expand Up @@ -82,7 +80,7 @@ public void setupSuiteScopeCluster() throws Exception {

List<IndexRequestBuilder> cities = new ArrayList<>();
Random random = random();
expectedDocCountsForGeoHash = new ObjectIntHashMap<>(numDocs * 2);
expectedDocCountsForGeoHash = new HashMap<>(numDocs * 2);
for (int i = 0; i < numDocs; i++) {
// generate random point
double lat = (180d * random.nextDouble()) - 90d;
Expand All @@ -107,7 +105,7 @@ public void setupSuiteScopeCluster() throws Exception {
);

cities = new ArrayList<>();
multiValuedExpectedDocCountsForGeoHash = new ObjectIntHashMap<>(numDocs * 2);
multiValuedExpectedDocCountsForGeoHash = new HashMap<>(numDocs * 2);
for (int i = 0; i < numDocs; i++) {
final int numPoints = random.nextInt(4);
List<String> points = new ArrayList<>();
Expand Down Expand Up @@ -256,9 +254,9 @@ public void testTopMatch() throws Exception {
String geohash = cell.getKeyAsString();
long bucketCount = cell.getDocCount();
int expectedBucketCount = 0;
for (ObjectIntCursor<String> cursor : expectedDocCountsForGeoHash) {
if (cursor.key.length() == precision) {
expectedBucketCount = Math.max(expectedBucketCount, cursor.value);
for (var entry : expectedDocCountsForGeoHash.entrySet()) {
if (entry.getKey().length() == precision) {
expectedBucketCount = Math.max(expectedBucketCount, entry.getValue());
}
}
assertNotSame(bucketCount, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
*/
package org.elasticsearch.search.aggregations.bucket;

import com.carrotsearch.hppc.LongHashSet;

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.search.SearchPhaseExecutionException;
Expand Down Expand Up @@ -38,8 +36,10 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;

import static java.util.Collections.emptyMap;
Expand Down Expand Up @@ -373,7 +373,7 @@ public void testSingleValuedFieldOrderedByCountAsc() throws Exception {
assertThat(histo.getName(), equalTo("histo"));
assertThat(histo.getBuckets().size(), equalTo(numValueBuckets));

LongHashSet buckets = new LongHashSet();
Set<Long> buckets = new HashSet<>();
List<Histogram.Bucket> histoBuckets = new ArrayList<>(histo.getBuckets());
long previousCount = Long.MIN_VALUE;
for (int i = 0; i < numValueBuckets; ++i) {
Expand All @@ -400,7 +400,7 @@ public void testSingleValuedFieldOrderedByCountDesc() throws Exception {
assertThat(histo.getName(), equalTo("histo"));
assertThat(histo.getBuckets().size(), equalTo(numValueBuckets));

LongHashSet buckets = new LongHashSet();
Set<Long> buckets = new HashSet<>();
List<Histogram.Bucket> histoBuckets = new ArrayList<>(histo.getBuckets());
long previousCount = Long.MAX_VALUE;
for (int i = 0; i < numValueBuckets; ++i) {
Expand Down Expand Up @@ -474,7 +474,7 @@ public void testSingleValuedFieldOrderedBySubAggregationAsc() throws Exception {
assertThat(histo.getName(), equalTo("histo"));
assertThat(histo.getBuckets().size(), equalTo(numValueBuckets));

LongHashSet visited = new LongHashSet();
Set<Long> visited = new HashSet<>();
double previousSum = Double.NEGATIVE_INFINITY;
List<Histogram.Bucket> buckets = new ArrayList<>(histo.getBuckets());
for (int i = 0; i < numValueBuckets; ++i) {
Expand Down Expand Up @@ -516,7 +516,7 @@ public void testSingleValuedFieldOrderedBySubAggregationDesc() throws Exception
assertThat(histo.getName(), equalTo("histo"));
assertThat(histo.getBuckets().size(), equalTo(numValueBuckets));

LongHashSet visited = new LongHashSet();
Set<Long> visited = new HashSet<>();
double previousSum = Double.POSITIVE_INFINITY;
List<Histogram.Bucket> buckets = new ArrayList<>(histo.getBuckets());
for (int i = 0; i < numValueBuckets; ++i) {
Expand Down Expand Up @@ -558,7 +558,7 @@ public void testSingleValuedFieldOrderedByMultiValuedSubAggregationDesc() throws
assertThat(histo.getName(), equalTo("histo"));
assertThat(histo.getBuckets().size(), equalTo(numValueBuckets));

LongHashSet visited = new LongHashSet();
Set<Long> visited = new HashSet<>();
double previousSum = Double.POSITIVE_INFINITY;

List<Histogram.Bucket> buckets = new ArrayList<>(histo.getBuckets());
Expand Down Expand Up @@ -602,7 +602,7 @@ public void testSingleValuedFieldOrderedBySubAggregationDescDeepOrderPath() thro
assertThat(histo.getName(), equalTo("histo"));
assertThat(histo.getBuckets().size(), equalTo(numValueBuckets));

LongHashSet visited = new LongHashSet();
Set<Long> visited = new HashSet<>();
double prevMax = asc ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY;
List<Histogram.Bucket> buckets = new ArrayList<>(histo.getBuckets());
for (int i = 0; i < numValueBuckets; ++i) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

package org.elasticsearch.search.aggregations.bucket;

import com.carrotsearch.hppc.LongHashSet;
import com.carrotsearch.hppc.LongSet;
import com.carrotsearch.randomizedtesting.generators.RandomStrings;

import org.elasticsearch.action.index.IndexRequestBuilder;
Expand Down Expand Up @@ -99,7 +97,7 @@ public void setupSuiteScopeCluster() throws Exception {
cardinality = randomIntBetween(8, 30);
final List<IndexRequestBuilder> indexRequests = new ArrayList<>();
final Set<String> stringTerms = new HashSet<>();
final LongSet longTerms = new LongHashSet();
final Set<Long> longTerms = new HashSet<>();
for (int i = 0; i < cardinality; ++i) {
String stringTerm;
do {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

package org.elasticsearch.search.scroll;

import com.carrotsearch.hppc.IntHashSet;
import com.carrotsearch.randomizedtesting.generators.RandomPicks;

import org.elasticsearch.action.index.IndexRequestBuilder;
Expand All @@ -26,6 +25,8 @@
import org.elasticsearch.test.ESIntegTestCase;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
Expand Down Expand Up @@ -124,7 +125,7 @@ private TestContext create(SearchType... searchTypes) throws Exception {
boolean unevenRouting = randomBoolean();

int numMissingDocs = scaledRandomIntBetween(0, numDocs / 100);
IntHashSet missingDocs = new IntHashSet(numMissingDocs);
Set<Integer> missingDocs = new HashSet<>(numMissingDocs);
for (int i = 0; i < numMissingDocs; i++) {
while (missingDocs.add(randomInt(numDocs)) == false) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

package org.elasticsearch.snapshots;

import com.carrotsearch.hppc.IntHashSet;
import com.carrotsearch.hppc.IntSet;

import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -79,8 +76,10 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -440,7 +439,7 @@ public boolean clearData(String nodeName) {

ensureGreen("test-idx");

IntSet reusedShards = new IntHashSet();
Set<Integer> reusedShards = new HashSet<>();
List<RecoveryState> recoveryStates = client().admin()
.indices()
.prepareRecoveries("test-idx")
Expand Down