diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/Lang.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/Lang.java index 3ace1f735e0..eed6b872a00 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/Lang.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/Lang.java @@ -296,6 +296,10 @@ public class Lang { .withFunctionName("long", LongEvaluator.class) .withFunctionName("dateTime", DateEvaluator.class) .withFunctionName("concat", ConcatEvaluator.class) + .withFunctionName("lower", LowerEvaluator.class) + .withFunctionName("upper", UpperEvaluator.class) + .withFunctionName("split", SplitEvaluator.class) + .withFunctionName("trim", TrimEvaluator.class) // Boolean Stream Evaluators diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FieldValueEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FieldValueEvaluator.java index 1587a43aba8..73bc0c76441 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FieldValueEvaluator.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/FieldValueEvaluator.java @@ -91,7 +91,11 @@ public class FieldValueEvaluator extends SourceEvaluator { if(value == null) { if(sc != null) {sc.getTupleContext().put("null", fieldName);} - return fieldName; + if(fieldName.startsWith("\"") && fieldName.endsWith("\"")) { + return fieldName.substring(1, fieldName.length()-1); + } else { + return null; + } } return value; diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/IsNullEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/IsNullEvaluator.java index dc912fd3a7b..d4778c399f3 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/IsNullEvaluator.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/IsNullEvaluator.java @@ -36,6 +36,10 @@ public class IsNullEvaluator extends RecursiveBooleanEvaluator implements ManyVa public Object doWork(Object ... values) throws IOException { + if(values[0] == null) { + return true; + } + if(values[0] instanceof String) { //Check to see if the this tuple had a null value for that string. Map tupleContext = getStreamContext().getTupleContext(); diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/LowerEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/LowerEvaluator.java new file mode 100644 index 00000000000..1c5abfa6661 --- /dev/null +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/LowerEvaluator.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.solrj.io.eval; + +import java.io.IOException; +import java.util.List; +import java.util.Locale; +import java.util.stream.Collectors; + +import org.apache.solr.client.solrj.io.stream.expr.StreamExpression; +import org.apache.solr.client.solrj.io.stream.expr.StreamFactory; + +public class LowerEvaluator extends RecursiveObjectEvaluator implements OneValueWorker { + protected static final long serialVersionUID = 1L; + + public LowerEvaluator(StreamExpression expression, StreamFactory factory) throws IOException{ + super(expression, factory); + + if(1 != containedEvaluators.size()){ + throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - expecting exactly 1 value but found %d",expression,containedEvaluators.size())); + } + } + + @Override + public Object doWork(Object value){ + if(null == value){ + return null; + } + else if(value instanceof List){ + return ((List)value).stream().map(innerValue -> doWork(innerValue)).collect(Collectors.toList()); + } + else{ + return value.toString().toLowerCase(); + } + } +} diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/NotNullEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/NotNullEvaluator.java index 8b9a9b10b87..264135e579b 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/NotNullEvaluator.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/NotNullEvaluator.java @@ -36,6 +36,10 @@ public class NotNullEvaluator extends RecursiveBooleanEvaluator implements ManyV public Object doWork(Object ... values) throws IOException { + if(values[0] == null) { + return false; + } + if(values[0] instanceof String) { //Check to see if the this tuple had a null value for that string. Map tupleContext = getStreamContext().getTupleContext(); diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SplitEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SplitEvaluator.java new file mode 100644 index 00000000000..5fd7901494d --- /dev/null +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/SplitEvaluator.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.solrj.io.eval; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + +import org.apache.solr.client.solrj.io.stream.expr.StreamExpression; +import org.apache.solr.client.solrj.io.stream.expr.StreamFactory; + +public class SplitEvaluator extends RecursiveObjectEvaluator implements TwoValueWorker { + protected static final long serialVersionUID = 1L; + + public SplitEvaluator(StreamExpression expression, StreamFactory factory) throws IOException{ + super(expression, factory); + + if(2 != containedEvaluators.size()){ + throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - expecting exactly 2 values but found %d",expression,containedEvaluators.size())); + } + } + + @Override + public Object doWork(Object value1, Object value2){ + if(null == value1){ + return null; + } + String s = value1.toString(); + String p = value2.toString(); + String[] tokens = s.split(p, -1); + List strings = new ArrayList(tokens.length); + for(String tok : tokens) { + strings.add(tok); + } + + return strings; + } +} diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/TrimEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/TrimEvaluator.java new file mode 100644 index 00000000000..505da1e2d79 --- /dev/null +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/TrimEvaluator.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.solrj.io.eval; + +import java.io.IOException; +import java.util.List; +import java.util.Locale; +import java.util.stream.Collectors; + +import org.apache.solr.client.solrj.io.stream.expr.StreamExpression; +import org.apache.solr.client.solrj.io.stream.expr.StreamFactory; + +public class TrimEvaluator extends RecursiveObjectEvaluator implements OneValueWorker { + protected static final long serialVersionUID = 1L; + + public TrimEvaluator(StreamExpression expression, StreamFactory factory) throws IOException{ + super(expression, factory); + + if(1 != containedEvaluators.size()){ + throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - expecting exactly 1 value but found %d",expression,containedEvaluators.size())); + } + } + + @Override + public Object doWork(Object value){ + if(null == value){ + return null; + } + else if(value instanceof List){ + return ((List)value).stream().map(innerValue -> doWork(innerValue)).collect(Collectors.toList()); + } + else{ + return value.toString().trim(); + } + } +} diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/UpperEvaluator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/UpperEvaluator.java new file mode 100644 index 00000000000..0624851d1c9 --- /dev/null +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/eval/UpperEvaluator.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.solrj.io.eval; + +import java.io.IOException; +import java.util.List; +import java.util.Locale; +import java.util.stream.Collectors; + +import org.apache.solr.client.solrj.io.stream.expr.StreamExpression; +import org.apache.solr.client.solrj.io.stream.expr.StreamFactory; + +public class UpperEvaluator extends RecursiveObjectEvaluator implements OneValueWorker { + protected static final long serialVersionUID = 1L; + + public UpperEvaluator(StreamExpression expression, StreamFactory factory) throws IOException{ + super(expression, factory); + + if(1 != containedEvaluators.size()){ + throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - expecting exactly 1 value but found %d",expression,containedEvaluators.size())); + } + } + + @Override + public Object doWork(Object value){ + if(null == value){ + return null; + } + else if(value instanceof List){ + return ((List)value).stream().map(innerValue -> doWork(innerValue)).collect(Collectors.toList()); + } + else{ + return value.toString().toUpperCase(); + } + } +} diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CsvStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CsvStream.java index 15ab6841766..561204fa302 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CsvStream.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CsvStream.java @@ -123,7 +123,7 @@ public class CsvStream extends TupleStream implements Expressible { if(tuple.EOF) { return tuple; } else { - String file = tuple.getString("file"); + String file = formatFile(tuple.getString("file")); String line = tuple.getString("line"); if (file.equals(currentFile)) { String[] fields = split(line); @@ -147,6 +147,15 @@ public class CsvStream extends TupleStream implements Expressible { } } + private String formatFile(String file) { + //We don't want the ./ which carries no information but can lead to problems in creating the id for the field. + if(file.startsWith("./")) { + return file.substring(2); + } else { + return file; + } + } + protected String[] split(String line) { String[] fields = line.split(",(?=(?:[^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)",-1); for(int i=0; i selectedEvaluator : selectedEvaluators.entrySet()) { Object o = selectedEvaluator.getKey().evaluate(workingForEvaluators); - workingForEvaluators.put(selectedEvaluator.getValue(), o); - workingToReturn.put(selectedEvaluator.getValue(), o); + if(o != null) { + workingForEvaluators.put(selectedEvaluator.getValue(), o); + workingToReturn.put(selectedEvaluator.getValue(), o); + } } return workingToReturn; diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/TestLang.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/TestLang.java index f2e6a42abc1..0435ed55f76 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/TestLang.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/TestLang.java @@ -76,7 +76,8 @@ public class TestLang extends SolrTestCase { "getAmplitude", "getPhase", "getAngularFrequency", "enclosingDisk", "getCenter", "getRadius", "getSupportPoints", "pairSort", "log10", "plist", "recip", "pivot", "ltrim", "rtrim", "export", "zplot", "natural", "repeat", "movingMAD", "hashRollup", "noop", "var", "stddev", "recNum", "isNull", - "notNull", "matches", "projectToBorder", "double", "long", "parseCSV", "parseTSV", "dateTime"}; + "notNull", "matches", "projectToBorder", "double", "long", "parseCSV", "parseTSV", "dateTime", + "split", "upper", "trim", "lower"}; @Test public void testLang() { diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.java index 25a07deef80..890d0d33b33 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/MathExpressionTest.java @@ -229,6 +229,73 @@ public class MathExpressionTest extends SolrCloudTestCase { assertEquals(s2, "c-d-hello"); } + @Test + public void testUpperLowerSingle() throws Exception { + String expr = " select(list(tuple(field1=\"a\", field2=\"C\")), upper(field1) as field3, lower(field2) as field4)"; + ModifiableSolrParams paramsLoc = new ModifiableSolrParams(); + paramsLoc.set("expr", expr); + paramsLoc.set("qt", "/stream"); + + String url = cluster.getJettySolrRunners().get(0).getBaseUrl().toString() + "/" + COLLECTIONORALIAS; + TupleStream solrStream = new SolrStream(url, paramsLoc); + + StreamContext context = new StreamContext(); + solrStream.setStreamContext(context); + List tuples = getTuples(solrStream); + assertEquals(tuples.size(), 1); + String s1 = tuples.get(0).getString("field3"); + assertEquals(s1, "A"); + String s2 = tuples.get(0).getString("field4"); + assertEquals(s2, "c"); + } + + @Test + public void testUpperLowerArray() throws Exception { + String expr = " select(list(tuple(field1=array(\"a\",\"b\",\"c\"), field2=array(\"X\",\"Y\",\"Z\"))), upper(field1) as field3, lower(field2) as field4)"; + ModifiableSolrParams paramsLoc = new ModifiableSolrParams(); + paramsLoc.set("expr", expr); + paramsLoc.set("qt", "/stream"); + + String url = cluster.getJettySolrRunners().get(0).getBaseUrl().toString() + "/" + COLLECTIONORALIAS; + TupleStream solrStream = new SolrStream(url, paramsLoc); + + StreamContext context = new StreamContext(); + solrStream.setStreamContext(context); + List tuples = getTuples(solrStream); + assertEquals(tuples.size(), 1); + List l1 = (List)tuples.get(0).get("field3"); + assertEquals(l1.get(0), "A"); + assertEquals(l1.get(1), "B"); + assertEquals(l1.get(2), "C"); + + List l2 = (List)tuples.get(0).get("field4"); + assertEquals(l2.get(0), "x"); + assertEquals(l2.get(1), "y"); + assertEquals(l2.get(2), "z"); + } + + + @Test + public void testSplitTrim() throws Exception { + String expr = " select(list(tuple(field1=\"a, b, c\")), trim(split(field1, \",\")) as field2)"; + ModifiableSolrParams paramsLoc = new ModifiableSolrParams(); + paramsLoc.set("expr", expr); + paramsLoc.set("qt", "/stream"); + + String url = cluster.getJettySolrRunners().get(0).getBaseUrl().toString() + "/" + COLLECTIONORALIAS; + TupleStream solrStream = new SolrStream(url, paramsLoc); + + StreamContext context = new StreamContext(); + solrStream.setStreamContext(context); + List tuples = getTuples(solrStream); + assertEquals(tuples.size(), 1); + List l1 = (List)tuples.get(0).get("field2"); + assertEquals(l1.get(0), "a"); + assertEquals(l1.get(1), "b"); + assertEquals(l1.get(2), "c"); + } + + @Test public void testMemset() throws Exception { String expr = "let(echo=\"b, c\"," + @@ -1365,7 +1432,7 @@ public class MathExpressionTest extends SolrCloudTestCase { String cexpr = "let(echo=true," + " a=setColumnLabels(matrix(array(1, 2, 3), " + " rev(array(4,5,6)))," + - " array(col1, col2, col3))," + + " array(\"col1\", \"col2\", \"col3\"))," + " b=rowAt(a, 1)," + " c=colAt(a, 2)," + " d=getColumnLabels(a)," + @@ -1373,7 +1440,7 @@ public class MathExpressionTest extends SolrCloudTestCase { " f=rowCount(a)," + " g=columnCount(a)," + " h=indexOf(d, \"col2\")," + - " i=indexOf(d, col3))"; + " i=indexOf(d, \"col3\"))"; ModifiableSolrParams paramsLoc = new ModifiableSolrParams(); paramsLoc.set("expr", cexpr); paramsLoc.set("qt", "/stream"); @@ -2058,7 +2125,7 @@ public class MathExpressionTest extends SolrCloudTestCase { @Test public void testMatches() throws Exception { - String cexpr = "having(list(tuple(a=\"Hello World\"), tuple(a=\"Good bye\")), matches(a, Hello))"; + String cexpr = "having(list(tuple(a=\"Hello World\"), tuple(a=\"Good bye\")), matches(a, \"Hello\"))"; ModifiableSolrParams paramsLoc = new ModifiableSolrParams(); paramsLoc.set("expr", cexpr); paramsLoc.set("qt", "/stream"); @@ -2272,7 +2339,7 @@ public class MathExpressionTest extends SolrCloudTestCase { " b=termVectors(a, minDocFreq=0, maxDocFreq=1)," + " c=getRowLabels(b)," + " d=getColumnLabels(b)," + - " e=getAttribute(b, docFreqs))"; + " e=getAttribute(b, \"docFreqs\"))"; ModifiableSolrParams paramsLoc = new ModifiableSolrParams(); paramsLoc.set("expr", cexpr); paramsLoc.set("qt", "/stream"); @@ -2351,7 +2418,7 @@ public class MathExpressionTest extends SolrCloudTestCase { " b=termVectors(a, minTermLength=4, minDocFreq=0, maxDocFreq=1)," + " c=getRowLabels(b)," + " d=getColumnLabels(b)," + - " e=getAttribute(b, docFreqs))"; + " e=getAttribute(b, \"docFreqs\"))"; paramsLoc = new ModifiableSolrParams(); paramsLoc.set("expr", cexpr); paramsLoc.set("qt", "/stream"); @@ -2423,7 +2490,7 @@ public class MathExpressionTest extends SolrCloudTestCase { " b=termVectors(a, exclude=jim, minDocFreq=0, maxDocFreq=1)," + " c=getRowLabels(b)," + " d=getColumnLabels(b)," + - " e=getAttribute(b, docFreqs))"; + " e=getAttribute(b, \"docFreqs\"))"; paramsLoc = new ModifiableSolrParams(); paramsLoc.set("expr", cexpr); @@ -2495,7 +2562,7 @@ public class MathExpressionTest extends SolrCloudTestCase { " b=termVectors(a, minDocFreq=.5, maxDocFreq=1)," + " c=getRowLabels(b)," + " d=getColumnLabels(b)," + - " e=getAttribute(b, docFreqs))"; + " e=getAttribute(b, \"docFreqs\"))"; paramsLoc = new ModifiableSolrParams(); paramsLoc.set("expr", cexpr); paramsLoc.set("qt", "/stream"); @@ -2549,7 +2616,7 @@ public class MathExpressionTest extends SolrCloudTestCase { " b=termVectors(a, maxDocFreq=0)," + " c=getRowLabels(b)," + " d=getColumnLabels(b)," + - " e=getAttribute(b, docFreqs))"; + " e=getAttribute(b, \"docFreqs\"))"; paramsLoc = new ModifiableSolrParams(); paramsLoc.set("expr", cexpr); paramsLoc.set("qt", "/stream"); @@ -2571,7 +2638,7 @@ public class MathExpressionTest extends SolrCloudTestCase { " tuple(fx=x2, fy=f1, fv=add(1,7)), " + " tuple(fx=x3, fy=f1, fv=add(1,4))," + " tuple(fx=x3, fy=f3, fv=add(1,7)))," + - " b=pivot(a, fx, fy, fv)," + + " b=pivot(a, \"fx\", \"fy\", \"fv\")," + " c=getRowLabels(b)," + " d=getColumnLabels(b))"; ModifiableSolrParams paramsLoc = new ModifiableSolrParams(); @@ -2741,7 +2808,7 @@ public class MathExpressionTest extends SolrCloudTestCase { " c=array(0,0,0,1,1,1)," + " d=array(0,0,0,1,1,1)," + " e=setRowLabels(matrix(a,b,c,d), " + - " array(doc1, doc2, doc3, doc4))," + + " array(\"doc1\", \"doc2\", \"doc3\", \"doc4\"))," + " f=kmeans(e, 2)," + " g=getCluster(f, 0)," + " h=getCluster(f, 1)," + @@ -2820,7 +2887,7 @@ public class MathExpressionTest extends SolrCloudTestCase { " c=array(0,0,0,1,1,1)," + " d=array(0,0,0,1,1,1)," + " e=setRowLabels(matrix(a,b,c,d), " + - " array(doc1, doc2, doc3, doc4))," + + " array(\"doc1\", \"doc2\", \"doc3\", \"doc4\"))," + " f=multiKmeans(e, 2, 5)," + " g=getCluster(f, 0)," + " h=getCluster(f, 1)," + @@ -2899,7 +2966,7 @@ public class MathExpressionTest extends SolrCloudTestCase { " c=array(0,0,0,1,1,1)," + " d=array(0,0,0,1,1,1)," + " e=setRowLabels(matrix(a,b,c,d), " + - " array(doc1, doc2, doc3, doc4))," + + " array(\"doc1\", \"doc2\", \"doc3\", \"doc4\"))," + " f=fuzzyKmeans(e, 2)," + " g=getCluster(f, 0)," + " h=getCluster(f, 1)," + @@ -3022,8 +3089,8 @@ public class MathExpressionTest extends SolrCloudTestCase { String cexpr = "let(echo=true," + " a=oscillate(10, .3, 2.9)," + " b=describe(a)," + - " c=getValue(b, min)," + - " d=getValue(b, max)," + + " c=getValue(b, \"min\")," + + " d=getValue(b, \"max\")," + " e=harmfit(a)," + " f=getAmplitude(e)," + " g=getAngularFrequency(e)," + @@ -3119,10 +3186,10 @@ public class MathExpressionTest extends SolrCloudTestCase { public void testSetAndGetValue() throws Exception { String cexpr = "let(echo=true," + " a=describe(array(1,2,3,4,5,6,7))," + - " b=getValue(a, geometricMean)," + + " b=getValue(a, \"geometricMean\")," + " c=setValue(a, \"test\", add(b, 1))," + - " d=getValue(c, test)," + - " e=setValue(c, blah, array(8.11,9.55,10.1))," + + " d=getValue(c, \"test\")," + + " e=setValue(c, \"blah\", array(8.11,9.55,10.1))," + " f=getValue(e, \"blah\"))"; ModifiableSolrParams paramsLoc = new ModifiableSolrParams(); paramsLoc.set("expr", cexpr); @@ -3576,7 +3643,7 @@ public class MathExpressionTest extends SolrCloudTestCase { @Test public void testCache() throws Exception { - String cexpr = "putCache(space1, key1, dotProduct(array(2,4,6,8,10,12),array(1,2,3,4,5,6)))"; + String cexpr = "putCache(\"space1\", \"key1\", dotProduct(array(2,4,6,8,10,12),array(1,2,3,4,5,6)))"; ModifiableSolrParams paramsLoc = new ModifiableSolrParams(); paramsLoc.set("expr", cexpr); paramsLoc.set("qt", "/stream"); @@ -3590,7 +3657,7 @@ public class MathExpressionTest extends SolrCloudTestCase { assertTrue(dotProduct.doubleValue() == 182); - cexpr = "getCache(space1, key1)"; + cexpr = "getCache(\"space1\", \"key1\")"; paramsLoc = new ModifiableSolrParams(); paramsLoc.set("expr", cexpr); paramsLoc.set("qt", "/stream"); @@ -3602,7 +3669,7 @@ public class MathExpressionTest extends SolrCloudTestCase { dotProduct = (Number)tuples.get(0).get("return-value"); assertTrue(dotProduct.doubleValue() == 182); - cexpr = "listCache(space1)"; + cexpr = "listCache(\"space1\")"; paramsLoc = new ModifiableSolrParams(); paramsLoc.set("expr", cexpr); paramsLoc.set("qt", "/stream"); @@ -3628,7 +3695,7 @@ public class MathExpressionTest extends SolrCloudTestCase { assertEquals(keys.size(), 1); assertEquals(keys.get(0), "space1"); - cexpr = "removeCache(space1, key1)"; + cexpr = "removeCache(\"space1\", \"key1\")"; paramsLoc = new ModifiableSolrParams(); paramsLoc.set("expr", cexpr); paramsLoc.set("qt", "/stream"); @@ -3641,7 +3708,7 @@ public class MathExpressionTest extends SolrCloudTestCase { assertTrue(dotProduct.doubleValue() == 182); - cexpr = "listCache(space1)"; + cexpr = "listCache(\"space1\")"; paramsLoc = new ModifiableSolrParams(); paramsLoc.set("expr", cexpr); paramsLoc.set("qt", "/stream"); @@ -3652,11 +3719,6 @@ public class MathExpressionTest extends SolrCloudTestCase { assertTrue(tuples.size() == 1); keys = (List)tuples.get(0).get("return-value"); assertEquals(keys.size(), 0); - - - - - } @Test @@ -3961,7 +4023,7 @@ public class MathExpressionTest extends SolrCloudTestCase { String cexpr = "let(echo=true," + " a=setRowLabels(matrix(array(1,1,1,0,0,0),"+ " array(1,0,0,0,1,1),"+ - " array(0,0,0,1,1,1)), array(row1,row2,row3)),"+ + " array(0,0,0,1,1,1)), array(\"row1\",\"row2\",\"row3\")),"+ " b=array(0,0,0,1,1,1),"+ " c=knn(a, b, 2),"+ " d=getRowLabels(c),"+ @@ -4483,7 +4545,7 @@ public class MathExpressionTest extends SolrCloudTestCase { @Test public void testDateTime() throws Exception { - String expr = "select(list(tuple(a=20001011:10:11:01), tuple(a=20071011:14:30:20)), dateTime(a, yyyyMMdd:kk:mm:ss) as date)"; + String expr = "select(list(tuple(a=20001011:10:11:01), tuple(a=20071011:14:30:20)), dateTime(a, \"yyyyMMdd:kk:mm:ss\") as date)"; ModifiableSolrParams paramsLoc = new ModifiableSolrParams(); paramsLoc.set("expr", expr); paramsLoc.set("qt", "/stream"); @@ -4502,7 +4564,7 @@ public class MathExpressionTest extends SolrCloudTestCase { @Test public void testDateTimeTZ() throws Exception { - String expr = "select(list(tuple(a=20001011), tuple(a=20071011)), dateTime(a, yyyyMMdd, UTC) as date, dateTime(a, yyyyMMdd, EST) as date1, dateTime(a, yyyyMMdd) as date2)"; + String expr = "select(list(tuple(a=20001011), tuple(a=20071011)), dateTime(a, \"yyyyMMdd\", \"UTC\") as date, dateTime(a, \"yyyyMMdd\", \"EST\") as date1, dateTime(a, \"yyyyMMdd\") as date2)"; ModifiableSolrParams paramsLoc = new ModifiableSolrParams(); paramsLoc.set("expr", expr); paramsLoc.set("qt", "/stream"); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/AbsoluteValueEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/AbsoluteValueEvaluatorTest.java index 75cde6e59ce..7ce58adf1ad 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/AbsoluteValueEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/AbsoluteValueEvaluatorTest.java @@ -107,7 +107,7 @@ public class AbsoluteValueEvaluatorTest extends SolrTestCase { factory.constructEvaluator("abs(a,b)"); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void absNoValue() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("abs(a)"); @@ -116,7 +116,7 @@ public class AbsoluteValueEvaluatorTest extends SolrTestCase { assertNull(result); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void absNullValue() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("abs(a)"); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/AddEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/AddEvaluatorTest.java index 87a12bf1a17..3251fd78999 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/AddEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/AddEvaluatorTest.java @@ -68,7 +68,7 @@ public class AddEvaluatorTest extends SolrTestCase { Assert.assertEquals(3.2D, result); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void addTwoFieldWithNulls() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("add(a,b)"); Object result; @@ -78,7 +78,7 @@ public class AddEvaluatorTest extends SolrTestCase { Assert.assertNull(result); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void addTwoFieldsWithNull() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("add(a,b)"); Object result; @@ -102,7 +102,7 @@ public class AddEvaluatorTest extends SolrTestCase { Assert.assertNull(result); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void addTwoFieldsWithMissingField() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("add(a,b)"); Object result; diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ArcCosineEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ArcCosineEvaluatorTest.java index 850ab3d7995..66aa9f8f4c9 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ArcCosineEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ArcCosineEvaluatorTest.java @@ -76,15 +76,16 @@ public class ArcCosineEvaluatorTest extends SolrTestCase { factory.constructEvaluator("acos(a,b)"); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void noValue() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("acos(a)"); values.clear(); Object result = evaluator.evaluate(new Tuple(values)); + assertNull(result); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void nullValue() throws Exception{ test(null); } diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ArcSineEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ArcSineEvaluatorTest.java index b754159d052..e6b30908085 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ArcSineEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ArcSineEvaluatorTest.java @@ -76,7 +76,7 @@ public class ArcSineEvaluatorTest extends SolrTestCase { factory.constructEvaluator("asin(a,b)"); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void noValue() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("asin(a)"); @@ -85,7 +85,7 @@ public class ArcSineEvaluatorTest extends SolrTestCase { assertNull(result); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void nullValue() throws Exception{ test(null); } diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ArcTangentEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ArcTangentEvaluatorTest.java index 87f5e3e5f2f..15cdc0f6a64 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ArcTangentEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ArcTangentEvaluatorTest.java @@ -76,7 +76,7 @@ public class ArcTangentEvaluatorTest extends SolrTestCase { factory.constructEvaluator("atan(a,b)"); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void noValue() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("atan(a)"); @@ -84,7 +84,7 @@ public class ArcTangentEvaluatorTest extends SolrTestCase { Object result = evaluator.evaluate(new Tuple(values)); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void nullValue() throws Exception{ test(null); } diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/CeilingEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/CeilingEvaluatorTest.java index 9a8a65e8492..a4cf9d230db 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/CeilingEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/CeilingEvaluatorTest.java @@ -76,7 +76,7 @@ public class CeilingEvaluatorTest extends SolrTestCase { factory.constructEvaluator("ceil(a,b)"); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void ceilNoValue() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("ceil(a)"); @@ -85,7 +85,7 @@ public class CeilingEvaluatorTest extends SolrTestCase { assertNull(result); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void ceilNullValue() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("ceil(a)"); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/CosineEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/CosineEvaluatorTest.java index 894d66ef220..d451b5be7df 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/CosineEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/CosineEvaluatorTest.java @@ -76,7 +76,7 @@ public class CosineEvaluatorTest extends SolrTestCase { factory.constructEvaluator("cos(a,b)"); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void noValue() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("cos(a)"); @@ -84,7 +84,7 @@ public class CosineEvaluatorTest extends SolrTestCase { Object result = evaluator.evaluate(new Tuple(values)); assertNull(result); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void nullValue() throws Exception{ test(null); } diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/CubedRootEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/CubedRootEvaluatorTest.java index 07762612f2b..3b34dad7105 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/CubedRootEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/CubedRootEvaluatorTest.java @@ -76,7 +76,7 @@ public class CubedRootEvaluatorTest extends SolrTestCase { factory.constructEvaluator("cbrt(a,b)"); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void noValue() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("cbrt(a)"); @@ -84,7 +84,7 @@ public class CubedRootEvaluatorTest extends SolrTestCase { Object result = evaluator.evaluate(new Tuple(values)); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void nullValue() throws Exception{ test(null); } diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/DivideEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/DivideEvaluatorTest.java index 88e4b77a222..60d93ac93b0 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/DivideEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/DivideEvaluatorTest.java @@ -74,7 +74,7 @@ public class DivideEvaluatorTest extends SolrTestCase { factory.constructEvaluator("div(a)"); } - @Test(expected = NumberFormatException.class) + @Test(expected = IOException.class) public void divTwoFieldWithNulls() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("div(a,b)"); @@ -82,7 +82,7 @@ public class DivideEvaluatorTest extends SolrTestCase { evaluator.evaluate(new Tuple(values)); } - @Test(expected = NumberFormatException.class) + @Test(expected = IOException.class) public void divTwoFieldsWithNullDenominator() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("div(a,b)"); @@ -91,7 +91,7 @@ public class DivideEvaluatorTest extends SolrTestCase { evaluator.evaluate(new Tuple(values)); } - @Test(expected = NumberFormatException.class) + @Test(expected = IOException.class) public void divTwoFieldsWithNullNumerator() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("div(a,b)"); @@ -101,7 +101,7 @@ public class DivideEvaluatorTest extends SolrTestCase { } - @Test(expected = NumberFormatException.class) + @Test(expected = IOException.class) public void divTwoFieldsWithMissingDenominator() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("div(a,b)"); @@ -110,7 +110,7 @@ public class DivideEvaluatorTest extends SolrTestCase { evaluator.evaluate(new Tuple(values)); } - @Test(expected = NumberFormatException.class) + @Test(expected = IOException.class) public void divTwoFieldsWithMissingNumerator() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("div(a,b)"); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/FloorEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/FloorEvaluatorTest.java index d51ef9ea52a..b1d83ab7b2c 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/FloorEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/FloorEvaluatorTest.java @@ -76,19 +76,21 @@ public class FloorEvaluatorTest extends SolrTestCase { factory.constructEvaluator("floor(a,b)"); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void floorNoValue() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("floor(a)"); values.clear(); Object result = evaluator.evaluate(new Tuple(values)); + assertNull(result); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void floorNullValue() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("floor(a)"); values.clear(); values.put("a", null); Object result = evaluator.evaluate(new Tuple(values)); + assertNull(result); } } diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/HyperbolicCosineEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/HyperbolicCosineEvaluatorTest.java index 3c3f696658e..73bc3d25f83 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/HyperbolicCosineEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/HyperbolicCosineEvaluatorTest.java @@ -76,7 +76,7 @@ public class HyperbolicCosineEvaluatorTest extends SolrTestCase { factory.constructEvaluator("cosh(a,b)"); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void noValue() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("cosh(a)"); @@ -85,7 +85,7 @@ public class HyperbolicCosineEvaluatorTest extends SolrTestCase { assertNull(result); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void nullValue() throws Exception{ test(null); } diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/HyperbolicSineEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/HyperbolicSineEvaluatorTest.java index d807c297745..5027d66c072 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/HyperbolicSineEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/HyperbolicSineEvaluatorTest.java @@ -76,7 +76,7 @@ public class HyperbolicSineEvaluatorTest extends SolrTestCase { factory.constructEvaluator("sinh(a,b)"); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void noValue() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("sinh(a)"); @@ -85,7 +85,7 @@ public class HyperbolicSineEvaluatorTest extends SolrTestCase { assertNull(result); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void nullValue() throws Exception{ test(null); } diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/HyperbolicTangentEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/HyperbolicTangentEvaluatorTest.java index 53cc6c0b880..2020a9d5097 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/HyperbolicTangentEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/HyperbolicTangentEvaluatorTest.java @@ -76,7 +76,7 @@ public class HyperbolicTangentEvaluatorTest extends SolrTestCase { factory.constructEvaluator("tanh(a,b)"); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void noValue() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("tanh(a)"); @@ -85,7 +85,7 @@ public class HyperbolicTangentEvaluatorTest extends SolrTestCase { assertNull(result); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void nullValue() throws Exception{ test(null); } diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ModuloEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ModuloEvaluatorTest.java index 06a13386a08..d72b55f66c7 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ModuloEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/ModuloEvaluatorTest.java @@ -74,7 +74,7 @@ public class ModuloEvaluatorTest extends SolrTestCase { factory.constructEvaluator("mod(a)"); } - @Test(expected = NumberFormatException.class) + @Test(expected = IOException.class) public void modTwoFieldWithNulls() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("mod(a,b)"); @@ -82,7 +82,7 @@ public class ModuloEvaluatorTest extends SolrTestCase { evaluator.evaluate(new Tuple(values)); } - @Test(expected = NumberFormatException.class) + @Test(expected = IOException.class) public void modTwoFieldsWithNullDenominator() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("mod(a,b)"); @@ -91,7 +91,7 @@ public class ModuloEvaluatorTest extends SolrTestCase { evaluator.evaluate(new Tuple(values)); } - @Test(expected = NumberFormatException.class) + @Test(expected = IOException.class) public void modTwoFieldsWithNullNumerator() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("mod(a,b)"); @@ -101,7 +101,7 @@ public class ModuloEvaluatorTest extends SolrTestCase { } - @Test(expected = NumberFormatException.class) + @Test(expected = IOException.class) public void modTwoFieldsWithMissingDenominator() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("mod(a,b)"); @@ -110,7 +110,7 @@ public class ModuloEvaluatorTest extends SolrTestCase { evaluator.evaluate(new Tuple(values)); } - @Test(expected = NumberFormatException.class) + @Test(expected = IOException.class) public void modTwoFieldsWithMissingNumerator() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("mod(a,b)"); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/MultiplyEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/MultiplyEvaluatorTest.java index b025ce98b84..1c0663d7fc1 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/MultiplyEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/MultiplyEvaluatorTest.java @@ -86,7 +86,7 @@ public class MultiplyEvaluatorTest extends SolrTestCase { Assert.assertEquals(6.5D, result); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void multTwoFieldWithNulls() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("mult(a,b)"); Object result; @@ -96,7 +96,7 @@ public class MultiplyEvaluatorTest extends SolrTestCase { Assert.assertNull(result); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void multTwoFieldsWithNull() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("mult(a,b)"); Object result; @@ -120,7 +120,7 @@ public class MultiplyEvaluatorTest extends SolrTestCase { Assert.assertNull(result); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void multTwoFieldsWithMissingField() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("mult(a,b)"); Object result; diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/NaturalLogEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/NaturalLogEvaluatorTest.java index 4592e477df5..71e69b899e2 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/NaturalLogEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/NaturalLogEvaluatorTest.java @@ -78,7 +78,7 @@ public class NaturalLogEvaluatorTest extends SolrTestCase { factory.constructEvaluator("log(a,b)"); } - @Test(expected = NumberFormatException.class) + @Test public void logNoValue() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("log(a)"); @@ -87,7 +87,7 @@ public class NaturalLogEvaluatorTest extends SolrTestCase { assertNull(result); } - @Test(expected = NumberFormatException.class) + @Test public void logNullValue() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("log(a)"); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/PowerEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/PowerEvaluatorTest.java index c4c02d39666..3852d7acc44 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/PowerEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/PowerEvaluatorTest.java @@ -94,7 +94,7 @@ public class PowerEvaluatorTest extends SolrTestCase { factory.constructEvaluator("pow(a)"); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void powTwoFieldWithNulls() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("pow(a,b)"); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/RoundEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/RoundEvaluatorTest.java index f6f2a967076..6f5b3ca9d0b 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/RoundEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/RoundEvaluatorTest.java @@ -80,15 +80,16 @@ public class RoundEvaluatorTest extends SolrTestCase { factory.constructEvaluator("round(a,b)"); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void noValue() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("round(a)"); values.clear(); Object result = evaluator.evaluate(new Tuple(values)); + assertNull(result); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void nullValue() throws Exception{ test(null); } diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/SineEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/SineEvaluatorTest.java index fad1ba2c931..a6059ce70a7 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/SineEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/SineEvaluatorTest.java @@ -76,7 +76,7 @@ public class SineEvaluatorTest extends SolrTestCase { factory.constructEvaluator("sin(a,b)"); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void noValue() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("sin(a)"); @@ -85,7 +85,7 @@ public class SineEvaluatorTest extends SolrTestCase { assertNull(result); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void nullValue() throws Exception{ test(null); } diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/SquareRootEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/SquareRootEvaluatorTest.java index b4f69402ded..b77a4518a26 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/SquareRootEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/SquareRootEvaluatorTest.java @@ -76,7 +76,7 @@ public class SquareRootEvaluatorTest extends SolrTestCase { factory.constructEvaluator("sqrt(a,b)"); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void noValue() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("sqrt(a)"); @@ -85,7 +85,7 @@ public class SquareRootEvaluatorTest extends SolrTestCase { assertNull(result); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void nullValue() throws Exception{ test(null); } diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/SubtractEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/SubtractEvaluatorTest.java index 48f1adbc1b7..68453407665 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/SubtractEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/SubtractEvaluatorTest.java @@ -74,7 +74,7 @@ public class SubtractEvaluatorTest extends SolrTestCase { factory.constructEvaluator("sub(a)"); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void subTwoFieldWithNulls() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("sub(a,b)"); Object result; @@ -84,7 +84,7 @@ public class SubtractEvaluatorTest extends SolrTestCase { Assert.assertNull(result); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void subTwoFieldsWithNull() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("sub(a,b)"); Object result; @@ -108,7 +108,7 @@ public class SubtractEvaluatorTest extends SolrTestCase { Assert.assertNull(result); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void subTwoFieldsWithMissingField() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("sub(a,b)"); Object result; diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/TangentEvaluatorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/TangentEvaluatorTest.java index 145261804d7..fccb62ad21f 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/TangentEvaluatorTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/eval/TangentEvaluatorTest.java @@ -76,7 +76,7 @@ public class TangentEvaluatorTest extends SolrTestCase { factory.constructEvaluator("tan(a,b)"); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void noValue() throws Exception{ StreamEvaluator evaluator = factory.constructEvaluator("tan(a)"); @@ -85,7 +85,7 @@ public class TangentEvaluatorTest extends SolrTestCase { assertNull(result); } - @Test(expected = NumberFormatException.class) + @Test//(expected = NumberFormatException.class) public void nullValue() throws Exception{ test(null); }