Add task report fields in response of SQL statements endpoint#16808
Merged
LakshSingla merged 10 commits intoapache:masterfrom Aug 1, 2024
Merged
Conversation
06d8aa1 to
6a1fc4e
Compare
LakshSingla
reviewed
Jul 29, 2024
Contributor
LakshSingla
left a comment
There was a problem hiding this comment.
Is it better to have detail as the parameter name or detailed. detailed=true seems better than detail=true. Maybe I am overthinking, but perhaps someone with more knowledge of API designing would help out here.
adarshsanjeev
approved these changes
Jul 31, 2024
…ated condition" This reverts commit daa425e.
LakshSingla
approved these changes
Jul 31, 2024
| } | ||
|
|
||
| @Override | ||
| public String toString() |
Contributor
There was a problem hiding this comment.
We don't need this now right?
Contributor
Author
There was a problem hiding this comment.
It's needed for the new test added in the PR: testMSQSelectRunningQueryWithDetail as assertSqlStatementResult() method has the following assertion logic for counters:
if (actual.getCounters() == null || expected.getCounters() == null) {
Assert.assertEquals(expected.getCounters(), actual.getCounters());
} else {
Assert.assertEquals(expected.getCounters().toString(), actual.getCounters().toString());
}
Contributor
|
@Akshat-Jain Please add the release notes in the description and relevant documentation for this flag. |
Merged
9 tasks
cryptoe
reviewed
Aug 5, 2024
| ).orElse(null) : null, | ||
| null | ||
| null, | ||
| detail ? SqlStatementResourceHelper.getQueryStagesReport(msqTaskReportPayloadSupplier.get().orElse(null)) : null, |
Contributor
There was a problem hiding this comment.
Wont you call the overlord 3 times here ?
Contributor
Author
9 tasks
sreemanamala
pushed a commit
to sreemanamala/druid
that referenced
this pull request
Aug 6, 2024
…#16808) If the optional query parameter detail is supplied, then the response also includes the following: * A stages object that summarizes information about the different stages being used for query execution, such as stage number, phase, start time, duration, input and output information, processing methods, and partitioning. * A counters object that provides details on the rows, bytes, and files processed at various stages for each worker across different channels, along with sort progress. * A warnings object that provides details about any warnings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds an optional query param
detailto/v2/sql/statements/query-idendpoint.As per offline discussion with @vogievetsky, the PR adds 3 additional fields to the API response when
detail=trueis passed:stages: Stages for the query from MSQ task reportcounters: Stage counters for the query from MSQ task reportwarnings: Warning reports for the query from MSQ task reportThis is to allow us to have a single API that returns the status and task report for MSQ queries.
Sample API response when detail=true is passed
{ "queryId": "query-db88b7ba-7c1e-4eb1-b553-3076b0284365", "state": "SUCCESS", "createdAt": "2024-07-26T18:38:22.855Z", "schema": [ { "name": "__time", "type": "TIMESTAMP", "nativeType": "LONG" }, { "name": "name", "type": "VARCHAR", "nativeType": "STRING" }, { "name": "rollNumber", "type": "BIGINT", "nativeType": "LONG" }, { "name": "country", "type": "VARCHAR", "nativeType": "STRING" }, { "name": "age", "type": "BIGINT", "nativeType": "LONG" }, { "name": "grade", "type": "VARCHAR", "nativeType": "STRING" } ], "durationMs": 1656, "result": { "numTotalRows": 6, "totalSizeInBytes": 701, "dataSource": "__query_select", "sampleRecords": [ [ 1442278018771, "Ankit Singh", 6, "India", 26, "E" ], [ 1442018818771, "Adarsh", 1, "India", 20, "A" ], [ 1442191618771, "Amit", 4, "India", 26, "C" ], [ 1442105218771, "Akshat", 3, "India", 24, "A" ], [ 1442191618771, "Ankit Kumar", 5, "India", 26, "D" ], [ 1442018818771, "Ajith", 2, "India", 22, "B" ] ], "pages": [ { "id": 0, "numRows": 6, "sizeInBytes": 701 } ] }, "stages": [ { "stageNumber": 0, "definition": { "id": "query-db88b7ba-7c1e-4eb1-b553-3076b0284365_0", "input": [ { "type": "table", "dataSource": "roll_number_datasource", "intervals": [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] } ], "processor": { "type": "scan", "query": { "queryType": "scan", "dataSource": { "type": "inputNumber", "inputNumber": 0 }, "intervals": { "type": "intervals", "intervals": [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] }, "resultFormat": "compactedList", "limit": 1001, "columns": [ "__time", "age", "country", "grade", "name", "rollNumber" ], "context": { "__resultFormat": "array", "__user": "allowAll", "enableWindowing": true, "executionMode": "async", "finalize": true, "maxNumTasks": 3, "maxParseExceptions": 0, "queryId": "db88b7ba-7c1e-4eb1-b553-3076b0284365", "scanSignature": "[{\"name\":\"__time\",\"type\":\"LONG\"},{\"name\":\"age\",\"type\":\"LONG\"},{\"name\":\"country\",\"type\":\"STRING\"},{\"name\":\"grade\",\"type\":\"STRING\"},{\"name\":\"name\",\"type\":\"STRING\"},{\"name\":\"rollNumber\",\"type\":\"LONG\"}]", "sqlOuterLimit": 1001, "sqlQueryId": "db88b7ba-7c1e-4eb1-b553-3076b0284365", "sqlStringifyArrays": false }, "columnTypes": [ "LONG", "LONG", "STRING", "STRING", "STRING", "LONG" ], "granularity": { "type": "all" }, "legacy": false } }, "signature": [ { "name": "__boost", "type": "LONG" }, { "name": "__time", "type": "LONG" }, { "name": "age", "type": "LONG" }, { "name": "country", "type": "STRING" }, { "name": "grade", "type": "STRING" }, { "name": "name", "type": "STRING" }, { "name": "rollNumber", "type": "LONG" } ], "shuffleSpec": { "type": "mix" }, "maxWorkerCount": 2 }, "phase": "FINISHED", "workerCount": 2, "partitionCount": 1, "shuffle": "mix", "output": "localStorage", "startTime": "2024-07-26T18:38:23.102Z", "duration": 1202 }, { "stageNumber": 1, "definition": { "id": "query-db88b7ba-7c1e-4eb1-b553-3076b0284365_1", "input": [ { "type": "stage", "stage": 0 } ], "processor": { "type": "limit", "limit": 1001 }, "signature": [ { "name": "__boost", "type": "LONG" }, { "name": "__time", "type": "LONG" }, { "name": "age", "type": "LONG" }, { "name": "country", "type": "STRING" }, { "name": "grade", "type": "STRING" }, { "name": "name", "type": "STRING" }, { "name": "rollNumber", "type": "LONG" } ], "shuffleSpec": { "type": "maxCount", "clusterBy": { "columns": [ { "columnName": "__boost", "order": "ASCENDING" } ] }, "partitions": 1 }, "maxWorkerCount": 1 }, "phase": "FINISHED", "workerCount": 1, "partitionCount": 1, "shuffle": "globalSort", "output": "localStorage", "startTime": "2024-07-26T18:38:24.303Z", "duration": 14, "sort": true } ], "counters": { "0": { "0": { "input0": { "type": "channel", "rows": [ 3 ], "bytes": [ 4039 ], "files": [ 2 ], "totalFiles": [ 2 ] }, "output": { "type": "channel", "rows": [ 3 ], "bytes": [ 351 ], "frames": [ 2 ] }, "shuffle": { "type": "channel", "rows": [ 3 ], "bytes": [ 351 ], "frames": [ 2 ] } }, "1": { "input0": { "type": "channel", "rows": [ 3 ], "bytes": [ 4038 ], "files": [ 2 ], "totalFiles": [ 2 ] }, "output": { "type": "channel", "rows": [ 3 ], "bytes": [ 350 ], "frames": [ 2 ] }, "shuffle": { "type": "channel", "rows": [ 3 ], "bytes": [ 350 ], "frames": [ 2 ] } } }, "1": { "0": { "input0": { "type": "channel", "rows": [ 6 ], "bytes": [ 701 ], "frames": [ 4 ] }, "output": { "type": "channel", "rows": [ 6 ], "bytes": [ 701 ], "frames": [ 4 ] }, "shuffle": { "type": "channel", "rows": [ 6 ], "bytes": [ 599 ], "frames": [ 1 ] }, "sortProgress": { "type": "sortProgress", "totalMergingLevels": 3, "levelToTotalBatches": { "0": 2, "1": 1, "2": 1 }, "levelToMergedBatches": { "0": 2, "1": 1, "2": 1 }, "totalMergersForUltimateLevel": 1, "progressDigest": 1.0 } } } }, "warnings": [] }Release Notes
Add optional boolean query parameter
detailfor the API to get query status.Path:
/v2/sql/statements/query-id?detail=trueMethod:
GETIf the optional query parameter
detailis supplied, then the response also includes the following:stagesobject that summarizes information about the different stages being used for query execution, such as stage number, phase, start time, duration, input and output information, processing methods, and partitioning.countersobject that provides details on the rows, bytes, and files processed at various stages for each worker across different channels, along with sort progress.warningsobject that provides details about any warnings.This PR has: