Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-11585

Solr SQL does not work with point numeric fields

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Resolved
    • Affects Version/s: 7.1
    • Fix Version/s: None
    • Component/s: Parallel SQL
    • Labels:
      None

      Description

      Solr SQL does not work with point field types. there is no support for 'pint', 'plong', 'pdouble', 'pfloat' in https://github.com/apache/lucene-solr/blob/releases/lucene-solr/7.1.0/solr/core/src/java/org/apache/solr/handler/sql/SolrSchema.java#L99

      Sample query:

      http://localhost:8983/solr/ratings1/sql?indent=off&wt=json&version=2.2&aggregationMode=facet&stmt=+SELECT+movie_id,+COUNT(*)+as+agg_count,+avg(rating)+as+avg_rating,+sum(rating)+as+sum_rating,+min(rating)+as+min_rating,+max(rating)+as+max_rating+FROM+ratings1+GROUP+BY+movie_id+ORDER+BY+movie_id+asc
      
      Error:
      Error while executing SQL " SELECT movie_id, COUNT(*) as agg_count, avg(rating) as avg_rating, sum(rating) as sum_rating, min(rating) as min_rating, max(rating) as max_rating FROM ratingsffd34e87_2c95_4c82_acff_d31c40983b73 GROUP BY movie_id ORDER BY movie_id asc ": From line 1, column 42 to line 1, column 52: Cannot apply 'AVG' to arguments of type 'AVG(<JAVATYPE(CLASS JAVA.LANG.STRING)>)'. Supported form(s): 'AVG(<NUMERIC>)'
      	at org.apache.solr.client.solrj.io.stream.JDBCStream.open(JDBCStream.java:270)
      	at org.apache.solr.client.solrj.io.stream.ExceptionStream.open(ExceptionStream.java:51)
      	at org.apache.solr.handler.StreamHandler$TimerStream.open(StreamHandler.java:605)
      	at org.apache.solr.client.solrj.io.stream.TupleStream.writeMap(TupleStream.java:83)
      	at org.apache.solr.response.JSONWriter.writeMap(JSONResponseWriter.java:547)
      	at org.apache.solr.response.TextResponseWriter.writeVal(TextResponseWriter.java:198)
      	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:806)
      	at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:535)
      	at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:382)
      	at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:326)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
      	at org.apache.solr.client.solrj.embedded.JettySolrRunner$DebugFilter.doFilter(JettySolrRunner.java:139)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:224)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      	at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:426)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
      	at org.eclipse.jetty.server.Server.handle(Server.java:534)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
      	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
      	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108)
      	at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
      	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
      	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
      	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: java.sql.SQLException: Error while executing SQL " SELECT movie_id, COUNT(*) as agg_count, avg(rating) as avg_rating, sum(rating) as sum_rating, min(rating) as min_rating, max(rating) as max_rating FROM ratingsffd34e87_2c95_4c82_acff_d31c40983b73 GROUP BY movie_id ORDER BY movie_id asc ": From line 1, column 42 to line 1, column 52: Cannot apply 'AVG' to arguments of type 'AVG(<JAVATYPE(CLASS JAVA.LANG.STRING)>)'. Supported form(s): 'AVG(<NUMERIC>)'
      	at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
      	at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
      	at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
      	at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:218)
      	at org.apache.solr.client.solrj.io.stream.JDBCStream.open(JDBCStream.java:268)
      	... 38 more
      Caused by: org.apache.calcite.runtime.CalciteContextException: From line 1, column 42 to line 1, column 52: Cannot apply 'AVG' to arguments of type 'AVG(<JAVATYPE(CLASS JAVA.LANG.STRING)>)'. Supported form(s): 'AVG(<NUMERIC>)'
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      

        Attachments

        1. SOLR-11585.patch
          18 kB
          Joel Bernstein
        2. SOLR-11585.patch
          0.8 kB
          Kiran

          Issue Links

            Activity

              People

              • Assignee:
                jbernste Joel Bernstein
                Reporter:
                kiranch Kiran
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: