diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/AnovaEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/AnovaEvaluator.java index b2288219f92..d80e6938c54 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/AnovaEvaluator.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/AnovaEvaluator.java @@ -40,6 +40,11 @@ public class AnovaEvaluator extends ComplexEvaluator implements Expressible { } public Tuple evaluate(Tuple tuple) throws IOException { + + if(subEvaluators.size() < 2) { + throw new IOException("ANOVA evaluator expects atleast 2 parameters found: "+subEvaluators.size()); + } + List list = new ArrayList(); for(StreamEvaluator subEvaluator : subEvaluators) { List nums = (List)subEvaluator.evaluate(tuple); diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ConvolutionEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ConvolutionEvaluator.java index 6ca178d480f..000fa0d8734 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ConvolutionEvaluator.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ConvolutionEvaluator.java @@ -38,6 +38,12 @@ public class ConvolutionEvaluator extends ComplexEvaluator implements Expressibl } public List evaluate(Tuple tuple) throws IOException { + + if(subEvaluators.size() != 2) { + throw new IOException("Convolution evaluator expects 2 parameters found: "+subEvaluators.size()); + } + + StreamEvaluator colEval1 = subEvaluators.get(0); StreamEvaluator colEval2 = subEvaluators.get(1); diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/CorrelationEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/CorrelationEvaluator.java index fc3d8c3b31e..05db16feca2 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/CorrelationEvaluator.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/CorrelationEvaluator.java @@ -37,6 +37,11 @@ public class CorrelationEvaluator extends ComplexEvaluator implements Expressibl } public Number evaluate(Tuple tuple) throws IOException { + + if(subEvaluators.size() != 2) { + throw new IOException("Correlation evaluator expects 2 parameters found: "+subEvaluators.size()); + } + StreamEvaluator colEval1 = subEvaluators.get(0); StreamEvaluator colEval2 = subEvaluators.get(1); diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/CovarianceEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/CovarianceEvaluator.java index 7a6de689f8f..57782892335 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/CovarianceEvaluator.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/CovarianceEvaluator.java @@ -37,6 +37,11 @@ public class CovarianceEvaluator extends ComplexEvaluator implements Expressible } public Number evaluate(Tuple tuple) throws IOException { + + if(subEvaluators.size() != 2) { + throw new IOException("Covariance evaluator expects 2 parameters found: "+subEvaluators.size()); + } + StreamEvaluator colEval1 = subEvaluators.get(0); StreamEvaluator colEval2 = subEvaluators.get(1); diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/DistanceEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/DistanceEvaluator.java index 201da4bd5ca..f4ac319e57b 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/DistanceEvaluator.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/DistanceEvaluator.java @@ -38,6 +38,11 @@ public class DistanceEvaluator extends ComplexEvaluator implements Expressible { } public Number evaluate(Tuple tuple) throws IOException { + + if(subEvaluators.size() != 2) { + throw new IOException("Distance evaluator expects 2 parameters found: "+subEvaluators.size()); + } + StreamEvaluator colEval1 = subEvaluators.get(0); StreamEvaluator colEval2 = subEvaluators.get(1); diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FindDelayEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FindDelayEvaluator.java index c5a9b8acaa0..0cdd15367e2 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FindDelayEvaluator.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FindDelayEvaluator.java @@ -38,6 +38,11 @@ public class FindDelayEvaluator extends ComplexEvaluator implements Expressible } public Number evaluate(Tuple tuple) throws IOException { + + if(subEvaluators.size() != 2) { + throw new IOException("Finddelay evaluator expects 2 parameters found: "+subEvaluators.size()); + } + StreamEvaluator colEval1 = subEvaluators.get(0); StreamEvaluator colEval2 = subEvaluators.get(1); diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/HistogramEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/HistogramEvaluator.java index c6916984ecd..aa8408ba93e 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/HistogramEvaluator.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/HistogramEvaluator.java @@ -42,6 +42,10 @@ public class HistogramEvaluator extends ComplexEvaluator implements Expressible public List evaluate(Tuple tuple) throws IOException { + if(subEvaluators.size() != 2) { + throw new IOException("Histogram evaluator expects 2 parameters found: "+subEvaluators.size()); + } + StreamEvaluator colEval1 = subEvaluators.get(0); List numbers1 = (List)colEval1.evaluate(tuple); @@ -79,8 +83,6 @@ public class HistogramEvaluator extends ComplexEvaluator implements Expressible return binList; } - - @Override public StreamExpressionParameter toExpression(StreamFactory factory) throws IOException { StreamExpression expression = new StreamExpression(factory.getFunctionName(getClass())); diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/MovingAverageEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/MovingAverageEvaluator.java index 2e0788f3312..783116ea367 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/MovingAverageEvaluator.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/MovingAverageEvaluator.java @@ -38,6 +38,11 @@ public class MovingAverageEvaluator extends ComplexEvaluator implements Expressi } public List evaluate(Tuple tuple) throws IOException { + + if(subEvaluators.size() != 2) { + throw new IOException("Moving average evaluator expects 2 parameters found: "+subEvaluators.size()); + } + StreamEvaluator colEval = subEvaluators.get(0); StreamEvaluator windowEval = subEvaluators.get(1); diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/RankEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/RankEvaluator.java index 8a22e940b3d..2086c92bb8f 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/RankEvaluator.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/RankEvaluator.java @@ -38,6 +38,11 @@ public class RankEvaluator extends ComplexEvaluator implements Expressible { } public List evaluate(Tuple tuple) throws IOException { + + if(subEvaluators.size() != 1) { + throw new IOException("Rank evaluator expects 1 parameters found: "+subEvaluators.size()); + } + StreamEvaluator colEval = subEvaluators.get(0); List numbers = (List)colEval.evaluate(tuple); diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ReverseEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ReverseEvaluator.java index 016e995a614..cb11c912305 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ReverseEvaluator.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ReverseEvaluator.java @@ -37,6 +37,11 @@ public class ReverseEvaluator extends ComplexEvaluator implements Expressible { } public List evaluate(Tuple tuple) throws IOException { + + if(subEvaluators.size() != 1) { + throw new IOException("Reverse evaluator expects 1 parameters found: "+subEvaluators.size()); + } + StreamEvaluator colEval1 = subEvaluators.get(0); List numbers1 = (List)colEval1.evaluate(tuple); diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ScaleEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ScaleEvaluator.java index 8ff2a7cedc5..f45e2c4bf02 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ScaleEvaluator.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/ScaleEvaluator.java @@ -38,6 +38,11 @@ public class ScaleEvaluator extends ComplexEvaluator implements Expressible { } public List evaluate(Tuple tuple) throws IOException { + + if(subEvaluators.size() != 2) { + throw new IOException("Scale evaluator expects 2 parameters found: "+subEvaluators.size()); + } + StreamEvaluator numEval = subEvaluators.get(0); StreamEvaluator colEval1 = subEvaluators.get(1); diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SequenceEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SequenceEvaluator.java index a88d695afaf..c45e5512902 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SequenceEvaluator.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SequenceEvaluator.java @@ -38,6 +38,11 @@ public class SequenceEvaluator extends ComplexEvaluator implements Expressible { } public List evaluate(Tuple tuple) throws IOException { + + if(subEvaluators.size() != 3) { + throw new IOException("Sequence evaluator expects 3 parameters found: "+subEvaluators.size()); + } + StreamEvaluator sizeEval = subEvaluators.get(0); StreamEvaluator startEval = subEvaluators.get(1); StreamEvaluator strideEval = subEvaluators.get(2);