Amrit Sarkar created SOLR-12010:
-----------------------------------

             Summary: Better error handling for Parallel SQL queries
                 Key: SOLR-12010
                 URL: https://issues.apache.org/jira/browse/SOLR-12010
             Project: Solr
          Issue Type: Improvement
      Security Level: Public (Default Security Level. Issues are Public)
          Components: Parallel SQL
    Affects Versions: master (8.0)
            Reporter: Amrit Sarkar


While building examples in Parallel SQL queries, we encountered strange error 
messages which didn't make sense unless you look deeply into the code, in my 
case, using debugger on source code to understand better.

e.g. 
{code}
curl --data-urlencode 'stmt=select emp_no_s,emp_no_s from salaries 
    group by emp_no_s
    limit 10' 
http://localhost:8983/solr/employees/sql?aggregationMode=map_reduce
{code}

aggregate-field 'emp_no_s' is asked to group-by twice and hence this is runtime 
SQL error, while error message received in solr logs:

{code}
Caused by: java.sql.SQLException: Error while executing SQL "select 
emp_no_s,emp_no_s from salaries 
    group by emp_no_s
    limit 10": 1
        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:269)
        ... 41 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
        at 
org.apache.solr.handler.sql.SolrTable.buildBuckets(SolrTable.java:559)
        at 
org.apache.solr.handler.sql.SolrTable.handleGroupByMapReduce(SolrTable.java:445)
        at org.apache.solr.handler.sql.SolrTable.query(SolrTable.java:135)
        at org.apache.solr.handler.sql.SolrTable.access$100(SolrTable.java:64)
        at 
org.apache.solr.handler.sql.SolrTable$SolrQueryable.query(SolrTable.java:859)
        at Baz.bind(Unknown Source)
        at 
org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:335)
        at 
org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:294)
        at 
org.apache.calcite.jdbc.CalciteMetaImpl._createIterable(CalciteMetaImpl.java:559)
        at 
org.apache.calcite.jdbc.CalciteMetaImpl.createIterable(CalciteMetaImpl.java:550)
        at 
org.apache.calcite.avatica.AvaticaResultSet.execute(AvaticaResultSet.java:204)
        at 
org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:67)
        at 
org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:44)
        at 
org.apache.calcite.avatica.AvaticaConnection$1.execute(AvaticaConnection.java:630)
        at 
org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:607)
        at 
org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:638)
        at 
org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:149)
        ... 43 more
{code}



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

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

Reply via email to