mirror of https://github.com/apache/lucene.git
SOLR-13667: Add upper, lower, trim and split Stream Evaluators
This commit is contained in:
parent
e2440d06d8
commit
03a39666c0
|
@ -296,6 +296,10 @@ public class Lang {
|
||||||
.withFunctionName("long", LongEvaluator.class)
|
.withFunctionName("long", LongEvaluator.class)
|
||||||
.withFunctionName("dateTime", DateEvaluator.class)
|
.withFunctionName("dateTime", DateEvaluator.class)
|
||||||
.withFunctionName("concat", ConcatEvaluator.class)
|
.withFunctionName("concat", ConcatEvaluator.class)
|
||||||
|
.withFunctionName("lower", LowerEvaluator.class)
|
||||||
|
.withFunctionName("upper", UpperEvaluator.class)
|
||||||
|
.withFunctionName("split", SplitEvaluator.class)
|
||||||
|
.withFunctionName("trim", TrimEvaluator.class)
|
||||||
|
|
||||||
// Boolean Stream Evaluators
|
// Boolean Stream Evaluators
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,11 @@ public class FieldValueEvaluator extends SourceEvaluator {
|
||||||
|
|
||||||
if(value == null) {
|
if(value == null) {
|
||||||
if(sc != null) {sc.getTupleContext().put("null", fieldName);}
|
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;
|
return value;
|
||||||
|
|
|
@ -36,6 +36,10 @@ public class IsNullEvaluator extends RecursiveBooleanEvaluator implements ManyVa
|
||||||
|
|
||||||
public Object doWork(Object ... values) throws IOException {
|
public Object doWork(Object ... values) throws IOException {
|
||||||
|
|
||||||
|
if(values[0] == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if(values[0] instanceof String) {
|
if(values[0] instanceof String) {
|
||||||
//Check to see if the this tuple had a null value for that string.
|
//Check to see if the this tuple had a null value for that string.
|
||||||
Map tupleContext = getStreamContext().getTupleContext();
|
Map tupleContext = getStreamContext().getTupleContext();
|
||||||
|
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -36,6 +36,10 @@ public class NotNullEvaluator extends RecursiveBooleanEvaluator implements ManyV
|
||||||
|
|
||||||
public Object doWork(Object ... values) throws IOException {
|
public Object doWork(Object ... values) throws IOException {
|
||||||
|
|
||||||
|
if(values[0] == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(values[0] instanceof String) {
|
if(values[0] instanceof String) {
|
||||||
//Check to see if the this tuple had a null value for that string.
|
//Check to see if the this tuple had a null value for that string.
|
||||||
Map tupleContext = getStreamContext().getTupleContext();
|
Map tupleContext = getStreamContext().getTupleContext();
|
||||||
|
|
|
@ -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<String> strings = new ArrayList(tokens.length);
|
||||||
|
for(String tok : tokens) {
|
||||||
|
strings.add(tok);
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -123,7 +123,7 @@ public class CsvStream extends TupleStream implements Expressible {
|
||||||
if(tuple.EOF) {
|
if(tuple.EOF) {
|
||||||
return tuple;
|
return tuple;
|
||||||
} else {
|
} else {
|
||||||
String file = tuple.getString("file");
|
String file = formatFile(tuple.getString("file"));
|
||||||
String line = tuple.getString("line");
|
String line = tuple.getString("line");
|
||||||
if (file.equals(currentFile)) {
|
if (file.equals(currentFile)) {
|
||||||
String[] fields = split(line);
|
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) {
|
protected String[] split(String line) {
|
||||||
String[] fields = line.split(",(?=(?:[^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)",-1);
|
String[] fields = line.split(",(?=(?:[^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)",-1);
|
||||||
for(int i=0; i<fields.length; i++) {
|
for(int i=0; i<fields.length; i++) {
|
||||||
|
|
|
@ -283,9 +283,11 @@ public class SelectStream extends TupleStream implements Expressible {
|
||||||
// Apply all evaluators
|
// Apply all evaluators
|
||||||
for(Map.Entry<StreamEvaluator, String> selectedEvaluator : selectedEvaluators.entrySet()) {
|
for(Map.Entry<StreamEvaluator, String> selectedEvaluator : selectedEvaluators.entrySet()) {
|
||||||
Object o = selectedEvaluator.getKey().evaluate(workingForEvaluators);
|
Object o = selectedEvaluator.getKey().evaluate(workingForEvaluators);
|
||||||
|
if(o != null) {
|
||||||
workingForEvaluators.put(selectedEvaluator.getValue(), o);
|
workingForEvaluators.put(selectedEvaluator.getValue(), o);
|
||||||
workingToReturn.put(selectedEvaluator.getValue(), o);
|
workingToReturn.put(selectedEvaluator.getValue(), o);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return workingToReturn;
|
return workingToReturn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,8 @@ public class TestLang extends SolrTestCase {
|
||||||
"getAmplitude", "getPhase", "getAngularFrequency", "enclosingDisk", "getCenter", "getRadius",
|
"getAmplitude", "getPhase", "getAngularFrequency", "enclosingDisk", "getCenter", "getRadius",
|
||||||
"getSupportPoints", "pairSort", "log10", "plist", "recip", "pivot", "ltrim", "rtrim", "export",
|
"getSupportPoints", "pairSort", "log10", "plist", "recip", "pivot", "ltrim", "rtrim", "export",
|
||||||
"zplot", "natural", "repeat", "movingMAD", "hashRollup", "noop", "var", "stddev", "recNum", "isNull",
|
"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
|
@Test
|
||||||
public void testLang() {
|
public void testLang() {
|
||||||
|
|
|
@ -229,6 +229,73 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
assertEquals(s2, "c-d-hello");
|
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<Tuple> 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<Tuple> tuples = getTuples(solrStream);
|
||||||
|
assertEquals(tuples.size(), 1);
|
||||||
|
List<String> l1 = (List<String>)tuples.get(0).get("field3");
|
||||||
|
assertEquals(l1.get(0), "A");
|
||||||
|
assertEquals(l1.get(1), "B");
|
||||||
|
assertEquals(l1.get(2), "C");
|
||||||
|
|
||||||
|
List<String> l2 = (List<String>)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<Tuple> tuples = getTuples(solrStream);
|
||||||
|
assertEquals(tuples.size(), 1);
|
||||||
|
List<String> l1 = (List<String>)tuples.get(0).get("field2");
|
||||||
|
assertEquals(l1.get(0), "a");
|
||||||
|
assertEquals(l1.get(1), "b");
|
||||||
|
assertEquals(l1.get(2), "c");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMemset() throws Exception {
|
public void testMemset() throws Exception {
|
||||||
String expr = "let(echo=\"b, c\"," +
|
String expr = "let(echo=\"b, c\"," +
|
||||||
|
@ -1365,7 +1432,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
String cexpr = "let(echo=true," +
|
String cexpr = "let(echo=true," +
|
||||||
" a=setColumnLabels(matrix(array(1, 2, 3), " +
|
" a=setColumnLabels(matrix(array(1, 2, 3), " +
|
||||||
" rev(array(4,5,6)))," +
|
" rev(array(4,5,6)))," +
|
||||||
" array(col1, col2, col3))," +
|
" array(\"col1\", \"col2\", \"col3\"))," +
|
||||||
" b=rowAt(a, 1)," +
|
" b=rowAt(a, 1)," +
|
||||||
" c=colAt(a, 2)," +
|
" c=colAt(a, 2)," +
|
||||||
" d=getColumnLabels(a)," +
|
" d=getColumnLabels(a)," +
|
||||||
|
@ -1373,7 +1440,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
" f=rowCount(a)," +
|
" f=rowCount(a)," +
|
||||||
" g=columnCount(a)," +
|
" g=columnCount(a)," +
|
||||||
" h=indexOf(d, \"col2\")," +
|
" h=indexOf(d, \"col2\")," +
|
||||||
" i=indexOf(d, col3))";
|
" i=indexOf(d, \"col3\"))";
|
||||||
ModifiableSolrParams paramsLoc = new ModifiableSolrParams();
|
ModifiableSolrParams paramsLoc = new ModifiableSolrParams();
|
||||||
paramsLoc.set("expr", cexpr);
|
paramsLoc.set("expr", cexpr);
|
||||||
paramsLoc.set("qt", "/stream");
|
paramsLoc.set("qt", "/stream");
|
||||||
|
@ -2058,7 +2125,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMatches() throws Exception {
|
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();
|
ModifiableSolrParams paramsLoc = new ModifiableSolrParams();
|
||||||
paramsLoc.set("expr", cexpr);
|
paramsLoc.set("expr", cexpr);
|
||||||
paramsLoc.set("qt", "/stream");
|
paramsLoc.set("qt", "/stream");
|
||||||
|
@ -2272,7 +2339,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
" b=termVectors(a, minDocFreq=0, maxDocFreq=1)," +
|
" b=termVectors(a, minDocFreq=0, maxDocFreq=1)," +
|
||||||
" c=getRowLabels(b)," +
|
" c=getRowLabels(b)," +
|
||||||
" d=getColumnLabels(b)," +
|
" d=getColumnLabels(b)," +
|
||||||
" e=getAttribute(b, docFreqs))";
|
" e=getAttribute(b, \"docFreqs\"))";
|
||||||
ModifiableSolrParams paramsLoc = new ModifiableSolrParams();
|
ModifiableSolrParams paramsLoc = new ModifiableSolrParams();
|
||||||
paramsLoc.set("expr", cexpr);
|
paramsLoc.set("expr", cexpr);
|
||||||
paramsLoc.set("qt", "/stream");
|
paramsLoc.set("qt", "/stream");
|
||||||
|
@ -2351,7 +2418,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
" b=termVectors(a, minTermLength=4, minDocFreq=0, maxDocFreq=1)," +
|
" b=termVectors(a, minTermLength=4, minDocFreq=0, maxDocFreq=1)," +
|
||||||
" c=getRowLabels(b)," +
|
" c=getRowLabels(b)," +
|
||||||
" d=getColumnLabels(b)," +
|
" d=getColumnLabels(b)," +
|
||||||
" e=getAttribute(b, docFreqs))";
|
" e=getAttribute(b, \"docFreqs\"))";
|
||||||
paramsLoc = new ModifiableSolrParams();
|
paramsLoc = new ModifiableSolrParams();
|
||||||
paramsLoc.set("expr", cexpr);
|
paramsLoc.set("expr", cexpr);
|
||||||
paramsLoc.set("qt", "/stream");
|
paramsLoc.set("qt", "/stream");
|
||||||
|
@ -2423,7 +2490,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
" b=termVectors(a, exclude=jim, minDocFreq=0, maxDocFreq=1)," +
|
" b=termVectors(a, exclude=jim, minDocFreq=0, maxDocFreq=1)," +
|
||||||
" c=getRowLabels(b)," +
|
" c=getRowLabels(b)," +
|
||||||
" d=getColumnLabels(b)," +
|
" d=getColumnLabels(b)," +
|
||||||
" e=getAttribute(b, docFreqs))";
|
" e=getAttribute(b, \"docFreqs\"))";
|
||||||
|
|
||||||
paramsLoc = new ModifiableSolrParams();
|
paramsLoc = new ModifiableSolrParams();
|
||||||
paramsLoc.set("expr", cexpr);
|
paramsLoc.set("expr", cexpr);
|
||||||
|
@ -2495,7 +2562,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
" b=termVectors(a, minDocFreq=.5, maxDocFreq=1)," +
|
" b=termVectors(a, minDocFreq=.5, maxDocFreq=1)," +
|
||||||
" c=getRowLabels(b)," +
|
" c=getRowLabels(b)," +
|
||||||
" d=getColumnLabels(b)," +
|
" d=getColumnLabels(b)," +
|
||||||
" e=getAttribute(b, docFreqs))";
|
" e=getAttribute(b, \"docFreqs\"))";
|
||||||
paramsLoc = new ModifiableSolrParams();
|
paramsLoc = new ModifiableSolrParams();
|
||||||
paramsLoc.set("expr", cexpr);
|
paramsLoc.set("expr", cexpr);
|
||||||
paramsLoc.set("qt", "/stream");
|
paramsLoc.set("qt", "/stream");
|
||||||
|
@ -2549,7 +2616,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
" b=termVectors(a, maxDocFreq=0)," +
|
" b=termVectors(a, maxDocFreq=0)," +
|
||||||
" c=getRowLabels(b)," +
|
" c=getRowLabels(b)," +
|
||||||
" d=getColumnLabels(b)," +
|
" d=getColumnLabels(b)," +
|
||||||
" e=getAttribute(b, docFreqs))";
|
" e=getAttribute(b, \"docFreqs\"))";
|
||||||
paramsLoc = new ModifiableSolrParams();
|
paramsLoc = new ModifiableSolrParams();
|
||||||
paramsLoc.set("expr", cexpr);
|
paramsLoc.set("expr", cexpr);
|
||||||
paramsLoc.set("qt", "/stream");
|
paramsLoc.set("qt", "/stream");
|
||||||
|
@ -2571,7 +2638,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
" tuple(fx=x2, fy=f1, fv=add(1,7)), " +
|
" tuple(fx=x2, fy=f1, fv=add(1,7)), " +
|
||||||
" tuple(fx=x3, fy=f1, fv=add(1,4))," +
|
" tuple(fx=x3, fy=f1, fv=add(1,4))," +
|
||||||
" tuple(fx=x3, fy=f3, fv=add(1,7)))," +
|
" tuple(fx=x3, fy=f3, fv=add(1,7)))," +
|
||||||
" b=pivot(a, fx, fy, fv)," +
|
" b=pivot(a, \"fx\", \"fy\", \"fv\")," +
|
||||||
" c=getRowLabels(b)," +
|
" c=getRowLabels(b)," +
|
||||||
" d=getColumnLabels(b))";
|
" d=getColumnLabels(b))";
|
||||||
ModifiableSolrParams paramsLoc = new ModifiableSolrParams();
|
ModifiableSolrParams paramsLoc = new ModifiableSolrParams();
|
||||||
|
@ -2741,7 +2808,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
" c=array(0,0,0,1,1,1)," +
|
" c=array(0,0,0,1,1,1)," +
|
||||||
" d=array(0,0,0,1,1,1)," +
|
" d=array(0,0,0,1,1,1)," +
|
||||||
" e=setRowLabels(matrix(a,b,c,d), " +
|
" e=setRowLabels(matrix(a,b,c,d), " +
|
||||||
" array(doc1, doc2, doc3, doc4))," +
|
" array(\"doc1\", \"doc2\", \"doc3\", \"doc4\"))," +
|
||||||
" f=kmeans(e, 2)," +
|
" f=kmeans(e, 2)," +
|
||||||
" g=getCluster(f, 0)," +
|
" g=getCluster(f, 0)," +
|
||||||
" h=getCluster(f, 1)," +
|
" h=getCluster(f, 1)," +
|
||||||
|
@ -2820,7 +2887,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
" c=array(0,0,0,1,1,1)," +
|
" c=array(0,0,0,1,1,1)," +
|
||||||
" d=array(0,0,0,1,1,1)," +
|
" d=array(0,0,0,1,1,1)," +
|
||||||
" e=setRowLabels(matrix(a,b,c,d), " +
|
" e=setRowLabels(matrix(a,b,c,d), " +
|
||||||
" array(doc1, doc2, doc3, doc4))," +
|
" array(\"doc1\", \"doc2\", \"doc3\", \"doc4\"))," +
|
||||||
" f=multiKmeans(e, 2, 5)," +
|
" f=multiKmeans(e, 2, 5)," +
|
||||||
" g=getCluster(f, 0)," +
|
" g=getCluster(f, 0)," +
|
||||||
" h=getCluster(f, 1)," +
|
" h=getCluster(f, 1)," +
|
||||||
|
@ -2899,7 +2966,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
" c=array(0,0,0,1,1,1)," +
|
" c=array(0,0,0,1,1,1)," +
|
||||||
" d=array(0,0,0,1,1,1)," +
|
" d=array(0,0,0,1,1,1)," +
|
||||||
" e=setRowLabels(matrix(a,b,c,d), " +
|
" e=setRowLabels(matrix(a,b,c,d), " +
|
||||||
" array(doc1, doc2, doc3, doc4))," +
|
" array(\"doc1\", \"doc2\", \"doc3\", \"doc4\"))," +
|
||||||
" f=fuzzyKmeans(e, 2)," +
|
" f=fuzzyKmeans(e, 2)," +
|
||||||
" g=getCluster(f, 0)," +
|
" g=getCluster(f, 0)," +
|
||||||
" h=getCluster(f, 1)," +
|
" h=getCluster(f, 1)," +
|
||||||
|
@ -3022,8 +3089,8 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
String cexpr = "let(echo=true," +
|
String cexpr = "let(echo=true," +
|
||||||
" a=oscillate(10, .3, 2.9)," +
|
" a=oscillate(10, .3, 2.9)," +
|
||||||
" b=describe(a)," +
|
" b=describe(a)," +
|
||||||
" c=getValue(b, min)," +
|
" c=getValue(b, \"min\")," +
|
||||||
" d=getValue(b, max)," +
|
" d=getValue(b, \"max\")," +
|
||||||
" e=harmfit(a)," +
|
" e=harmfit(a)," +
|
||||||
" f=getAmplitude(e)," +
|
" f=getAmplitude(e)," +
|
||||||
" g=getAngularFrequency(e)," +
|
" g=getAngularFrequency(e)," +
|
||||||
|
@ -3119,10 +3186,10 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
public void testSetAndGetValue() throws Exception {
|
public void testSetAndGetValue() throws Exception {
|
||||||
String cexpr = "let(echo=true," +
|
String cexpr = "let(echo=true," +
|
||||||
" a=describe(array(1,2,3,4,5,6,7))," +
|
" 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))," +
|
" c=setValue(a, \"test\", add(b, 1))," +
|
||||||
" d=getValue(c, test)," +
|
" d=getValue(c, \"test\")," +
|
||||||
" e=setValue(c, blah, array(8.11,9.55,10.1))," +
|
" e=setValue(c, \"blah\", array(8.11,9.55,10.1))," +
|
||||||
" f=getValue(e, \"blah\"))";
|
" f=getValue(e, \"blah\"))";
|
||||||
ModifiableSolrParams paramsLoc = new ModifiableSolrParams();
|
ModifiableSolrParams paramsLoc = new ModifiableSolrParams();
|
||||||
paramsLoc.set("expr", cexpr);
|
paramsLoc.set("expr", cexpr);
|
||||||
|
@ -3576,7 +3643,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCache() throws Exception {
|
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();
|
ModifiableSolrParams paramsLoc = new ModifiableSolrParams();
|
||||||
paramsLoc.set("expr", cexpr);
|
paramsLoc.set("expr", cexpr);
|
||||||
paramsLoc.set("qt", "/stream");
|
paramsLoc.set("qt", "/stream");
|
||||||
|
@ -3590,7 +3657,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
assertTrue(dotProduct.doubleValue() == 182);
|
assertTrue(dotProduct.doubleValue() == 182);
|
||||||
|
|
||||||
|
|
||||||
cexpr = "getCache(space1, key1)";
|
cexpr = "getCache(\"space1\", \"key1\")";
|
||||||
paramsLoc = new ModifiableSolrParams();
|
paramsLoc = new ModifiableSolrParams();
|
||||||
paramsLoc.set("expr", cexpr);
|
paramsLoc.set("expr", cexpr);
|
||||||
paramsLoc.set("qt", "/stream");
|
paramsLoc.set("qt", "/stream");
|
||||||
|
@ -3602,7 +3669,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
dotProduct = (Number)tuples.get(0).get("return-value");
|
dotProduct = (Number)tuples.get(0).get("return-value");
|
||||||
assertTrue(dotProduct.doubleValue() == 182);
|
assertTrue(dotProduct.doubleValue() == 182);
|
||||||
|
|
||||||
cexpr = "listCache(space1)";
|
cexpr = "listCache(\"space1\")";
|
||||||
paramsLoc = new ModifiableSolrParams();
|
paramsLoc = new ModifiableSolrParams();
|
||||||
paramsLoc.set("expr", cexpr);
|
paramsLoc.set("expr", cexpr);
|
||||||
paramsLoc.set("qt", "/stream");
|
paramsLoc.set("qt", "/stream");
|
||||||
|
@ -3628,7 +3695,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
assertEquals(keys.size(), 1);
|
assertEquals(keys.size(), 1);
|
||||||
assertEquals(keys.get(0), "space1");
|
assertEquals(keys.get(0), "space1");
|
||||||
|
|
||||||
cexpr = "removeCache(space1, key1)";
|
cexpr = "removeCache(\"space1\", \"key1\")";
|
||||||
paramsLoc = new ModifiableSolrParams();
|
paramsLoc = new ModifiableSolrParams();
|
||||||
paramsLoc.set("expr", cexpr);
|
paramsLoc.set("expr", cexpr);
|
||||||
paramsLoc.set("qt", "/stream");
|
paramsLoc.set("qt", "/stream");
|
||||||
|
@ -3641,7 +3708,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
assertTrue(dotProduct.doubleValue() == 182);
|
assertTrue(dotProduct.doubleValue() == 182);
|
||||||
|
|
||||||
|
|
||||||
cexpr = "listCache(space1)";
|
cexpr = "listCache(\"space1\")";
|
||||||
paramsLoc = new ModifiableSolrParams();
|
paramsLoc = new ModifiableSolrParams();
|
||||||
paramsLoc.set("expr", cexpr);
|
paramsLoc.set("expr", cexpr);
|
||||||
paramsLoc.set("qt", "/stream");
|
paramsLoc.set("qt", "/stream");
|
||||||
|
@ -3652,11 +3719,6 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
assertTrue(tuples.size() == 1);
|
assertTrue(tuples.size() == 1);
|
||||||
keys = (List<String>)tuples.get(0).get("return-value");
|
keys = (List<String>)tuples.get(0).get("return-value");
|
||||||
assertEquals(keys.size(), 0);
|
assertEquals(keys.size(), 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -3961,7 +4023,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
String cexpr = "let(echo=true," +
|
String cexpr = "let(echo=true," +
|
||||||
" a=setRowLabels(matrix(array(1,1,1,0,0,0),"+
|
" a=setRowLabels(matrix(array(1,1,1,0,0,0),"+
|
||||||
" array(1,0,0,0,1,1),"+
|
" 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),"+
|
" b=array(0,0,0,1,1,1),"+
|
||||||
" c=knn(a, b, 2),"+
|
" c=knn(a, b, 2),"+
|
||||||
" d=getRowLabels(c),"+
|
" d=getRowLabels(c),"+
|
||||||
|
@ -4483,7 +4545,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDateTime() throws Exception {
|
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();
|
ModifiableSolrParams paramsLoc = new ModifiableSolrParams();
|
||||||
paramsLoc.set("expr", expr);
|
paramsLoc.set("expr", expr);
|
||||||
paramsLoc.set("qt", "/stream");
|
paramsLoc.set("qt", "/stream");
|
||||||
|
@ -4502,7 +4564,7 @@ public class MathExpressionTest extends SolrCloudTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDateTimeTZ() throws Exception {
|
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();
|
ModifiableSolrParams paramsLoc = new ModifiableSolrParams();
|
||||||
paramsLoc.set("expr", expr);
|
paramsLoc.set("expr", expr);
|
||||||
paramsLoc.set("qt", "/stream");
|
paramsLoc.set("qt", "/stream");
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class AbsoluteValueEvaluatorTest extends SolrTestCase {
|
||||||
factory.constructEvaluator("abs(a,b)");
|
factory.constructEvaluator("abs(a,b)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void absNoValue() throws Exception{
|
public void absNoValue() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("abs(a)");
|
StreamEvaluator evaluator = factory.constructEvaluator("abs(a)");
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ public class AbsoluteValueEvaluatorTest extends SolrTestCase {
|
||||||
assertNull(result);
|
assertNull(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void absNullValue() throws Exception{
|
public void absNullValue() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("abs(a)");
|
StreamEvaluator evaluator = factory.constructEvaluator("abs(a)");
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class AddEvaluatorTest extends SolrTestCase {
|
||||||
Assert.assertEquals(3.2D, result);
|
Assert.assertEquals(3.2D, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void addTwoFieldWithNulls() throws Exception{
|
public void addTwoFieldWithNulls() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("add(a,b)");
|
StreamEvaluator evaluator = factory.constructEvaluator("add(a,b)");
|
||||||
Object result;
|
Object result;
|
||||||
|
@ -78,7 +78,7 @@ public class AddEvaluatorTest extends SolrTestCase {
|
||||||
Assert.assertNull(result);
|
Assert.assertNull(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void addTwoFieldsWithNull() throws Exception{
|
public void addTwoFieldsWithNull() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("add(a,b)");
|
StreamEvaluator evaluator = factory.constructEvaluator("add(a,b)");
|
||||||
Object result;
|
Object result;
|
||||||
|
@ -102,7 +102,7 @@ public class AddEvaluatorTest extends SolrTestCase {
|
||||||
Assert.assertNull(result);
|
Assert.assertNull(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void addTwoFieldsWithMissingField() throws Exception{
|
public void addTwoFieldsWithMissingField() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("add(a,b)");
|
StreamEvaluator evaluator = factory.constructEvaluator("add(a,b)");
|
||||||
Object result;
|
Object result;
|
||||||
|
|
|
@ -76,15 +76,16 @@ public class ArcCosineEvaluatorTest extends SolrTestCase {
|
||||||
factory.constructEvaluator("acos(a,b)");
|
factory.constructEvaluator("acos(a,b)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void noValue() throws Exception{
|
public void noValue() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("acos(a)");
|
StreamEvaluator evaluator = factory.constructEvaluator("acos(a)");
|
||||||
|
|
||||||
values.clear();
|
values.clear();
|
||||||
Object result = evaluator.evaluate(new Tuple(values));
|
Object result = evaluator.evaluate(new Tuple(values));
|
||||||
|
assertNull(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void nullValue() throws Exception{
|
public void nullValue() throws Exception{
|
||||||
test(null);
|
test(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class ArcSineEvaluatorTest extends SolrTestCase {
|
||||||
factory.constructEvaluator("asin(a,b)");
|
factory.constructEvaluator("asin(a,b)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void noValue() throws Exception{
|
public void noValue() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("asin(a)");
|
StreamEvaluator evaluator = factory.constructEvaluator("asin(a)");
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class ArcSineEvaluatorTest extends SolrTestCase {
|
||||||
assertNull(result);
|
assertNull(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void nullValue() throws Exception{
|
public void nullValue() throws Exception{
|
||||||
test(null);
|
test(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class ArcTangentEvaluatorTest extends SolrTestCase {
|
||||||
factory.constructEvaluator("atan(a,b)");
|
factory.constructEvaluator("atan(a,b)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void noValue() throws Exception{
|
public void noValue() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("atan(a)");
|
StreamEvaluator evaluator = factory.constructEvaluator("atan(a)");
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ public class ArcTangentEvaluatorTest extends SolrTestCase {
|
||||||
Object result = evaluator.evaluate(new Tuple(values));
|
Object result = evaluator.evaluate(new Tuple(values));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void nullValue() throws Exception{
|
public void nullValue() throws Exception{
|
||||||
test(null);
|
test(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class CeilingEvaluatorTest extends SolrTestCase {
|
||||||
factory.constructEvaluator("ceil(a,b)");
|
factory.constructEvaluator("ceil(a,b)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void ceilNoValue() throws Exception{
|
public void ceilNoValue() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("ceil(a)");
|
StreamEvaluator evaluator = factory.constructEvaluator("ceil(a)");
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class CeilingEvaluatorTest extends SolrTestCase {
|
||||||
assertNull(result);
|
assertNull(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void ceilNullValue() throws Exception{
|
public void ceilNullValue() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("ceil(a)");
|
StreamEvaluator evaluator = factory.constructEvaluator("ceil(a)");
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class CosineEvaluatorTest extends SolrTestCase {
|
||||||
factory.constructEvaluator("cos(a,b)");
|
factory.constructEvaluator("cos(a,b)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void noValue() throws Exception{
|
public void noValue() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("cos(a)");
|
StreamEvaluator evaluator = factory.constructEvaluator("cos(a)");
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ public class CosineEvaluatorTest extends SolrTestCase {
|
||||||
Object result = evaluator.evaluate(new Tuple(values));
|
Object result = evaluator.evaluate(new Tuple(values));
|
||||||
assertNull(result);
|
assertNull(result);
|
||||||
}
|
}
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void nullValue() throws Exception{
|
public void nullValue() throws Exception{
|
||||||
test(null);
|
test(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class CubedRootEvaluatorTest extends SolrTestCase {
|
||||||
factory.constructEvaluator("cbrt(a,b)");
|
factory.constructEvaluator("cbrt(a,b)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void noValue() throws Exception{
|
public void noValue() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("cbrt(a)");
|
StreamEvaluator evaluator = factory.constructEvaluator("cbrt(a)");
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ public class CubedRootEvaluatorTest extends SolrTestCase {
|
||||||
Object result = evaluator.evaluate(new Tuple(values));
|
Object result = evaluator.evaluate(new Tuple(values));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void nullValue() throws Exception{
|
public void nullValue() throws Exception{
|
||||||
test(null);
|
test(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class DivideEvaluatorTest extends SolrTestCase {
|
||||||
factory.constructEvaluator("div(a)");
|
factory.constructEvaluator("div(a)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test(expected = IOException.class)
|
||||||
public void divTwoFieldWithNulls() throws Exception{
|
public void divTwoFieldWithNulls() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("div(a,b)");
|
StreamEvaluator evaluator = factory.constructEvaluator("div(a,b)");
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ public class DivideEvaluatorTest extends SolrTestCase {
|
||||||
evaluator.evaluate(new Tuple(values));
|
evaluator.evaluate(new Tuple(values));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test(expected = IOException.class)
|
||||||
public void divTwoFieldsWithNullDenominator() throws Exception{
|
public void divTwoFieldsWithNullDenominator() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("div(a,b)");
|
StreamEvaluator evaluator = factory.constructEvaluator("div(a,b)");
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ public class DivideEvaluatorTest extends SolrTestCase {
|
||||||
evaluator.evaluate(new Tuple(values));
|
evaluator.evaluate(new Tuple(values));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test(expected = IOException.class)
|
||||||
public void divTwoFieldsWithNullNumerator() throws Exception{
|
public void divTwoFieldsWithNullNumerator() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("div(a,b)");
|
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{
|
public void divTwoFieldsWithMissingDenominator() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("div(a,b)");
|
StreamEvaluator evaluator = factory.constructEvaluator("div(a,b)");
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ public class DivideEvaluatorTest extends SolrTestCase {
|
||||||
evaluator.evaluate(new Tuple(values));
|
evaluator.evaluate(new Tuple(values));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test(expected = IOException.class)
|
||||||
public void divTwoFieldsWithMissingNumerator() throws Exception{
|
public void divTwoFieldsWithMissingNumerator() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("div(a,b)");
|
StreamEvaluator evaluator = factory.constructEvaluator("div(a,b)");
|
||||||
|
|
||||||
|
|
|
@ -76,19 +76,21 @@ public class FloorEvaluatorTest extends SolrTestCase {
|
||||||
factory.constructEvaluator("floor(a,b)");
|
factory.constructEvaluator("floor(a,b)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void floorNoValue() throws Exception{
|
public void floorNoValue() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("floor(a)");
|
StreamEvaluator evaluator = factory.constructEvaluator("floor(a)");
|
||||||
|
|
||||||
values.clear();
|
values.clear();
|
||||||
Object result = evaluator.evaluate(new Tuple(values));
|
Object result = evaluator.evaluate(new Tuple(values));
|
||||||
|
assertNull(result);
|
||||||
}
|
}
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void floorNullValue() throws Exception{
|
public void floorNullValue() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("floor(a)");
|
StreamEvaluator evaluator = factory.constructEvaluator("floor(a)");
|
||||||
|
|
||||||
values.clear();
|
values.clear();
|
||||||
values.put("a", null);
|
values.put("a", null);
|
||||||
Object result = evaluator.evaluate(new Tuple(values));
|
Object result = evaluator.evaluate(new Tuple(values));
|
||||||
|
assertNull(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class HyperbolicCosineEvaluatorTest extends SolrTestCase {
|
||||||
factory.constructEvaluator("cosh(a,b)");
|
factory.constructEvaluator("cosh(a,b)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void noValue() throws Exception{
|
public void noValue() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("cosh(a)");
|
StreamEvaluator evaluator = factory.constructEvaluator("cosh(a)");
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class HyperbolicCosineEvaluatorTest extends SolrTestCase {
|
||||||
assertNull(result);
|
assertNull(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void nullValue() throws Exception{
|
public void nullValue() throws Exception{
|
||||||
test(null);
|
test(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class HyperbolicSineEvaluatorTest extends SolrTestCase {
|
||||||
factory.constructEvaluator("sinh(a,b)");
|
factory.constructEvaluator("sinh(a,b)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void noValue() throws Exception{
|
public void noValue() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("sinh(a)");
|
StreamEvaluator evaluator = factory.constructEvaluator("sinh(a)");
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class HyperbolicSineEvaluatorTest extends SolrTestCase {
|
||||||
assertNull(result);
|
assertNull(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void nullValue() throws Exception{
|
public void nullValue() throws Exception{
|
||||||
test(null);
|
test(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class HyperbolicTangentEvaluatorTest extends SolrTestCase {
|
||||||
factory.constructEvaluator("tanh(a,b)");
|
factory.constructEvaluator("tanh(a,b)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void noValue() throws Exception{
|
public void noValue() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("tanh(a)");
|
StreamEvaluator evaluator = factory.constructEvaluator("tanh(a)");
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class HyperbolicTangentEvaluatorTest extends SolrTestCase {
|
||||||
assertNull(result);
|
assertNull(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void nullValue() throws Exception{
|
public void nullValue() throws Exception{
|
||||||
test(null);
|
test(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class ModuloEvaluatorTest extends SolrTestCase {
|
||||||
factory.constructEvaluator("mod(a)");
|
factory.constructEvaluator("mod(a)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test(expected = IOException.class)
|
||||||
public void modTwoFieldWithNulls() throws Exception{
|
public void modTwoFieldWithNulls() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("mod(a,b)");
|
StreamEvaluator evaluator = factory.constructEvaluator("mod(a,b)");
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ public class ModuloEvaluatorTest extends SolrTestCase {
|
||||||
evaluator.evaluate(new Tuple(values));
|
evaluator.evaluate(new Tuple(values));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test(expected = IOException.class)
|
||||||
public void modTwoFieldsWithNullDenominator() throws Exception{
|
public void modTwoFieldsWithNullDenominator() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("mod(a,b)");
|
StreamEvaluator evaluator = factory.constructEvaluator("mod(a,b)");
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ public class ModuloEvaluatorTest extends SolrTestCase {
|
||||||
evaluator.evaluate(new Tuple(values));
|
evaluator.evaluate(new Tuple(values));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test(expected = IOException.class)
|
||||||
public void modTwoFieldsWithNullNumerator() throws Exception{
|
public void modTwoFieldsWithNullNumerator() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("mod(a,b)");
|
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{
|
public void modTwoFieldsWithMissingDenominator() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("mod(a,b)");
|
StreamEvaluator evaluator = factory.constructEvaluator("mod(a,b)");
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ public class ModuloEvaluatorTest extends SolrTestCase {
|
||||||
evaluator.evaluate(new Tuple(values));
|
evaluator.evaluate(new Tuple(values));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test(expected = IOException.class)
|
||||||
public void modTwoFieldsWithMissingNumerator() throws Exception{
|
public void modTwoFieldsWithMissingNumerator() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("mod(a,b)");
|
StreamEvaluator evaluator = factory.constructEvaluator("mod(a,b)");
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class MultiplyEvaluatorTest extends SolrTestCase {
|
||||||
Assert.assertEquals(6.5D, result);
|
Assert.assertEquals(6.5D, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void multTwoFieldWithNulls() throws Exception{
|
public void multTwoFieldWithNulls() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("mult(a,b)");
|
StreamEvaluator evaluator = factory.constructEvaluator("mult(a,b)");
|
||||||
Object result;
|
Object result;
|
||||||
|
@ -96,7 +96,7 @@ public class MultiplyEvaluatorTest extends SolrTestCase {
|
||||||
Assert.assertNull(result);
|
Assert.assertNull(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void multTwoFieldsWithNull() throws Exception{
|
public void multTwoFieldsWithNull() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("mult(a,b)");
|
StreamEvaluator evaluator = factory.constructEvaluator("mult(a,b)");
|
||||||
Object result;
|
Object result;
|
||||||
|
@ -120,7 +120,7 @@ public class MultiplyEvaluatorTest extends SolrTestCase {
|
||||||
Assert.assertNull(result);
|
Assert.assertNull(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void multTwoFieldsWithMissingField() throws Exception{
|
public void multTwoFieldsWithMissingField() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("mult(a,b)");
|
StreamEvaluator evaluator = factory.constructEvaluator("mult(a,b)");
|
||||||
Object result;
|
Object result;
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class NaturalLogEvaluatorTest extends SolrTestCase {
|
||||||
factory.constructEvaluator("log(a,b)");
|
factory.constructEvaluator("log(a,b)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test
|
||||||
public void logNoValue() throws Exception{
|
public void logNoValue() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("log(a)");
|
StreamEvaluator evaluator = factory.constructEvaluator("log(a)");
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ public class NaturalLogEvaluatorTest extends SolrTestCase {
|
||||||
assertNull(result);
|
assertNull(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test
|
||||||
public void logNullValue() throws Exception{
|
public void logNullValue() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("log(a)");
|
StreamEvaluator evaluator = factory.constructEvaluator("log(a)");
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class PowerEvaluatorTest extends SolrTestCase {
|
||||||
factory.constructEvaluator("pow(a)");
|
factory.constructEvaluator("pow(a)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void powTwoFieldWithNulls() throws Exception{
|
public void powTwoFieldWithNulls() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("pow(a,b)");
|
StreamEvaluator evaluator = factory.constructEvaluator("pow(a,b)");
|
||||||
|
|
||||||
|
|
|
@ -80,15 +80,16 @@ public class RoundEvaluatorTest extends SolrTestCase {
|
||||||
factory.constructEvaluator("round(a,b)");
|
factory.constructEvaluator("round(a,b)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void noValue() throws Exception{
|
public void noValue() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("round(a)");
|
StreamEvaluator evaluator = factory.constructEvaluator("round(a)");
|
||||||
|
|
||||||
values.clear();
|
values.clear();
|
||||||
Object result = evaluator.evaluate(new Tuple(values));
|
Object result = evaluator.evaluate(new Tuple(values));
|
||||||
|
assertNull(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void nullValue() throws Exception{
|
public void nullValue() throws Exception{
|
||||||
test(null);
|
test(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class SineEvaluatorTest extends SolrTestCase {
|
||||||
factory.constructEvaluator("sin(a,b)");
|
factory.constructEvaluator("sin(a,b)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void noValue() throws Exception{
|
public void noValue() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("sin(a)");
|
StreamEvaluator evaluator = factory.constructEvaluator("sin(a)");
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class SineEvaluatorTest extends SolrTestCase {
|
||||||
assertNull(result);
|
assertNull(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void nullValue() throws Exception{
|
public void nullValue() throws Exception{
|
||||||
test(null);
|
test(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class SquareRootEvaluatorTest extends SolrTestCase {
|
||||||
factory.constructEvaluator("sqrt(a,b)");
|
factory.constructEvaluator("sqrt(a,b)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void noValue() throws Exception{
|
public void noValue() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("sqrt(a)");
|
StreamEvaluator evaluator = factory.constructEvaluator("sqrt(a)");
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class SquareRootEvaluatorTest extends SolrTestCase {
|
||||||
assertNull(result);
|
assertNull(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void nullValue() throws Exception{
|
public void nullValue() throws Exception{
|
||||||
test(null);
|
test(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class SubtractEvaluatorTest extends SolrTestCase {
|
||||||
factory.constructEvaluator("sub(a)");
|
factory.constructEvaluator("sub(a)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void subTwoFieldWithNulls() throws Exception{
|
public void subTwoFieldWithNulls() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("sub(a,b)");
|
StreamEvaluator evaluator = factory.constructEvaluator("sub(a,b)");
|
||||||
Object result;
|
Object result;
|
||||||
|
@ -84,7 +84,7 @@ public class SubtractEvaluatorTest extends SolrTestCase {
|
||||||
Assert.assertNull(result);
|
Assert.assertNull(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void subTwoFieldsWithNull() throws Exception{
|
public void subTwoFieldsWithNull() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("sub(a,b)");
|
StreamEvaluator evaluator = factory.constructEvaluator("sub(a,b)");
|
||||||
Object result;
|
Object result;
|
||||||
|
@ -108,7 +108,7 @@ public class SubtractEvaluatorTest extends SolrTestCase {
|
||||||
Assert.assertNull(result);
|
Assert.assertNull(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void subTwoFieldsWithMissingField() throws Exception{
|
public void subTwoFieldsWithMissingField() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("sub(a,b)");
|
StreamEvaluator evaluator = factory.constructEvaluator("sub(a,b)");
|
||||||
Object result;
|
Object result;
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class TangentEvaluatorTest extends SolrTestCase {
|
||||||
factory.constructEvaluator("tan(a,b)");
|
factory.constructEvaluator("tan(a,b)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void noValue() throws Exception{
|
public void noValue() throws Exception{
|
||||||
StreamEvaluator evaluator = factory.constructEvaluator("tan(a)");
|
StreamEvaluator evaluator = factory.constructEvaluator("tan(a)");
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class TangentEvaluatorTest extends SolrTestCase {
|
||||||
assertNull(result);
|
assertNull(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test//(expected = NumberFormatException.class)
|
||||||
public void nullValue() throws Exception{
|
public void nullValue() throws Exception{
|
||||||
test(null);
|
test(null);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue