mirror of https://github.com/apache/lucene.git
SOLR-10805: Improve error handling for statistical Stream Evaluators
This commit is contained in:
parent
2271e73e76
commit
f275e3b254
|
@ -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<double[]> list = new ArrayList();
|
||||
for(StreamEvaluator subEvaluator : subEvaluators) {
|
||||
List<Number> nums = (List<Number>)subEvaluator.evaluate(tuple);
|
||||
|
|
|
@ -38,6 +38,12 @@ public class ConvolutionEvaluator extends ComplexEvaluator implements Expressibl
|
|||
}
|
||||
|
||||
public List<Number> 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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -42,6 +42,10 @@ public class HistogramEvaluator extends ComplexEvaluator implements Expressible
|
|||
|
||||
public List<Map> 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<Number> numbers1 = (List<Number>)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()));
|
||||
|
|
|
@ -38,6 +38,11 @@ public class MovingAverageEvaluator extends ComplexEvaluator implements Expressi
|
|||
}
|
||||
|
||||
public List<Number> 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);
|
||||
|
||||
|
|
|
@ -38,6 +38,11 @@ public class RankEvaluator extends ComplexEvaluator implements Expressible {
|
|||
}
|
||||
|
||||
public List<Number> 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<Number> numbers = (List<Number>)colEval.evaluate(tuple);
|
||||
|
|
|
@ -37,6 +37,11 @@ public class ReverseEvaluator extends ComplexEvaluator implements Expressible {
|
|||
}
|
||||
|
||||
public List<Number> 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<Number> numbers1 = (List<Number>)colEval1.evaluate(tuple);
|
||||
|
|
|
@ -38,6 +38,11 @@ public class ScaleEvaluator extends ComplexEvaluator implements Expressible {
|
|||
}
|
||||
|
||||
public List<Number> 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);
|
||||
|
||||
|
|
|
@ -38,6 +38,11 @@ public class SequenceEvaluator extends ComplexEvaluator implements Expressible {
|
|||
}
|
||||
|
||||
public List<Number> 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);
|
||||
|
|
Loading…
Reference in New Issue