Druid SQL API

Druid SQL - 图1info

Apache Druid supports two query languages: Druid SQL and native queries. This document describes the SQL language.

In this topic, http://ROUTER_IP:ROUTER_PORT is a placeholder for your Router service address and port. Replace it with the information for your deployment. For example, use http://localhost:8888 for quickstart deployments.

Query from Historicals

Submit a query

Submits a SQL-based query in the JSON request body. Returns a JSON object with the query results and optional metadata for the results. You can also use this endpoint to query metadata tables.

Each query has an associated SQL query ID. You can set this ID manually using the SQL context parameter sqlQueryId. If not set, Druid automatically generates sqlQueryId and returns it in the response header for X-Druid-SQL-Query-Id. Note that you need the sqlQueryId to cancel a query endpoint.

URL

POST /druid/v2/sql

Request body

The request body takes the following properties:

  • query: SQL query string.

  • resultFormat: String that indicates the format to return query results. Select one of the following formats:

    • object: Returns a JSON array of JSON objects with the HTTP header Content-Type: application/json.
    • array: Returns a JSON array of JSON arrays with the HTTP header Content-Type: application/json.
    • objectLines: Returns newline-delimited JSON objects with a trailing blank line. Returns the HTTP header Content-Type: text/plain.
    • arrayLines: Returns newline-delimited JSON arrays with a trailing blank line. Returns the HTTP header Content-Type: text/plain.
    • csv: Returns a comma-separated values with one row per line and a trailing blank line. Returns the HTTP header Content-Type: text/csv.
  • header: Boolean value that determines whether to return information on column names. When set to true, Druid returns the column names as the first row of the results. To also get information on the column types, set typesHeader or sqlTypesHeader to true. For a comparative overview of data formats and configurations for the header, see the Query output format table.

  • typesHeader: Adds Druid runtime type information in the header. Requires header to be set to true. Complex types, like sketches, will be reported as COMPLEX<typeName> if a particular complex type name is known for that field, or as COMPLEX if the particular type name is unknown or mixed.

  • sqlTypesHeader: Adds SQL type information in the header. Requires header to be set to true.

  • context: JSON object containing optional SQL query context parameters, such as to set the query ID, time zone, and whether to use an approximation algorithm for distinct count.

  • parameters: List of query parameters for parameterized queries. Each parameter in the array should be a JSON object containing the parameter’s SQL data type and parameter value. For a list of supported SQL types, see Data types.

    For example:

    1. "parameters": [
    2. {
    3. "type": "VARCHAR",
    4. "value": "bar"
    5. }
    6. ]

Responses

  • 200 SUCCESS
  • 400 BAD REQUEST
  • 500 INTERNAL SERVER ERROR

Successfully submitted query

Error thrown due to bad query. Returns a JSON object detailing the error with the following format:

  1. {
  2. "error": "A well-defined error code.",
  3. "errorMessage": "A message with additional details about the error.",
  4. "errorClass": "Class of exception that caused this error.",
  5. "host": "The host on which the error occurred."
  6. }

Request not sent due to unexpected conditions. Returns a JSON object detailing the error with the following format:

  1. {
  2. "error": "A well-defined error code.",
  3. "errorMessage": "A message with additional details about the error.",
  4. "errorClass": "Class of exception that caused this error.",
  5. "host": "The host on which the error occurred."
  6. }

Older versions of Druid that support the typesHeader and sqlTypesHeader parameters return the HTTP header X-Druid-SQL-Header-Included: yes when you set header to true. Druid returns the HTTP response header for compatibility, regardless of whether typesHeader and sqlTypesHeader are set.


Sample request

The following example retrieves all rows in the wikipedia datasource where the user is BlueMoon2662. The query is assigned the ID request01 using the sqlQueryId context parameter. The optional properties header, typesHeader, and sqlTypesHeader are set to true to include type information to the response.

  • cURL
  • HTTP
  1. curl "http://ROUTER_IP:ROUTER_PORT/druid/v2/sql" \
  2. --header 'Content-Type: application/json' \
  3. --data '{
  4. "query": "SELECT * FROM wikipedia WHERE user='\''BlueMoon2662'\''",
  5. "context" : {"sqlQueryId" : "request01"},
  6. "header" : true,
  7. "typesHeader" : true,
  8. "sqlTypesHeader" : true
  9. }'
  1. POST /druid/v2/sql HTTP/1.1
  2. Host: http://ROUTER_IP:ROUTER_PORT
  3. Content-Type: application/json
  4. Content-Length: 192
  5. {
  6. "query": "SELECT * FROM wikipedia WHERE user='BlueMoon2662'",
  7. "context" : {"sqlQueryId" : "request01"},
  8. "header" : true,
  9. "typesHeader" : true,
  10. "sqlTypesHeader" : true
  11. }

Sample response

Click to show sample response

  1. [
  2. {
  3. "__time": {
  4. "type": "LONG",
  5. "sqlType": "TIMESTAMP"
  6. },
  7. "channel": {
  8. "type": "STRING",
  9. "sqlType": "VARCHAR"
  10. },
  11. "cityName": {
  12. "type": "STRING",
  13. "sqlType": "VARCHAR"
  14. },
  15. "comment": {
  16. "type": "STRING",
  17. "sqlType": "VARCHAR"
  18. },
  19. "countryIsoCode": {
  20. "type": "STRING",
  21. "sqlType": "VARCHAR"
  22. },
  23. "countryName": {
  24. "type": "STRING",
  25. "sqlType": "VARCHAR"
  26. },
  27. "isAnonymous": {
  28. "type": "LONG",
  29. "sqlType": "BIGINT"
  30. },
  31. "isMinor": {
  32. "type": "LONG",
  33. "sqlType": "BIGINT"
  34. },
  35. "isNew": {
  36. "type": "LONG",
  37. "sqlType": "BIGINT"
  38. },
  39. "isRobot": {
  40. "type": "LONG",
  41. "sqlType": "BIGINT"
  42. },
  43. "isUnpatrolled": {
  44. "type": "LONG",
  45. "sqlType": "BIGINT"
  46. },
  47. "metroCode": {
  48. "type": "LONG",
  49. "sqlType": "BIGINT"
  50. },
  51. "namespace": {
  52. "type": "STRING",
  53. "sqlType": "VARCHAR"
  54. },
  55. "page": {
  56. "type": "STRING",
  57. "sqlType": "VARCHAR"
  58. },
  59. "regionIsoCode": {
  60. "type": "STRING",
  61. "sqlType": "VARCHAR"
  62. },
  63. "regionName": {
  64. "type": "STRING",
  65. "sqlType": "VARCHAR"
  66. },
  67. "user": {
  68. "type": "STRING",
  69. "sqlType": "VARCHAR"
  70. },
  71. "delta": {
  72. "type": "LONG",
  73. "sqlType": "BIGINT"
  74. },
  75. "added": {
  76. "type": "LONG",
  77. "sqlType": "BIGINT"
  78. },
  79. "deleted": {
  80. "type": "LONG",
  81. "sqlType": "BIGINT"
  82. }
  83. },
  84. {
  85. "__time": "2015-09-12T00:47:53.259Z",
  86. "channel": "#ja.wikipedia",
  87. "cityName": "",
  88. "comment": "/* 対戦通算成績と得失点 */",
  89. "countryIsoCode": "",
  90. "countryName": "",
  91. "isAnonymous": 0,
  92. "isMinor": 1,
  93. "isNew": 0,
  94. "isRobot": 0,
  95. "isUnpatrolled": 0,
  96. "metroCode": 0,
  97. "namespace": "Main",
  98. "page": "アルビレックス新潟の年度別成績一覧",
  99. "regionIsoCode": "",
  100. "regionName": "",
  101. "user": "BlueMoon2662",
  102. "delta": 14,
  103. "added": 14,
  104. "deleted": 0
  105. }
  106. ]

Cancel a query

Cancels a query on the Router or the Broker with the associated sqlQueryId. The sqlQueryId can be manually set when the query is submitted in the query context parameter, or if not set, Druid will generate one and return it in the response header when the query is successfully submitted. Note that Druid does not enforce a unique sqlQueryId in the query context. If you’ve set the same sqlQueryId for multiple queries, Druid cancels all requests with that query ID.

When you cancel a query, Druid handles the cancellation in a best-effort manner. Druid immediately marks the query as canceled and aborts the query execution as soon as possible. However, the query may continue running for a short time after you make the cancellation request.

Cancellation requests require READ permission on all resources used in the SQL query.

URL

DELETE /druid/v2/sql/:sqlQueryId

Responses

  • 202 SUCCESS
  • 403 FORBIDDEN
  • 404 NOT FOUND

Successfully deleted query

Authorization failure

Invalid sqlQueryId or query was completed before cancellation request


Sample request

The following example cancels a request with the set query ID request01.

  • cURL
  • HTTP
  1. curl --request DELETE "http://ROUTER_IP:ROUTER_PORT/druid/v2/sql/request01"
  1. DELETE /druid/v2/sql/request01 HTTP/1.1
  2. Host: http://ROUTER_IP:ROUTER_PORT

Sample response

A successful response results in an HTTP 202 message code and an empty response body.

Query output format

The following table shows examples of how Druid returns the column names and data types based on the result format and the type request. The examples includes the first row of results, where the value of user is BlueMoon2662.

  1. | Format | typesHeader | sqlTypesHeader | Example Output |
  2. |--------|-------------|----------------|--------------------------------------------------------------------------------------------|
  3. | object | true | false | [ { "user" : { "type" : "STRING" } }, { "user" : "BlueMoon2662" } ] |
  4. | object | true | true | [ { "user" : { "type" : "STRING", "sqlType" : "VARCHAR" } }, { "user" : "BlueMoon2662" } ] |
  5. | object | false | true | [ { "user" : { "sqlType" : "VARCHAR" } }, { "user" : "BlueMoon2662" } ] |
  6. | object | false | false | [ { "user" : null }, { "user" : "BlueMoon2662" } ] |
  7. | array | true | false | [ [ "user" ], [ "STRING" ], [ "BlueMoon2662" ] ] |
  8. | array | true | true | [ [ "user" ], [ "STRING" ], [ "VARCHAR" ], [ "BlueMoon2662" ] ] |
  9. | array | false | true | [ [ "user" ], [ "VARCHAR" ], [ "BlueMoon2662" ] ] |
  10. | array | false | false | [ [ "user" ], [ "BlueMoon2662" ] ] |
  11. | csv | true | false | user STRING BlueMoon2662 |
  12. | csv | true | true | user STRING VARCHAR BlueMoon2662 |
  13. | csv | false | true | user VARCHAR BlueMoon2662 |
  14. | csv | false | false | user BlueMoon2662 |

Query from deep storage

You can use the sql/statements endpoint to query segments that exist only in deep storage and are not loaded onto your Historical processes as determined by your load rules.

Note that at least one segment of a datasource must be available on a Historical process so that the Broker can plan your query. A quick way to check if this is true is whether or not a datasource is visible in the Druid console.

For more information, see Query from deep storage.

Submit a query

Submit a query for data stored in deep storage. Any data ingested into Druid is placed into deep storage. The query is contained in the “query” field in the JSON object within the request payload.

Note that at least part of a datasource must be available on a Historical process so that Druid can plan your query and only the user who submits a query can see the results.

URL

POST /druid/v2/sql/statements

Request body

Generally, the sql and sql/statements endpoints support the same response body fields with minor differences. For general information about the available fields, see Submit a query to the sql endpoint.

Keep the following in mind when submitting queries to the sql/statements endpoint:

  • Apart from the context parameters mentioned here there are additional context parameters for sql/statements specifically:

    • executionMode determines how query results are fetched. Druid currently only supports ASYNC. You must manually retrieve your results after the query completes.
    • selectDestination determines where final results get written. By default, results are written to task reports. Set this parameter to durableStorage to instruct Druid to write the results from SELECT queries to durable storage, which allows you to fetch larger result sets. For result sets with more than 3000 rows, it is highly recommended to use durableStorage. Note that this requires you to have durable storage for MSQ enabled.

Responses

  • 200 SUCCESS
  • 400 BAD REQUEST

Successfully queried from deep storage

Error thrown due to bad query. Returns a JSON object detailing the error with the following format:

  1. {
  2. "error": "Summary of the encountered error.",
  3. "errorClass": "Class of exception that caused this error.",
  4. "host": "The host on which the error occurred.",
  5. "errorCode": "Well-defined error code.",
  6. "persona": "Role or persona associated with the error.",
  7. "category": "Classification of the error.",
  8. "errorMessage": "Summary of the encountered issue with expanded information.",
  9. "context": "Additional context about the error."
  10. }

Sample request

  • cURL
  • HTTP
  1. curl "http://ROUTER_IP:ROUTER_PORT/druid/v2/sql/statements" \
  2. --header 'Content-Type: application/json' \
  3. --data '{
  4. "query": "SELECT * FROM wikipedia WHERE user='\''BlueMoon2662'\''",
  5. "context": {
  6. "executionMode":"ASYNC"
  7. }
  8. }'
  1. POST /druid/v2/sql/statements HTTP/1.1
  2. Host: http://ROUTER_IP:ROUTER_PORT
  3. Content-Type: application/json
  4. Content-Length: 134
  5. {
  6. "query": "SELECT * FROM wikipedia WHERE user='BlueMoon2662'",
  7. "context": {
  8. "executionMode":"ASYNC"
  9. }
  10. }

Sample response

Click to show sample response

  1. {
  2. "queryId": "query-b82a7049-b94f-41f2-a230-7fef94768745",
  3. "state": "ACCEPTED",
  4. "createdAt": "2023-07-26T21:16:25.324Z",
  5. "schema": [
  6. {
  7. "name": "__time",
  8. "type": "TIMESTAMP",
  9. "nativeType": "LONG"
  10. },
  11. {
  12. "name": "channel",
  13. "type": "VARCHAR",
  14. "nativeType": "STRING"
  15. },
  16. {
  17. "name": "cityName",
  18. "type": "VARCHAR",
  19. "nativeType": "STRING"
  20. },
  21. {
  22. "name": "comment",
  23. "type": "VARCHAR",
  24. "nativeType": "STRING"
  25. },
  26. {
  27. "name": "countryIsoCode",
  28. "type": "VARCHAR",
  29. "nativeType": "STRING"
  30. },
  31. {
  32. "name": "countryName",
  33. "type": "VARCHAR",
  34. "nativeType": "STRING"
  35. },
  36. {
  37. "name": "isAnonymous",
  38. "type": "BIGINT",
  39. "nativeType": "LONG"
  40. },
  41. {
  42. "name": "isMinor",
  43. "type": "BIGINT",
  44. "nativeType": "LONG"
  45. },
  46. {
  47. "name": "isNew",
  48. "type": "BIGINT",
  49. "nativeType": "LONG"
  50. },
  51. {
  52. "name": "isRobot",
  53. "type": "BIGINT",
  54. "nativeType": "LONG"
  55. },
  56. {
  57. "name": "isUnpatrolled",
  58. "type": "BIGINT",
  59. "nativeType": "LONG"
  60. },
  61. {
  62. "name": "metroCode",
  63. "type": "BIGINT",
  64. "nativeType": "LONG"
  65. },
  66. {
  67. "name": "namespace",
  68. "type": "VARCHAR",
  69. "nativeType": "STRING"
  70. },
  71. {
  72. "name": "page",
  73. "type": "VARCHAR",
  74. "nativeType": "STRING"
  75. },
  76. {
  77. "name": "regionIsoCode",
  78. "type": "VARCHAR",
  79. "nativeType": "STRING"
  80. },
  81. {
  82. "name": "regionName",
  83. "type": "VARCHAR",
  84. "nativeType": "STRING"
  85. },
  86. {
  87. "name": "user",
  88. "type": "VARCHAR",
  89. "nativeType": "STRING"
  90. },
  91. {
  92. "name": "delta",
  93. "type": "BIGINT",
  94. "nativeType": "LONG"
  95. },
  96. {
  97. "name": "added",
  98. "type": "BIGINT",
  99. "nativeType": "LONG"
  100. },
  101. {
  102. "name": "deleted",
  103. "type": "BIGINT",
  104. "nativeType": "LONG"
  105. }
  106. ],
  107. "durationMs": -1
  108. }

Get query status

Retrieves information about the query associated with the given query ID. The response matches the response from the POST API if the query is accepted or running and the execution mode is ASYNC. In addition to the fields that this endpoint shares with POST /sql/statements, a completed query’s status includes the following:

  • A result object that summarizes information about your results, such as the total number of rows and sample records.
  • A pages object that includes the following information for each page of results:
    • numRows: the number of rows in that page of results.
    • sizeInBytes: the size of the page.
    • id: the page number that you can use to reference a specific page when you get query results.

URL

GET /druid/v2/sql/statements/:queryId

Responses

  • 200 SUCCESS
  • 400 BAD REQUEST

Successfully retrieved query status

Error thrown due to bad query. Returns a JSON object detailing the error with the following format:

  1. {
  2. "error": "Summary of the encountered error.",
  3. "errorCode": "Well-defined error code.",
  4. "persona": "Role or persona associated with the error.",
  5. "category": "Classification of the error.",
  6. "errorMessage": "Summary of the encountered issue with expanded information.",
  7. "context": "Additional context about the error."
  8. }

Sample request

The following example retrieves the status of a query with specified ID query-9b93f6f7-ab0e-48f5-986a-3520f84f0804.

  • cURL
  • HTTP
  1. curl "http://ROUTER_IP:ROUTER_PORT/druid/v2/sql/statements/query-9b93f6f7-ab0e-48f5-986a-3520f84f0804"
  1. GET /druid/v2/sql/statements/query-9b93f6f7-ab0e-48f5-986a-3520f84f0804 HTTP/1.1
  2. Host: http://ROUTER_IP:ROUTER_PORT

Sample response

Click to show sample response

  1. {
  2. "queryId": "query-9b93f6f7-ab0e-48f5-986a-3520f84f0804",
  3. "state": "SUCCESS",
  4. "createdAt": "2023-07-26T22:57:46.620Z",
  5. "schema": [
  6. {
  7. "name": "__time",
  8. "type": "TIMESTAMP",
  9. "nativeType": "LONG"
  10. },
  11. {
  12. "name": "channel",
  13. "type": "VARCHAR",
  14. "nativeType": "STRING"
  15. },
  16. {
  17. "name": "cityName",
  18. "type": "VARCHAR",
  19. "nativeType": "STRING"
  20. },
  21. {
  22. "name": "comment",
  23. "type": "VARCHAR",
  24. "nativeType": "STRING"
  25. },
  26. {
  27. "name": "countryIsoCode",
  28. "type": "VARCHAR",
  29. "nativeType": "STRING"
  30. },
  31. {
  32. "name": "countryName",
  33. "type": "VARCHAR",
  34. "nativeType": "STRING"
  35. },
  36. {
  37. "name": "isAnonymous",
  38. "type": "BIGINT",
  39. "nativeType": "LONG"
  40. },
  41. {
  42. "name": "isMinor",
  43. "type": "BIGINT",
  44. "nativeType": "LONG"
  45. },
  46. {
  47. "name": "isNew",
  48. "type": "BIGINT",
  49. "nativeType": "LONG"
  50. },
  51. {
  52. "name": "isRobot",
  53. "type": "BIGINT",
  54. "nativeType": "LONG"
  55. },
  56. {
  57. "name": "isUnpatrolled",
  58. "type": "BIGINT",
  59. "nativeType": "LONG"
  60. },
  61. {
  62. "name": "metroCode",
  63. "type": "BIGINT",
  64. "nativeType": "LONG"
  65. },
  66. {
  67. "name": "namespace",
  68. "type": "VARCHAR",
  69. "nativeType": "STRING"
  70. },
  71. {
  72. "name": "page",
  73. "type": "VARCHAR",
  74. "nativeType": "STRING"
  75. },
  76. {
  77. "name": "regionIsoCode",
  78. "type": "VARCHAR",
  79. "nativeType": "STRING"
  80. },
  81. {
  82. "name": "regionName",
  83. "type": "VARCHAR",
  84. "nativeType": "STRING"
  85. },
  86. {
  87. "name": "user",
  88. "type": "VARCHAR",
  89. "nativeType": "STRING"
  90. },
  91. {
  92. "name": "delta",
  93. "type": "BIGINT",
  94. "nativeType": "LONG"
  95. },
  96. {
  97. "name": "added",
  98. "type": "BIGINT",
  99. "nativeType": "LONG"
  100. },
  101. {
  102. "name": "deleted",
  103. "type": "BIGINT",
  104. "nativeType": "LONG"
  105. }
  106. ],
  107. "durationMs": 25591,
  108. "result": {
  109. "numTotalRows": 1,
  110. "totalSizeInBytes": 375,
  111. "dataSource": "__query_select",
  112. "sampleRecords": [
  113. [
  114. 1442018873259,
  115. "#ja.wikipedia",
  116. "",
  117. "/* 対戦通算成績と得失点 */",
  118. "",
  119. "",
  120. 0,
  121. 1,
  122. 0,
  123. 0,
  124. 0,
  125. 0,
  126. "Main",
  127. "アルビレックス新潟の年度別成績一覧",
  128. "",
  129. "",
  130. "BlueMoon2662",
  131. 14,
  132. 14,
  133. 0
  134. ]
  135. ],
  136. "pages": [
  137. {
  138. "id": 0,
  139. "numRows": 1,
  140. "sizeInBytes": 375
  141. }
  142. ]
  143. }
  144. }

Get query results

Retrieves results for completed queries. Results are separated into pages, so you can use the optional page parameter to refine the results you get. Druid returns information about the composition of each page and its page number (id). For information about pages, see Get query status.

If a page number isn’t passed, all results are returned sequentially in the same response. If you have large result sets, you may encounter timeouts based on the value configured for druid.router.http.readTimeout.

Getting the query results for an ingestion query returns an empty response.

URL

GET /druid/v2/sql/statements/:queryId/results

Query parameters

  • page (optional)
    • Type: Int
    • Fetch results based on page numbers. If not specified, all results are returned sequentially starting from page 0 to N in the same response.
  • resultFormat (optional)
    • Type: String
    • Defines the format in which the results are presented. The following options are supported arrayLines,objectLines,array,object, and csv. The default is object.

Responses

  • 200 SUCCESS
  • 400 BAD REQUEST
  • 404 NOT FOUND
  • 500 SERVER ERROR

Successfully retrieved query results

Query in progress. Returns a JSON object detailing the error with the following format:

  1. {
  2. "error": "Summary of the encountered error.",
  3. "errorCode": "Well-defined error code.",
  4. "persona": "Role or persona associated with the error.",
  5. "category": "Classification of the error.",
  6. "errorMessage": "Summary of the encountered issue with expanded information.",
  7. "context": "Additional context about the error."
  8. }

Query not found, failed or canceled

Error thrown due to bad query. Returns a JSON object detailing the error with the following format:

  1. {
  2. "error": "Summary of the encountered error.",
  3. "errorCode": "Well-defined error code.",
  4. "persona": "Role or persona associated with the error.",
  5. "category": "Classification of the error.",
  6. "errorMessage": "Summary of the encountered issue with expanded information.",
  7. "context": "Additional context about the error."
  8. }

Sample request

The following example retrieves the status of a query with specified ID query-f3bca219-173d-44d4-bdc7-5002e910352f.

  • cURL
  • HTTP
  1. curl "http://ROUTER_IP:ROUTER_PORT/druid/v2/sql/statements/query-f3bca219-173d-44d4-bdc7-5002e910352f/results"
  1. GET /druid/v2/sql/statements/query-f3bca219-173d-44d4-bdc7-5002e910352f/results HTTP/1.1
  2. Host: http://ROUTER_IP:ROUTER_PORT

Sample response

Click to show sample response

  1. [
  2. {
  3. "__time": 1442018818771,
  4. "channel": "#en.wikipedia",
  5. "cityName": "",
  6. "comment": "added project",
  7. "countryIsoCode": "",
  8. "countryName": "",
  9. "isAnonymous": 0,
  10. "isMinor": 0,
  11. "isNew": 0,
  12. "isRobot": 0,
  13. "isUnpatrolled": 0,
  14. "metroCode": 0,
  15. "namespace": "Talk",
  16. "page": "Talk:Oswald Tilghman",
  17. "regionIsoCode": "",
  18. "regionName": "",
  19. "user": "GELongstreet",
  20. "delta": 36,
  21. "added": 36,
  22. "deleted": 0
  23. },
  24. {
  25. "__time": 1442018820496,
  26. "channel": "#ca.wikipedia",
  27. "cityName": "",
  28. "comment": "Robot inserta {{Commonscat}} que enllaça amb [[commons:category:Rallicula]]",
  29. "countryIsoCode": "",
  30. "countryName": "",
  31. "isAnonymous": 0,
  32. "isMinor": 1,
  33. "isNew": 0,
  34. "isRobot": 1,
  35. "isUnpatrolled": 0,
  36. "metroCode": 0,
  37. "namespace": "Main",
  38. "page": "Rallicula",
  39. "regionIsoCode": "",
  40. "regionName": "",
  41. "user": "PereBot",
  42. "delta": 17,
  43. "added": 17,
  44. "deleted": 0
  45. },
  46. {
  47. "__time": 1442018825474,
  48. "channel": "#en.wikipedia",
  49. "cityName": "Auburn",
  50. "comment": "/* Status of peremptory norms under international law */ fixed spelling of 'Wimbledon'",
  51. "countryIsoCode": "AU",
  52. "countryName": "Australia",
  53. "isAnonymous": 1,
  54. "isMinor": 0,
  55. "isNew": 0,
  56. "isRobot": 0,
  57. "isUnpatrolled": 0,
  58. "metroCode": 0,
  59. "namespace": "Main",
  60. "page": "Peremptory norm",
  61. "regionIsoCode": "NSW",
  62. "regionName": "New South Wales",
  63. "user": "60.225.66.142",
  64. "delta": 0,
  65. "added": 0,
  66. "deleted": 0
  67. },
  68. {
  69. "__time": 1442018828770,
  70. "channel": "#vi.wikipedia",
  71. "cityName": "",
  72. "comment": "fix Lỗi CS1: ngày tháng",
  73. "countryIsoCode": "",
  74. "countryName": "",
  75. "isAnonymous": 0,
  76. "isMinor": 1,
  77. "isNew": 0,
  78. "isRobot": 1,
  79. "isUnpatrolled": 0,
  80. "metroCode": 0,
  81. "namespace": "Main",
  82. "page": "Apamea abruzzorum",
  83. "regionIsoCode": "",
  84. "regionName": "",
  85. "user": "Cheers!-bot",
  86. "delta": 18,
  87. "added": 18,
  88. "deleted": 0
  89. },
  90. {
  91. "__time": 1442018831862,
  92. "channel": "#vi.wikipedia",
  93. "cityName": "",
  94. "comment": "clean up using [[Project:AWB|AWB]]",
  95. "countryIsoCode": "",
  96. "countryName": "",
  97. "isAnonymous": 0,
  98. "isMinor": 0,
  99. "isNew": 0,
  100. "isRobot": 1,
  101. "isUnpatrolled": 0,
  102. "metroCode": 0,
  103. "namespace": "Main",
  104. "page": "Atractus flammigerus",
  105. "regionIsoCode": "",
  106. "regionName": "",
  107. "user": "ThitxongkhoiAWB",
  108. "delta": 18,
  109. "added": 18,
  110. "deleted": 0
  111. },
  112. {
  113. "__time": 1442018833987,
  114. "channel": "#vi.wikipedia",
  115. "cityName": "",
  116. "comment": "clean up using [[Project:AWB|AWB]]",
  117. "countryIsoCode": "",
  118. "countryName": "",
  119. "isAnonymous": 0,
  120. "isMinor": 0,
  121. "isNew": 0,
  122. "isRobot": 1,
  123. "isUnpatrolled": 0,
  124. "metroCode": 0,
  125. "namespace": "Main",
  126. "page": "Agama mossambica",
  127. "regionIsoCode": "",
  128. "regionName": "",
  129. "user": "ThitxongkhoiAWB",
  130. "delta": 18,
  131. "added": 18,
  132. "deleted": 0
  133. },
  134. {
  135. "__time": 1442018837009,
  136. "channel": "#ca.wikipedia",
  137. "cityName": "",
  138. "comment": "/* Imperi Austrohongarès */",
  139. "countryIsoCode": "",
  140. "countryName": "",
  141. "isAnonymous": 0,
  142. "isMinor": 0,
  143. "isNew": 0,
  144. "isRobot": 0,
  145. "isUnpatrolled": 0,
  146. "metroCode": 0,
  147. "namespace": "Main",
  148. "page": "Campanya dels Balcans (1914-1918)",
  149. "regionIsoCode": "",
  150. "regionName": "",
  151. "user": "Jaumellecha",
  152. "delta": -20,
  153. "added": 0,
  154. "deleted": 20
  155. },
  156. {
  157. "__time": 1442018839591,
  158. "channel": "#en.wikipedia",
  159. "cityName": "",
  160. "comment": "adding comment on notability and possible COI",
  161. "countryIsoCode": "",
  162. "countryName": "",
  163. "isAnonymous": 0,
  164. "isMinor": 0,
  165. "isNew": 1,
  166. "isRobot": 0,
  167. "isUnpatrolled": 1,
  168. "metroCode": 0,
  169. "namespace": "Talk",
  170. "page": "Talk:Dani Ploeger",
  171. "regionIsoCode": "",
  172. "regionName": "",
  173. "user": "New Media Theorist",
  174. "delta": 345,
  175. "added": 345,
  176. "deleted": 0
  177. },
  178. {
  179. "__time": 1442018841578,
  180. "channel": "#en.wikipedia",
  181. "cityName": "",
  182. "comment": "Copying assessment table to wiki",
  183. "countryIsoCode": "",
  184. "countryName": "",
  185. "isAnonymous": 0,
  186. "isMinor": 0,
  187. "isNew": 0,
  188. "isRobot": 1,
  189. "isUnpatrolled": 0,
  190. "metroCode": 0,
  191. "namespace": "User",
  192. "page": "User:WP 1.0 bot/Tables/Project/Pubs",
  193. "regionIsoCode": "",
  194. "regionName": "",
  195. "user": "WP 1.0 bot",
  196. "delta": 121,
  197. "added": 121,
  198. "deleted": 0
  199. },
  200. {
  201. "__time": 1442018845821,
  202. "channel": "#vi.wikipedia",
  203. "cityName": "",
  204. "comment": "clean up using [[Project:AWB|AWB]]",
  205. "countryIsoCode": "",
  206. "countryName": "",
  207. "isAnonymous": 0,
  208. "isMinor": 0,
  209. "isNew": 0,
  210. "isRobot": 1,
  211. "isUnpatrolled": 0,
  212. "metroCode": 0,
  213. "namespace": "Main",
  214. "page": "Agama persimilis",
  215. "regionIsoCode": "",
  216. "regionName": "",
  217. "user": "ThitxongkhoiAWB",
  218. "delta": 18,
  219. "added": 18,
  220. "deleted": 0
  221. }
  222. ]

Cancel a query

Cancels a running or accepted query.

URL

DELETE /druid/v2/sql/statements/:queryId

Responses

  • 200 OK
  • 202 ACCEPTED
  • 404 SERVER ERROR

A no op operation since the query is not in a state to be cancelled

Successfully accepted query for cancellation

Invalid query ID. Returns a JSON object detailing the error with the following format:

  1. {
  2. "error": "Summary of the encountered error.",
  3. "errorCode": "Well-defined error code.",
  4. "persona": "Role or persona associated with the error.",
  5. "category": "Classification of the error.",
  6. "errorMessage": "Summary of the encountered issue with expanded information.",
  7. "context": "Additional context about the error."
  8. }

Sample request

The following example cancels a query with specified ID query-945c9633-2fa2-49ab-80ae-8221c38c024da.

  • cURL
  • HTTP
  1. curl --request DELETE "http://ROUTER_IP:ROUTER_PORT/druid/v2/sql/statements/query-945c9633-2fa2-49ab-80ae-8221c38c024da"
  1. DELETE /druid/v2/sql/statements/query-945c9633-2fa2-49ab-80ae-8221c38c024da HTTP/1.1
  2. Host: http://ROUTER_IP:ROUTER_PORT

Sample response

A successful request returns an HTTP 202 ACCEPTED message code and an empty response body.