From f488dce18f86f93444a9755837a002a826cd0a70 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Wed, 26 Feb 2014 20:33:59 +0100 Subject: [PATCH] Moved AbstractHash, BytesRefHash and LongHash to o.e.common.util --- .../aggregations/bucket => common/util}/AbstractHash.java | 4 +--- .../aggregations/bucket => common/util}/BytesRefHash.java | 3 +-- .../{search/aggregations/bucket => common/util}/LongHash.java | 4 +--- .../index/search/child/ChildrenConstantScoreQuery.java | 2 +- .../org/elasticsearch/index/search/child/ChildrenQuery.java | 2 +- .../index/search/child/ParentConstantScoreQuery.java | 2 +- .../org/elasticsearch/index/search/child/ParentIdsFilter.java | 2 +- .../org/elasticsearch/index/search/child/ParentQuery.java | 2 +- .../aggregations/bucket/geogrid/GeoHashGridAggregator.java | 2 +- .../aggregations/bucket/histogram/HistogramAggregator.java | 2 +- .../aggregations/bucket/terms/DoubleTermsAggregator.java | 2 +- .../search/aggregations/bucket/terms/LongTermsAggregator.java | 2 +- .../aggregations/bucket/terms/StringTermsAggregator.java | 2 +- .../bucket => common/util}/BytesRefHashTests.java | 3 +-- .../aggregations/bucket => common/util}/LongHashTests.java | 3 ++- 15 files changed, 16 insertions(+), 21 deletions(-) rename src/main/java/org/elasticsearch/{search/aggregations/bucket => common/util}/AbstractHash.java (97%) rename src/main/java/org/elasticsearch/{search/aggregations/bucket => common/util}/BytesRefHash.java (98%) rename src/main/java/org/elasticsearch/{search/aggregations/bucket => common/util}/LongHash.java (96%) rename src/test/java/org/elasticsearch/{search/aggregations/bucket => common/util}/BytesRefHashTests.java (98%) rename src/test/java/org/elasticsearch/{search/aggregations/bucket => common/util}/LongHashTests.java (96%) diff --git a/src/main/java/org/elasticsearch/search/aggregations/bucket/AbstractHash.java b/src/main/java/org/elasticsearch/common/util/AbstractHash.java similarity index 97% rename from src/main/java/org/elasticsearch/search/aggregations/bucket/AbstractHash.java rename to src/main/java/org/elasticsearch/common/util/AbstractHash.java index 5085ef71a8f..da2ba8e4ac5 100644 --- a/src/main/java/org/elasticsearch/search/aggregations/bucket/AbstractHash.java +++ b/src/main/java/org/elasticsearch/common/util/AbstractHash.java @@ -17,14 +17,12 @@ * under the License. */ -package org.elasticsearch.search.aggregations.bucket; +package org.elasticsearch.common.util; import com.google.common.base.Preconditions; import org.elasticsearch.cache.recycler.PageCacheRecycler; import org.elasticsearch.common.lease.Releasable; import org.elasticsearch.common.lease.Releasables; -import org.elasticsearch.common.util.BigArrays; -import org.elasticsearch.common.util.LongArray; /** * Base implementation for {@link BytesRefHash} and {@link LongHash}. diff --git a/src/main/java/org/elasticsearch/search/aggregations/bucket/BytesRefHash.java b/src/main/java/org/elasticsearch/common/util/BytesRefHash.java similarity index 98% rename from src/main/java/org/elasticsearch/search/aggregations/bucket/BytesRefHash.java rename to src/main/java/org/elasticsearch/common/util/BytesRefHash.java index baa51b426de..5ed15cc432e 100644 --- a/src/main/java/org/elasticsearch/search/aggregations/bucket/BytesRefHash.java +++ b/src/main/java/org/elasticsearch/common/util/BytesRefHash.java @@ -17,13 +17,12 @@ * under the License. */ -package org.elasticsearch.search.aggregations.bucket; +package org.elasticsearch.common.util; import com.carrotsearch.hppc.hash.MurmurHash3; import org.apache.lucene.util.BytesRef; import org.elasticsearch.cache.recycler.PageCacheRecycler; import org.elasticsearch.common.lease.Releasables; -import org.elasticsearch.common.util.*; /** * Specialized hash table implementation similar to Lucene's BytesRefHash that maps diff --git a/src/main/java/org/elasticsearch/search/aggregations/bucket/LongHash.java b/src/main/java/org/elasticsearch/common/util/LongHash.java similarity index 96% rename from src/main/java/org/elasticsearch/search/aggregations/bucket/LongHash.java rename to src/main/java/org/elasticsearch/common/util/LongHash.java index d701b7828b5..f235cfd262a 100644 --- a/src/main/java/org/elasticsearch/search/aggregations/bucket/LongHash.java +++ b/src/main/java/org/elasticsearch/common/util/LongHash.java @@ -17,13 +17,11 @@ * under the License. */ -package org.elasticsearch.search.aggregations.bucket; +package org.elasticsearch.common.util; import com.carrotsearch.hppc.hash.MurmurHash3; import org.elasticsearch.cache.recycler.PageCacheRecycler; import org.elasticsearch.common.lease.Releasables; -import org.elasticsearch.common.util.BigArrays; -import org.elasticsearch.common.util.LongArray; /** * Specialized hash table implementation similar to BytesRefHash that maps diff --git a/src/main/java/org/elasticsearch/index/search/child/ChildrenConstantScoreQuery.java b/src/main/java/org/elasticsearch/index/search/child/ChildrenConstantScoreQuery.java index 83714d246d5..e6c1ea5b117 100644 --- a/src/main/java/org/elasticsearch/index/search/child/ChildrenConstantScoreQuery.java +++ b/src/main/java/org/elasticsearch/index/search/child/ChildrenConstantScoreQuery.java @@ -39,7 +39,7 @@ import org.elasticsearch.index.fielddata.ordinals.Ordinals; import org.elasticsearch.index.fielddata.plain.ParentChildIndexFieldData; import org.elasticsearch.index.mapper.Uid; import org.elasticsearch.index.mapper.internal.UidFieldMapper; -import org.elasticsearch.search.aggregations.bucket.BytesRefHash; +import org.elasticsearch.common.util.BytesRefHash; import org.elasticsearch.search.internal.SearchContext; import java.io.IOException; diff --git a/src/main/java/org/elasticsearch/index/search/child/ChildrenQuery.java b/src/main/java/org/elasticsearch/index/search/child/ChildrenQuery.java index e1b4b3f66a9..8a97ef841bc 100644 --- a/src/main/java/org/elasticsearch/index/search/child/ChildrenQuery.java +++ b/src/main/java/org/elasticsearch/index/search/child/ChildrenQuery.java @@ -44,7 +44,7 @@ import org.elasticsearch.index.fielddata.ordinals.Ordinals; import org.elasticsearch.index.fielddata.plain.ParentChildIndexFieldData; import org.elasticsearch.index.mapper.Uid; import org.elasticsearch.index.mapper.internal.UidFieldMapper; -import org.elasticsearch.search.aggregations.bucket.BytesRefHash; +import org.elasticsearch.common.util.BytesRefHash; import org.elasticsearch.search.internal.SearchContext; import java.io.IOException; diff --git a/src/main/java/org/elasticsearch/index/search/child/ParentConstantScoreQuery.java b/src/main/java/org/elasticsearch/index/search/child/ParentConstantScoreQuery.java index 751fe771eb0..cedbd475f11 100644 --- a/src/main/java/org/elasticsearch/index/search/child/ParentConstantScoreQuery.java +++ b/src/main/java/org/elasticsearch/index/search/child/ParentConstantScoreQuery.java @@ -34,7 +34,7 @@ import org.elasticsearch.common.lucene.search.Queries; import org.elasticsearch.index.fielddata.BytesValues; import org.elasticsearch.index.fielddata.ordinals.Ordinals; import org.elasticsearch.index.fielddata.plain.ParentChildIndexFieldData; -import org.elasticsearch.search.aggregations.bucket.BytesRefHash; +import org.elasticsearch.common.util.BytesRefHash; import org.elasticsearch.search.internal.SearchContext; import java.io.IOException; diff --git a/src/main/java/org/elasticsearch/index/search/child/ParentIdsFilter.java b/src/main/java/org/elasticsearch/index/search/child/ParentIdsFilter.java index 32b959602b3..17c4f9a888f 100644 --- a/src/main/java/org/elasticsearch/index/search/child/ParentIdsFilter.java +++ b/src/main/java/org/elasticsearch/index/search/child/ParentIdsFilter.java @@ -30,7 +30,7 @@ import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.FixedBitSet; import org.elasticsearch.index.mapper.Uid; import org.elasticsearch.index.mapper.internal.UidFieldMapper; -import org.elasticsearch.search.aggregations.bucket.BytesRefHash; +import org.elasticsearch.common.util.BytesRefHash; import java.io.IOException; diff --git a/src/main/java/org/elasticsearch/index/search/child/ParentQuery.java b/src/main/java/org/elasticsearch/index/search/child/ParentQuery.java index 4516fbdbc3a..b66e4e3ebdb 100644 --- a/src/main/java/org/elasticsearch/index/search/child/ParentQuery.java +++ b/src/main/java/org/elasticsearch/index/search/child/ParentQuery.java @@ -38,7 +38,7 @@ import org.elasticsearch.common.util.LongArray; import org.elasticsearch.index.fielddata.BytesValues; import org.elasticsearch.index.fielddata.ordinals.Ordinals; import org.elasticsearch.index.fielddata.plain.ParentChildIndexFieldData; -import org.elasticsearch.search.aggregations.bucket.BytesRefHash; +import org.elasticsearch.common.util.BytesRefHash; import org.elasticsearch.search.internal.SearchContext; import java.io.IOException; diff --git a/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregator.java b/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregator.java index 79f8c495ceb..e5f70b3f681 100644 --- a/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregator.java +++ b/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregator.java @@ -25,7 +25,7 @@ import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; -import org.elasticsearch.search.aggregations.bucket.LongHash; +import org.elasticsearch.common.util.LongHash; import org.elasticsearch.search.aggregations.support.AggregationContext; import org.elasticsearch.search.aggregations.support.numeric.NumericValuesSource; diff --git a/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregator.java b/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregator.java index 7d10c351e9f..55ca02073c2 100644 --- a/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregator.java +++ b/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/HistogramAggregator.java @@ -28,7 +28,7 @@ import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; -import org.elasticsearch.search.aggregations.bucket.LongHash; +import org.elasticsearch.common.util.LongHash; import org.elasticsearch.search.aggregations.support.AggregationContext; import org.elasticsearch.search.aggregations.support.ValueSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; diff --git a/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/DoubleTermsAggregator.java b/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/DoubleTermsAggregator.java index c17275e232c..16330da1d83 100644 --- a/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/DoubleTermsAggregator.java +++ b/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/DoubleTermsAggregator.java @@ -24,7 +24,7 @@ import org.elasticsearch.index.fielddata.DoubleValues; import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; -import org.elasticsearch.search.aggregations.bucket.LongHash; +import org.elasticsearch.common.util.LongHash; import org.elasticsearch.search.aggregations.bucket.terms.support.BucketPriorityQueue; import org.elasticsearch.search.aggregations.support.AggregationContext; import org.elasticsearch.search.aggregations.support.numeric.NumericValuesSource; diff --git a/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/LongTermsAggregator.java b/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/LongTermsAggregator.java index 691dc4600ff..faacc467d77 100644 --- a/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/LongTermsAggregator.java +++ b/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/LongTermsAggregator.java @@ -24,7 +24,7 @@ import org.elasticsearch.index.fielddata.LongValues; import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; -import org.elasticsearch.search.aggregations.bucket.LongHash; +import org.elasticsearch.common.util.LongHash; import org.elasticsearch.search.aggregations.bucket.terms.support.BucketPriorityQueue; import org.elasticsearch.search.aggregations.support.AggregationContext; import org.elasticsearch.search.aggregations.support.numeric.NumericValuesSource; diff --git a/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsAggregator.java b/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsAggregator.java index 7d54338a31a..5dd01a3e2d9 100644 --- a/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsAggregator.java +++ b/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsAggregator.java @@ -33,7 +33,7 @@ import org.elasticsearch.index.fielddata.ordinals.Ordinals; import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; -import org.elasticsearch.search.aggregations.bucket.BytesRefHash; +import org.elasticsearch.common.util.BytesRefHash; import org.elasticsearch.search.aggregations.bucket.terms.support.BucketPriorityQueue; import org.elasticsearch.search.aggregations.bucket.terms.support.IncludeExclude; import org.elasticsearch.search.aggregations.support.AggregationContext; diff --git a/src/test/java/org/elasticsearch/search/aggregations/bucket/BytesRefHashTests.java b/src/test/java/org/elasticsearch/common/util/BytesRefHashTests.java similarity index 98% rename from src/test/java/org/elasticsearch/search/aggregations/bucket/BytesRefHashTests.java rename to src/test/java/org/elasticsearch/common/util/BytesRefHashTests.java index bd354d72237..43db0c52bac 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/bucket/BytesRefHashTests.java +++ b/src/test/java/org/elasticsearch/common/util/BytesRefHashTests.java @@ -17,14 +17,13 @@ * under the License. */ -package org.elasticsearch.search.aggregations.bucket; +package org.elasticsearch.common.util; import com.carrotsearch.hppc.ObjectLongMap; import com.carrotsearch.hppc.ObjectLongOpenHashMap; import com.carrotsearch.hppc.cursors.ObjectLongCursor; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util._TestUtil; -import org.elasticsearch.common.util.BigArraysTests; import org.elasticsearch.test.ElasticsearchTestCase; import org.junit.Test; diff --git a/src/test/java/org/elasticsearch/search/aggregations/bucket/LongHashTests.java b/src/test/java/org/elasticsearch/common/util/LongHashTests.java similarity index 96% rename from src/test/java/org/elasticsearch/search/aggregations/bucket/LongHashTests.java rename to src/test/java/org/elasticsearch/common/util/LongHashTests.java index c9c7d6c6153..f62f05016a1 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/bucket/LongHashTests.java +++ b/src/test/java/org/elasticsearch/common/util/LongHashTests.java @@ -17,12 +17,13 @@ * under the License. */ -package org.elasticsearch.search.aggregations.bucket; +package org.elasticsearch.common.util; import com.carrotsearch.hppc.LongLongMap; import com.carrotsearch.hppc.LongLongOpenHashMap; import com.carrotsearch.hppc.cursors.LongLongCursor; import org.elasticsearch.common.util.BigArraysTests; +import org.elasticsearch.common.util.LongHash; import org.elasticsearch.test.ElasticsearchTestCase; import java.util.Iterator;