lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kris...@apache.org
Subject [23/25] lucene-solr:jira/solr-8593: SOLR-8530: Add support for aggregate HAVING comparisons without single quotes
Date Fri, 06 Jan 2017 21:47:43 GMT
SOLR-8530: Add support for aggregate HAVING comparisons without single quotes


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/b32cd823
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/b32cd823
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/b32cd823

Branch: refs/heads/jira/solr-8593
Commit: b32cd82318f5c8817a8383e1be7534c772e6fa13
Parents: a810fb3
Author: Joel Bernstein <jbernste@apache.org>
Authored: Thu Jan 5 20:36:32 2017 -0500
Committer: Joel Bernstein <jbernste@apache.org>
Committed: Thu Jan 5 20:46:55 2017 -0500

----------------------------------------------------------------------
 .../org/apache/solr/client/solrj/io/ops/EqualsOperation.java    | 2 +-
 .../solr/client/solrj/io/ops/GreaterThanEqualToOperation.java   | 2 +-
 .../apache/solr/client/solrj/io/ops/GreaterThanOperation.java   | 2 +-
 .../java/org/apache/solr/client/solrj/io/ops/LeafOperation.java | 1 -
 .../solr/client/solrj/io/ops/LessThanEqualToOperation.java      | 2 +-
 .../org/apache/solr/client/solrj/io/ops/LessThanOperation.java  | 2 +-
 .../apache/solr/client/solrj/io/stream/expr/StreamFactory.java  | 2 ++
 .../solr/client/solrj/io/stream/StreamExpressionTest.java       | 5 ++---
 8 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b32cd823/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/EqualsOperation.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/EqualsOperation.java
b/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/EqualsOperation.java
index 8506f30..1958551 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/EqualsOperation.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/EqualsOperation.java
@@ -54,7 +54,7 @@ public class EqualsOperation extends LeafOperation {
 
   public StreamExpression toExpression(StreamFactory factory) throws IOException {
     StreamExpression expression = new StreamExpression(factory.getFunctionName(this.getClass()));
-    expression.addParameter(quote(field));
+    expression.addParameter(field);
     expression.addParameter(Double.toString(val));
     return expression;
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b32cd823/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/GreaterThanEqualToOperation.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/GreaterThanEqualToOperation.java
b/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/GreaterThanEqualToOperation.java
index 5e6dd85..87c8364 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/GreaterThanEqualToOperation.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/GreaterThanEqualToOperation.java
@@ -54,7 +54,7 @@ public class GreaterThanEqualToOperation extends LeafOperation {
 
   public StreamExpression toExpression(StreamFactory factory) throws IOException {
     StreamExpression expression = new StreamExpression(factory.getFunctionName(this.getClass()));
-    expression.addParameter(quote(field));
+    expression.addParameter(field);
     expression.addParameter(Double.toString(val));
     return expression;
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b32cd823/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/GreaterThanOperation.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/GreaterThanOperation.java
b/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/GreaterThanOperation.java
index 9c181c1..664438a 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/GreaterThanOperation.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/GreaterThanOperation.java
@@ -54,7 +54,7 @@ public class GreaterThanOperation extends LeafOperation {
 
   public StreamExpression toExpression(StreamFactory factory) throws IOException {
     StreamExpression expression = new StreamExpression(factory.getFunctionName(this.getClass()));
-    expression.addParameter(quote(field));
+    expression.addParameter(field);
     expression.addParameter(Double.toString(val));
     return expression;
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b32cd823/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/LeafOperation.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/LeafOperation.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/LeafOperation.java
index 9a5c407..691a328 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/LeafOperation.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/LeafOperation.java
@@ -45,7 +45,6 @@ public abstract class LeafOperation implements BooleanOperation {
 
   public LeafOperation(StreamExpression expression, StreamFactory factory) throws IOException
{
     this.field = factory.getValueOperand(expression, 0);
-    this.field = this.field.replace("'","");
     this.val = Double.parseDouble(factory.getValueOperand(expression, 1));
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b32cd823/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/LessThanEqualToOperation.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/LessThanEqualToOperation.java
b/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/LessThanEqualToOperation.java
index ca362cf..2da3274 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/LessThanEqualToOperation.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/LessThanEqualToOperation.java
@@ -54,7 +54,7 @@ public class LessThanEqualToOperation extends LeafOperation {
 
   public StreamExpression toExpression(StreamFactory factory) throws IOException {
     StreamExpression expression = new StreamExpression(factory.getFunctionName(this.getClass()));
-    expression.addParameter(quote(field));
+    expression.addParameter(field);
     expression.addParameter(Double.toString(val));
     return expression;
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b32cd823/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/LessThanOperation.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/LessThanOperation.java
b/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/LessThanOperation.java
index 433f45f..c1cec95 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/LessThanOperation.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/ops/LessThanOperation.java
@@ -54,7 +54,7 @@ public class LessThanOperation extends LeafOperation {
 
   public StreamExpression toExpression(StreamFactory factory) throws IOException {
     StreamExpression expression = new StreamExpression(factory.getFunctionName(this.getClass()));
-    expression.addParameter(quote(field));
+    expression.addParameter(field);
     expression.addParameter(Double.toString(val));
     return expression;
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b32cd823/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/expr/StreamFactory.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/expr/StreamFactory.java
b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/expr/StreamFactory.java
index d2e72df..bf20a1e 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/expr/StreamFactory.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/expr/StreamFactory.java
@@ -93,6 +93,8 @@ public class StreamFactory implements Serializable {
     if(null != parameter){ 
       if(parameter instanceof StreamExpressionValue){
         return ((StreamExpressionValue)parameter).getValue();
+      } else if(parameter instanceof StreamExpression) {
+        return parameter.toString();
       }
     }
     

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b32cd823/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
index 49814a3..5b806a8 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
@@ -915,14 +915,13 @@ public class StreamExpressionTest extends SolrCloudTestCase {
     assertTrue(t.getString("id").equals("9"));
 
 
-    stream = factory.constructStream("having(rollup(over=a_f, sum(a_i), search(" + COLLECTIONORALIAS
+ ", q=*:*, fl=\"id,a_s,a_i,a_f\", sort=\"a_f asc\")), eq('sum(a_i)', 9))");
+    stream = factory.constructStream("having(rollup(over=a_f, sum(a_i), search(" + COLLECTIONORALIAS
+ ", q=*:*, fl=\"id,a_s,a_i,a_f\", sort=\"a_f asc\")), and(eq(sum(a_i), 9),eq(sum(a_i), 9)))");
     context = new StreamContext();
     context.setSolrClientCache(solrClientCache);
     stream.setStreamContext(context);
     tuples = getTuples(stream);
 
     assert(tuples.size() == 1);
-
     t = tuples.get(0);
     assertTrue(t.getDouble("a_f") == 10.0D);
 
@@ -1024,7 +1023,7 @@ public class StreamExpressionTest extends SolrCloudTestCase {
     t = tuples.get(1);
     assertTrue(t.getString("id").equals("9"));
 
-    stream = factory.constructStream("parallel("+COLLECTIONORALIAS+", workers=2, sort=\"a_f
asc\", having(rollup(over=a_f, sum(a_i), search(" + COLLECTIONORALIAS + ", q=*:*, fl=\"id,a_s,a_i,a_f\",
sort=\"a_f asc\", partitionKeys=a_f)), eq('sum(a_i)', 9)))");
+    stream = factory.constructStream("parallel("+COLLECTIONORALIAS+", workers=2, sort=\"a_f
asc\", having(rollup(over=a_f, sum(a_i), search(" + COLLECTIONORALIAS + ", q=*:*, fl=\"id,a_s,a_i,a_f\",
sort=\"a_f asc\", partitionKeys=a_f)), and(eq(sum(a_i), 9),eq(sum(a_i),9))))");
     context = new StreamContext();
     context.setSolrClientCache(solrClientCache);
     stream.setStreamContext(context);


Mime
View raw message