paul-rogers opened a new issue, #13765:
URL: https://github.com/apache/druid/issues/13765

   
   ### Affected Version
   
   6.0.0-SNAPSHOT
   
   ### Description
   
   I am testing the new catalog functionality. To do this, I send a request 
that looks like this:
   
   ```json
   {
      "query":"\nREPLACE INTO \"myWiki3\" OVERWRITE ALL\nSELECT\n  
TIME_PARSE(\"timestamp\") AS \"__time\",\n  namespace,\n  page,\n  channel,\n  
\"user\",\n  countryName,\n  CASE WHEN isRobot = \\'true\\' THEN 1 ELSE 0 END 
AS isRobot,\n  \"added\",\n  \"delta\",\n  CASE WHEN isNew = \\'true\\' THEN 1 
ELSE 0 END AS isNew,\n  CAST(\"deltaBucket\" AS DOUBLE) AS deltaBucket,\n  
\"deleted\"\nFROM TABLE(ext.wikiSample(\n  uris => ?\n))\nPARTITIONED BY DAY\n",
      "parameters":[
         [
            "wikipedia.json.gz"
         ]
      ],
      "resultFormat":"object"
   }
   ```
   
   The key thing to notice is the SQL:
   
   ```sql
   FROM TABLE(ext.wikiSample(
     uris => ARRAY['wikipedia.json.gz']
   ))
   ```
   
   And the parameter value: a list of strings. The task here is to get this to 
work in the Broker, where we've added code. However, debugging suggests that 
the request does not get past the broker which reports an error:
   
   ```json
   {
      "error":"Unknown exception",
      "errorMessage":"Cannot deserialize instance of 
`org.apache.druid.sql.http.SqlParameter` out of START_ARRAY token\n at [Source: 
(org.eclipse.jetty.server.HttpInputOverHTTP); line: 1, column: 463] (through 
reference chain: 
org.apache.druid.sql.http.SqlQuery[\"parameters\"]->java.util.ArrayList[0])",
      
"errorClass":"com.fasterxml.jackson.databind.exc.MismatchedInputException",
      "host":"None"
   }
   ```
   
   Clearly, something has gone wrong. This is a "developer error" not a "user 
error". We need to track down the issue. But, notice that there is no stack 
trace in the returned error. And, the point of this ticket, _there is no log 
file entry_. That is, if I go the router log file, I see no entry for the above 
error. As a result, it is very difficult to track down what is going wrong 
other than to guess from the error message.
   
   The request is to log any time that the Router fails to forward a SQL query.
   
   The error is that the `parameters` field is a list of (name, type) pairs, 
but I provided just the value. So, a second request is to provide a better 
error message, such as "Incorrect parameter format. See SqlQuery docs" or "... 
Parameters must be name/value maps."
   
   A third point would be: why is the router deserializing the query request? 
Why isn't it a simple pass-through? And, if we must deserialize, why are we not 
using the same code that the Broker uses? The Broker is able to deserialize the 
above.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to