diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/comp/ComparatorLambda.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/comp/ComparatorLambda.java index 30ed4a056d9..90346bf59cf 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/comp/ComparatorLambda.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/comp/ComparatorLambda.java @@ -1,5 +1,7 @@ package org.apache.solr.client.solrj.io.comp; +import java.io.Serializable; + import org.apache.solr.client.solrj.io.Tuple; /* @@ -22,6 +24,6 @@ import org.apache.solr.client.solrj.io.Tuple; /** * Interface for use with a comparator lambda */ -public interface ComparatorLambda { +public interface ComparatorLambda extends Serializable { public int compare(Tuple leftTuple, Tuple rightTuple); } diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/comp/FieldComparator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/comp/FieldComparator.java index 449a355da95..8b63ec2dfb6 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/comp/FieldComparator.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/comp/FieldComparator.java @@ -70,22 +70,21 @@ public class FieldComparator extends StreamComparator implements Comparator { - Comparable leftComp = (Comparable)leftTuple.get(leftField); - Comparable rightComp = (Comparable)rightTuple.get(rightField); - return rightComp.compareTo(leftComp); + comparator = new ComparatorLambda() { + public int compare(Tuple leftTuple, Tuple rightTuple) { + Comparable leftComp = (Comparable)leftTuple.get(leftField); + Comparable rightComp = (Comparable)rightTuple.get(rightField); + return rightComp.compareTo(leftComp); + } }; } else{ - // See above for black magic reasoning. - comparator = (ComparatorLambda & Serializable)(leftTuple, rightTuple) -> { - Comparable leftComp = (Comparable)leftTuple.get(leftField); - Comparable rightComp = (Comparable)rightTuple.get(rightField); - return leftComp.compareTo(rightComp); + comparator = new ComparatorLambda() { + public int compare(Tuple leftTuple, Tuple rightTuple) { + Comparable leftComp = (Comparable)leftTuple.get(leftField); + Comparable rightComp = (Comparable)rightTuple.get(rightField); + return leftComp.compareTo(rightComp); + } }; } } diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/expr/StreamFactory.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/expr/StreamFactory.java index d38989637fa..ba16740a925 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/expr/StreamFactory.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/expr/StreamFactory.java @@ -54,7 +54,10 @@ public class StreamFactory implements Serializable { return this; } public String getCollectionZkHost(String collectionName){ - return this.collectionZkHosts.getOrDefault(collectionName, null); + if(this.collectionZkHosts.containsKey(collectionName)){ + return this.collectionZkHosts.get(collectionName); + } + return null; } public Map getStreamFunctions(){