You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by yo...@apache.org on 2017/09/05 18:14:26 UTC
lucene-solr:master: SOLR-11317: change FacetStream to handle int/long
as well as double for metrics
Repository: lucene-solr
Updated Branches:
refs/heads/master ffb7e4f2a -> 2ed1573ad
SOLR-11317: change FacetStream to handle int/long as well as double for metrics
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/2ed1573a
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/2ed1573a
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/2ed1573a
Branch: refs/heads/master
Commit: 2ed1573adc9a7e340d1ab6ccaabf05d1bf024be3
Parents: ffb7e4f
Author: yonik <yo...@apache.org>
Authored: Tue Sep 5 14:14:19 2017 -0400
Committer: yonik <yo...@apache.org>
Committed: Tue Sep 5 14:14:19 2017 -0400
----------------------------------------------------------------------
.../src/test/org/apache/solr/handler/TestSQLHandler.java | 3 ---
.../apache/solr/client/solrj/io/stream/FacetStream.java | 10 +++++++---
2 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2ed1573a/solr/core/src/test/org/apache/solr/handler/TestSQLHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/TestSQLHandler.java b/solr/core/src/test/org/apache/solr/handler/TestSQLHandler.java
index 3206002..70ebd0a 100644
--- a/solr/core/src/test/org/apache/solr/handler/TestSQLHandler.java
+++ b/solr/core/src/test/org/apache/solr/handler/TestSQLHandler.java
@@ -23,7 +23,6 @@ import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
-import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.SolrServerException;
@@ -38,13 +37,11 @@ import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.SolrParams;
-
import org.apache.solr.common.util.NamedList;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-@LuceneTestCase.AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/SOLR-11317")
public class TestSQLHandler extends AbstractFullDistribZkTestBase {
static {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2ed1573a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FacetStream.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FacetStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FacetStream.java
index e11bf02..639782e 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FacetStream.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/FacetStream.java
@@ -495,11 +495,15 @@ public class FacetStream extends TupleStream implements Expressible {
for(Metric metric : _metrics) {
String identifier = metric.getIdentifier();
if(!identifier.startsWith("count(")) {
- double d = (double)bucket.get("facet_"+m);
+ Number d = ((Number)bucket.get("facet_"+m));
if(metric.outputLong) {
- t.put(identifier, Math.round(d));
+ if (d instanceof Long || d instanceof Integer) {
+ t.put(identifier, d.longValue());
+ } else {
+ t.put(identifier, Math.round(d.doubleValue()));
+ }
} else {
- t.put(identifier, d);
+ t.put(identifier, d.doubleValue());
}
++m;
} else {