Repository navigation
Conversation
(cherry picked from commit 9067763)
|
|
||
| public static boolean validateStatement(Statement statement) { | ||
| return !(statement instanceof QueryStatement) | ||
| && !(statement instanceof ShowDeleteTimeSeriesProgressStatement) |
There was a problem hiding this comment.
major external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/v1/handler/ExecuteStatementHandler.java:37 — Query path still rejects SHOW DELETE TIMESERIES PROGRESS: fillQueryDataSet has no branch for it
After this change SHOW DELETE TIMESERIES PROGRESS reaches the REST v1 query endpoint, but QueryDataSetHandler.fillQueryDataSet (v1, lines 61-84) only special-cases ShowStatement/ShowModels/ShowAIDevices/ShowLoadedModels/AuthorStatement/GetRegionIdStatement and QueryStatement; ShowDeleteTimeSeriesProgressStatement (extends Statement, implements IConfigStatement) falls through to the fallback branch and returns QUERY_PROCESS_ERROR "unsupported query data type", so the feature does not work. The non-query endpoint simultaneously regresses from SUCCESS_STATUS to EXECUTE_STATEMENT_ERROR.
Fix: Add statement instanceof ShowDeleteTimeSeriesProgressStatement to the fillShowPlanDataSet branch in external-service-impl/rest/.../v1/handler/QueryDataSetHandler.java, mirroring the validator change (and v2 for parity).
| public class QueryDataSetHandlerTest { | ||
|
|
||
| @Test | ||
| public void showDeleteTimeSeriesProgressIsAllowedAsQuery() { |
There was a problem hiding this comment.
minor external-service-impl/rest/src/test/java/org/apache/iotdb/rest/protocol/v1/handler/QueryDataSetHandlerTest.java:55 — New test only asserts validateStatement and never exercises fillQueryDataSet
showDeleteTimeSeriesProgressIsAllowedAsQuery asserts only assertFalse(ExecuteStatementHandler.validateStatement(...)), so it passes even though QueryDataSetHandler.fillQueryDataSet still returns a QUERY_PROCESS_ERROR for this statement type. The regression is invisible to the test suite.
Fix: Extend the test to call QueryDataSetHandler.fillQueryDataSet(new TestQueryExecution(...), new ShowDeleteTimeSeriesProgressStatement(), limit) and assert a QueryDataSet with the expected column names is returned.
Summary
Route
SHOW DELETE TIMESERIES PROGRESSthrough REST v1's query path and serialize its result as a query dataset.Example
Request:
POST /rest/v1/query{"sql":"SHOW DELETE TIMESERIES PROGRESS"}Before: REST v1 classifies the statement as an execution statement and rejects it on the query endpoint.
After: REST v1 returns the 8-column progress dataset, including
ProcedureIdand zero or more progress rows.Tests
QueryDataSetHandlerTest#showDeleteTimeSeriesProgressIsAllowedAsQueryIoTDBRestServiceIT#showDeleteTimeSeriesProgressIsQueryableThroughRestV1Split out from #19523.