Search code examples
apache-drill

Cannot construct instance of `org.apache.drill.exec.server.rest.QueryWrapper`


I'm running Apache Drill out-of-the box in embedded mode.

When I send a POST request to localhost:8047/query.json, it produces 400 with error:

Cannot construct instance of `org.apache.drill.exec.server.rest.QueryWrapper`, problem: null
 at [Source: (org.glassfish.jersey.message.internal.EntityInputStream); line: 4, column: 1]

Request:

{
    "QueryType": "SQL",
    "Query": "SELECT count(*) as `cnt` FROM  dfs.`/data/demo/Parquet/*.parquet`"
}

Content-Type: application/json

When running in distributed mode it happens as well. Running query through web interface seems ok ...

According to google I'm the only one with this error. Any ideas?


Solution

  • There was a dumb bug in the request. The fields in the request must be in camelCase, not QueryType but queryType. There were capital 'Q's in previous request due to wrong serializer settings.

    I did not notice this detail for a hour.

    This works:

    {
        "queryType": "SQL",
        "query": "SELECT count(*) as `cnt` FROM  dfs.`/data/demo/Parquet/*.parquet`"
    }
    

    It would be nice if the API returned a normal error like "queryType is missing" instead of enigmatic Cannot construct instance of org.apache.drill.exec.server.rest.QueryWrapper.

    Hope this will save somebody a hour of life.