You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/11/03 02:59:05 UTC

[GitHub] [incubator-druid] abhishekrb19 opened a new issue #8816: Proposal to add new resultFormat - to wrap the Druid SQL JSON result array in a JSON object.

abhishekrb19 opened a new issue #8816: Proposal to add new resultFormat - to wrap the Druid SQL JSON result array in a JSON object.
URL: https://github.com/apache/incubator-druid/issues/8816
 
 
   ### Description
   
   As of `0.16.0`, Druid SQL queries made using JSON over HTTP to the Druid broker would by default return a JSON array of JSON objects (with `"resultFormat": "object"`).
   
   This is an alternative `resultFormat` proposal which is similar to the default `object`, but returns a JSON object wrapping the JSON result array.
   
   ### Motivation
   Two primary reasons for this proposal:
   - This would keep the successful response consistent with the error response, also containing a JSON object as shown [here](https://druid.apache.org/docs/latest/querying/querying.html#query-errors).
   - In addition, some serialization formats like JSON<->protobuf today don't support (un)marshaling a top-level JSON array, so a JSON object would be preferred (instead of manually concatenating - more details can be found [here](https://github.com/golang/protobuf/issues/675#issuecomment-411182202).
   
   
   The new `resultFormat` will be a JSON object containing a key, for example "data", and then have the resulting JSON array as the value. This is similar to the [“error”](https://druid.apache.org/docs/latest/querying/querying.html#query-errors) response case, where we have "error", "errorMessage", etc., as the keys in the response object.
   
   Current behavior:
   ```json
   [
     {
       "page": "Wikipedia:Vandalismusmeldung",
       "Edits": 33
     },
     {
       "page": "User:Cyde/List of candidates for speedy deletion/Subpage",
       "Edits": 28
     },
     {
       "page": "Jeremy Corbyn",
       "Edits": 27
     }
   ]
   ```
   Proposal:
   ```json
   {
     "data": [
      {
       "page": "Wikipedia:Vandalismusmeldung",
       "Edits": 33
      },
      {
       "page": "User:Cyde/List of candidates for speedy deletion/Subpage",
       "Edits": 28
      },
      {
       "page": "Jeremy Corbyn",
       "Edits": 27
      }
    ]
   }
   ```
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org