[jira] [Created] (SOLR-12657) Facet streaming expression doesn't support min / max correctly for date fields.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (SOLR-12657) Facet streaming expression doesn't support min / max correctly for date fields.

JIRA jira@apache.org
Timothy Potter created SOLR-12657:
-------------------------------------

             Summary: Facet streaming expression doesn't support min / max correctly for date fields.
                 Key: SOLR-12657
                 URL: https://issues.apache.org/jira/browse/SOLR-12657
             Project: Solr
          Issue Type: Bug
      Security Level: Public (Default Security Level. Issues are Public)
          Components: streaming expressions
    Affects Versions: 7.4
            Reporter: Timothy Potter
            Assignee: Timothy Potter
             Fix For: 7.4.1


Using this streaming expression to compute a min / max timestamp for each movie_id in my ratings collection (movielens),

{code}

facet(ratings,
 q="movie_id:[* TO *]",
 buckets="movie_id",
 bucketSizeLimit=1254,
 bucketSorts="movie_id asc", count(*),
 min(rating_timestamp),
 max(rating_timestamp)
)

{code}

I get the following errors:

{code}

2018-08-10T17:48:58,293 - INFO [qtp726950788-385:solr.core.SolrCore@2544] - \{collection=c:ratings, core=x:ratings_shard1_replica_n1, node_name=n:192.168.1.6:8983_solr, replica=r:core_node2, shard=s:shard1} - [ratings_shard1_replica_n1] webapp=/solr path=/stream params=\{expr=facet(ratings,%0a++++++++++++++q%3D"movie_id:[*+TO+*]",%0a++++++++++++++buckets%3D"movie_id",%0a++++++++++++++bucketSizeLimit%3D1254,%0a++++++++++++++bucketSorts%3D"movie_id+asc",+count(*),%0a++++++++++++++min(rating_timestamp),%0a++++++++++++++max(rating_timestamp)%0a)&_=1533923249300} status=0 QTime=0
2018-08-10T17:48:58,313 - INFO [qtp726950788-17:solr.core.SolrCore@2544] - \{collection=c:ratings, core=x:ratings_shard1_replica_n1, node_name=n:192.168.1.6:8983_solr, replica=r:core_node2, shard=s:shard1} - [ratings_shard1_replica_n1] webapp=/solr path=/select params=\{q=movie_id:[*+TO+*]&json.facet={"movie_id":{"type":"terms","field":"movie_id","limit":1254,"sort":{"index":"asc"},"facet":\{"facet_0":"min(rating_timestamp)","facet_1":"max(rating_timestamp)"}}}&_stateVer_=ratings:4&bucketSizeLimit=1254&rows=0&wt=javabin&version=2} hits=100000 status=0 QTime=17
2018-08-10T17:48:58,316 - ERROR [qtp726950788-385:solr.common.SolrException@148] - \{collection=c:ratings, core=x:ratings_shard1_replica_n1, node_name=n:192.168.1.6:8983_solr, replica=r:core_node2, shard=s:shard1} - java.io.IOException: java.lang.ClassCastException: java.util.Date cannot be cast to java.lang.Number
 at org.apache.solr.client.solrj.io.stream.FacetStream.open(FacetStream.java:346)
 at org.apache.solr.client.solrj.io.stream.ExceptionStream.open(ExceptionStream.java:54)
 at org.apache.solr.handler.StreamHandler$TimerStream.open(StreamHandler.java:397)
 at org.apache.solr.client.solrj.io.stream.TupleStream.writeMap(TupleStream.java:83)
 at org.apache.solr.response.JSONWriter.writeMap(JSONResponseWriter.java:539)
 at org.apache.solr.response.TextResponseWriter.writeVal(TextResponseWriter.java:181)
 at org.apache.solr.response.JSONWriter.writeNamedListAsMapWithDups(JSONResponseWriter.java:209)
 at org.apache.solr.response.JSONWriter.writeNamedList(JSONResponseWriter.java:325)
 at org.apache.solr.response.JSONWriter.writeResponse(JSONResponseWriter.java:120)
 at org.apache.solr.response.JSONResponseWriter.write(JSONResponseWriter.java:71)
 at org.apache.solr.response.QueryResponseWriterUtil.writeQueryResponse(QueryResponseWriterUtil.java:65)
 at org.apache.solr.servlet.HttpSolrCall.writeResponse(HttpSolrCall.java:787)
 at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:524)
 at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:377)
 at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:323)
 at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)
 at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)
 at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
 at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
 at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
 at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1160)
 at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
 at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
 at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1092)
 at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
 at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
 at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
 at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
 at org.eclipse.jetty.server.Server.handle(Server.java:518)
 at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)
 at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:244)
 at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
 at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
 at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
 at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:246)
 at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:156)
 at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
 at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
 at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassCastException: java.util.Date cannot be cast to java.lang.Number
 at org.apache.solr.client.solrj.io.stream.FacetStream.fillTuples(FacetStream.java:502)
 at org.apache.solr.client.solrj.io.stream.FacetStream.getTuples(FacetStream.java:459)
 at org.apache.solr.client.solrj.io.stream.FacetStream.open(FacetStream.java:342)
 ... 38 more

{code}

 

However, the JSON facet API definitely supports this: 

{code}

curl http://localhost:8983/solr/ratings/query -d 'rows=0&q=movie_id:[* TO *]&json.facet={

  movie_id:{

    type:terms,

    field:"movie_id",

    limit:100,

    sort:\{count:desc},

    facet: {

      min_ts: "min(rating_timestamp)"

      max_ts: "max(rating_timestamp)"

    }

  }

}'

{code}

Gives the expected results:

{code}

"facets":{

    "count":100000,

    "movie_id":{

      "buckets":[{

          "val":"50",

          "count":583,

          "min_ts":"1997-09-20T04:29:10Z",

          "max_ts":"1998-04-22T16:53:14Z"},

        {

          "val":"258",

          "count":509,

          "min_ts":"1997-09-20T20:12:17Z",

          "max_ts":"1998-04-22T22:09:38Z"},

        ...

{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]