Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose query status through EXPLAIN #3570

Merged

Conversation

big-andy-coates
Copy link
Contributor

@big-andy-coates big-andy-coates commented Oct 14, 2019

Description

Fixes #3208

With this commit the status of any persistent query is exposed as part of the response from EXPLAIN <some-query-id>;

For example,

ksql>EXPLAIN CSAS_ID_0_1;

ID                   : CSAS_ID_0_1
SQL                  : CREATE STREAM ID_0 WITH (KAFKA_TOPIC='ID_0', PARTITIONS=1, REPLICAS=1) AS SELECT *
FROM ORDER_KSTREAM ORDER_KSTREAM
EMIT CHANGES;
Status               : REBALANCING

 Field       | Type
-----------------------------------------
 ROWTIME     | BIGINT           (system)
 ROWKEY      | VARCHAR(STRING)  (system)
 ORDERTIME   | BIGINT
 ORDERID     | VARCHAR(STRING)
 ITEMID      | VARCHAR(STRING)
 ORDERUNITS  | DOUBLE
 TIMESTAMP   | VARCHAR(STRING)
 PRICEARRAY  | ARRAY<DOUBLE>
 KEYVALUEMAP | MAP<STRING, DOUBLE>
-----------------------------------------
...

Note the new Status : REBALANCING part.

Testing done

manual + suitable tests added

Reviewer checklist

  • Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).
  • Ensure relevant issues are linked (description should include text like "Fixes #")

With this commit the status of any persistent query is exposed as part of the response from `EXPLAIN <some-query-id>;`

For example,

```
ksql>EXPLAIN CSAS_ID_0_1;

ID                   : CSAS_ID_0_1
SQL                  : CREATE STREAM ID_0 WITH (KAFKA_TOPIC='ID_0', PARTITIONS=1, REPLICAS=1) AS SELECT *
FROM ORDER_KSTREAM ORDER_KSTREAM
EMIT CHANGES;
Status               : REBALANCING

 Field       | Type
-----------------------------------------
 ROWTIME     | BIGINT           (system)
 ROWKEY      | VARCHAR(STRING)  (system)
 ORDERTIME   | BIGINT
 ORDERID     | VARCHAR(STRING)
 ITEMID      | VARCHAR(STRING)
 ORDERUNITS  | DOUBLE
 TIMESTAMP   | VARCHAR(STRING)
 PRICEARRAY  | ARRAY<DOUBLE>
 KEYVALUEMAP | MAP<STRING, DOUBLE>
-----------------------------------------
...
```

Note the new `Status               : REBALANCING` part.
Copy link
Contributor

@vcrfxia vcrfxia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @big-andy-coates -- very useful! LGTM.

@vcrfxia vcrfxia requested a review from a team October 14, 2019 21:07
@vcrfxia vcrfxia changed the title feat(3208): expose query status through EXPLAIN feat: expose query status through EXPLAIN Oct 14, 2019
Copy link
Contributor

@purplefox purplefox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@big-andy-coates big-andy-coates merged commit 8ef82eb into confluentinc:master Oct 15, 2019
@big-andy-coates big-andy-coates deleted the report_query_status branch October 15, 2019 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose status of running queries via command or REST endpoint
3 participants