This is an automated email from the ASF dual-hosted git repository. ctubbsii pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo-wikisearch.git
The following commit(s) were added to refs/heads/main by this push: new f0803eb Bump to release version of Accumulo 2.0.1 f0803eb is described below commit f0803ebb165b40318a353f90637fbf934cc88de7 Author: Christopher Tubbs <ctubb...@apache.org> AuthorDate: Sat May 21 05:12:37 2022 -0400 Bump to release version of Accumulo 2.0.1 --- .../iterator/GlobalIndexUidCombiner.java | 14 +++++---- .../wikisearch/iterator/TextIndexCombiner.java | 36 ++++++++++++---------- pom.xml | 26 ++++++++++++++-- .../iterator/DefaultIteratorEnvironment.java | 5 ++- 4 files changed, 54 insertions(+), 27 deletions(-) diff --git a/ingest/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/GlobalIndexUidCombiner.java b/ingest/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/GlobalIndexUidCombiner.java index 4702521..98a434e 100644 --- a/ingest/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/GlobalIndexUidCombiner.java +++ b/ingest/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/GlobalIndexUidCombiner.java @@ -21,6 +21,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Map; +import org.apache.accumulo.core.client.lexicoder.Encoder; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.iterators.IteratorEnvironment; @@ -37,17 +38,18 @@ import com.google.protobuf.InvalidProtocolBufferException; public class GlobalIndexUidCombiner extends TypedValueCombiner<Uid.List> { public static final Encoder<Uid.List> UID_LIST_ENCODER = new UidListEncoder(); public static final int MAX = 20; - + @Override - public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { + public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, + IteratorEnvironment env) throws IOException { super.init(source, options, env); setEncoder(UID_LIST_ENCODER); } - + @Override public Uid.List typedReduce(Key key, Iterator<Uid.List> iter) { Uid.List.Builder builder = Uid.List.newBuilder(); - HashSet<String> uids = new HashSet<String>(); + HashSet<String> uids = new HashSet<>(); boolean seenIgnore = false; long count = 0; while (iter.hasNext()) { @@ -73,13 +75,13 @@ public class GlobalIndexUidCombiner extends TypedValueCombiner<Uid.List> { } return builder.build(); } - + public static class UidListEncoder implements Encoder<Uid.List> { @Override public byte[] encode(Uid.List v) { return v.toByteArray(); } - + @Override public Uid.List decode(byte[] b) { if (b.length == 0) diff --git a/ingest/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/TextIndexCombiner.java b/ingest/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/TextIndexCombiner.java index 85f3e1e..6e28206 100644 --- a/ingest/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/TextIndexCombiner.java +++ b/ingest/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/TextIndexCombiner.java @@ -23,6 +23,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import org.apache.accumulo.core.client.lexicoder.Encoder; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.iterators.IteratorEnvironment; @@ -37,23 +38,24 @@ import com.google.protobuf.InvalidProtocolBufferException; * */ public class TextIndexCombiner extends TypedValueCombiner<TermWeight.Info> { - public static final Encoder<TermWeight.Info> TERMWEIGHT_INFO_ENCODER = new TermWeightInfoEncoder(); - + public static final Encoder<TermWeight.Info> TERMWEIGHT_INFO_ENCODER = + new TermWeightInfoEncoder(); + @Override public TermWeight.Info typedReduce(Key key, Iterator<TermWeight.Info> iter) { TermWeight.Info.Builder builder = TermWeight.Info.newBuilder(); - List<Integer> offsets = new ArrayList<Integer>(); + List<Integer> offsets = new ArrayList<>(); float normalizedTermFrequency = 0f; - + while (iter.hasNext()) { TermWeight.Info info = iter.next(); if (null == info) continue; - + // Add each offset into the list maintaining sorted order for (int offset : info.getWordOffsetList()) { int pos = Collections.binarySearch(offsets, offset); - + if (pos < 0) { // Undo the transform on the insertion point offsets.add((-1 * pos) - 1, offset); @@ -61,33 +63,34 @@ public class TextIndexCombiner extends TypedValueCombiner<TermWeight.Info> { offsets.add(pos, offset); } } - + if (info.getNormalizedTermFrequency() > 0) { normalizedTermFrequency += info.getNormalizedTermFrequency(); } } - + // Keep the sorted order we tried to maintain - for (int i = 0; i < offsets.size(); ++i) { - builder.addWordOffset(offsets.get(i)); + for (Integer offset : offsets) { + builder.addWordOffset(offset); } - + builder.setNormalizedTermFrequency(normalizedTermFrequency); return builder.build(); } - + @Override - public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { + public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, + IteratorEnvironment env) throws IOException { super.init(source, options, env); setEncoder(TERMWEIGHT_INFO_ENCODER); } - + public static class TermWeightInfoEncoder implements Encoder<TermWeight.Info> { @Override public byte[] encode(TermWeight.Info v) { return v.toByteArray(); } - + @Override public TermWeight.Info decode(byte[] b) { if (b.length == 0) @@ -95,7 +98,8 @@ public class TextIndexCombiner extends TypedValueCombiner<TermWeight.Info> { try { return TermWeight.Info.parseFrom(b); } catch (InvalidProtocolBufferException e) { - throw new ValueFormatException("Value passed to aggregator was not of type TermWeight.Info"); + throw new ValueFormatException( + "Value passed to aggregator was not of type TermWeight.Info"); } } } diff --git a/pom.xml b/pom.xml index d6dc6b4..f132844 100644 --- a/pom.xml +++ b/pom.xml @@ -40,12 +40,14 @@ <maven.compiler.release>8</maven.compiler.release> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> - <version.accumulo>2.0.0-alpha-2</version.accumulo> + <version.accumulo>2.0.1</version.accumulo> <version.collections>3.2.2</version.collections> <version.commons-codec>1.5</version.commons-codec> <version.commons-configuration>1.10</version.commons-configuration> + <version.commons-configuration2>2.5</version.commons-configuration2> <version.commons-jexl>2.0.1</version.commons-jexl> <version.commons-lang>2.4</version.commons-lang> + <version.commons-lang3>3.9</version.commons-lang3> <version.ejb-spec-api>1.0.1.Final</version.ejb-spec-api> <version.guava>29.0-jre</version.guava> <version.hadoop>3.1.1</version.hadoop> @@ -58,7 +60,7 @@ <version.lucene>7.1.0</version.lucene> <version.lucene-analyzers>4.0.0</version.lucene-analyzers> <version.minlog>1.2</version.minlog> - <version.protobuf>2.5.0</version.protobuf> + <version.protobuf>3.19.4</version.protobuf> <version.thrift>0.12.0</version.thrift> <version.zookeeper>3.4.14</version.zookeeper> </properties> @@ -172,6 +174,11 @@ <artifactId>commons-codec</artifactId> <version>${version.commons-codec}</version> </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-configuration2</artifactId> + <version>${version.commons-configuration2}</version> + </dependency> <dependency> <groupId>commons-configuration</groupId> <artifactId>commons-configuration</artifactId> @@ -182,6 +189,11 @@ <artifactId>commons-lang</artifactId> <version>${version.commons-lang}</version> </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>${version.commons-lang3}</version> + </dependency> <dependency> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-core</artifactId> @@ -229,6 +241,16 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>com.google.errorprone</groupId> + <artifactId>error_prone_annotations</artifactId> + <version>2.3.4</version> + </dependency> + <dependency> + <groupId>org.checkerframework</groupId> + <artifactId>checker-qual</artifactId> + <version>2.11.1</version> + </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> diff --git a/query/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/DefaultIteratorEnvironment.java b/query/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/DefaultIteratorEnvironment.java index f83de46..b0881f1 100644 --- a/query/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/DefaultIteratorEnvironment.java +++ b/query/src/main/java/org/apache/accumulo/examples/wikisearch/iterator/DefaultIteratorEnvironment.java @@ -28,7 +28,6 @@ import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope; import org.apache.accumulo.core.iterators.SortedKeyValueIterator; import org.apache.accumulo.core.iterators.system.MapFileIterator; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.util.CachedConfiguration; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; @@ -43,9 +42,9 @@ public class DefaultIteratorEnvironment implements IteratorEnvironment { @Override public SortedKeyValueIterator<Key,Value> reserveMapFileReader(String mapFileName) throws IOException { - Configuration conf = CachedConfiguration.getInstance(); + Configuration conf = new Configuration(); FileSystem fs = FileSystem.get(conf); - return new MapFileIterator(this.conf, fs, mapFileName, conf); + return new MapFileIterator(fs, mapFileName, conf); } @Override