doris icon indicating copy to clipboard operation
doris copied to clipboard

[Bug](Low) CANCEL ALTER STREAM is not supported by parser

Open MoanasDaddyXu opened this issue 4 months ago • 3 comments

Search before asking

  • [x] I had searched in the issues and found no similar issues.

Version

Reproduced with the table stream regression case on local Doris HEAD d4a077caf8a.

Test environment:

regression-test/suites/table_stream_p0/test_table_stream_cancel_alter.groovy
remote log: /mnt/disk1/jianxu/case_output/doris/testrun/table_stream_p0_20260708/test_table_stream_cancel_alter.final.log
FE: 172.20.49.4:9030

What's Wrong?

CANCEL ALTER STREAM is not accepted by the SQL parser. The parser currently expects TABLE after CANCEL ALTER, so the statement fails before it can reach table stream alter-cancel handling.

Failing SQL:

CANCEL ALTER STREAM s_cancel;

Actual error:

errCode = 2, detailMessage =
mismatched input 'STREAM' expecting 'TABLE'(line 1, pos 13)

What You Expected?

CANCEL ALTER STREAM s_cancel should be parsed as a table stream statement. If there is no in-progress alter stream job, it should return a clear semantic error, for example:

no alter stream job

How to Reproduce?

Regression case:

regression-test/suites/table_stream_p0/test_table_stream_cancel_alter.groovy

Minimal flow:

CREATE TABLE base_cancel (
    k1 INT,
    v1 INT
)
DUPLICATE KEY(k1)
DISTRIBUTED BY HASH(k1) BUCKETS 1
PROPERTIES (
    "replication_num" = "1",
    "binlog.enable" = "true",
    "binlog.format" = "ROW"
);

CREATE STREAM s_cancel ON TABLE base_cancel
PROPERTIES ("type" = "append_only");

CANCEL ALTER STREAM s_cancel;

Regression Test Result

suite: test_table_stream_cancel_alter
command: CANCEL ALTER STREAM s_cancel
expected: exception message contains "no alter stream job"
actual: mismatched input 'STREAM' expecting 'TABLE'(line 1, pos 13)

Anything Else?

Tracking issue: #65265

Are you willing to submit PR?

  • [ ] Yes I am willing to submit a PR!

MoanasDaddyXu avatar Jul 08 '26 12:07 MoanasDaddyXu

Breakwater-GitHub-Analysis-Slot: slot_62432671e8cc This content is generated by AI for reference only.

Initial triage: this looks like a valid FE SQL parser gap, and there is also a semantic command gap behind it.

Evidence checked:

  • The live issue has no comments yet and reports the failure on CANCEL ALTER STREAM s_cancel; with mismatched input 'STREAM' expecting 'TABLE'.
  • I could not resolve the reporter's short SHA d4a077caf8a from the local object database or public upstream refs during triage, so I checked refreshed upstream/master at a6ab604907e752d71f1359d5de9b84a7ca170a77.
  • On that ref, fe/fe-sql-parser/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 has stream DDL entries for create/drop/show stream, but supportedCancelStatement only accepts CANCEL ALTER TABLE (ROLLUP | MATERIALIZED VIEW | COLUMN) FROM ...; there is no CANCEL ALTER STREAM alternative.
  • The builder and command path match the parser limitation: LogicalPlanBuilder.visitCancelAlterTable() only maps ROLLUP, MATERIALIZED VIEW, and COLUMN; CancelAlterTableCommand.AlterType only contains COLUMN, ROLLUP, and MV; Env.cancelAlter() only dispatches those table alter types to the schema-change or materialized-view handlers.
  • A targeted search did not find a table-stream-specific cancel-alter command or a TableStreamManager/catalog handler for canceling stream alter jobs on this ref.

Judgment: The reported parser error is expected from the current grammar, so the issue is valid. A maintainable fix should not only add STREAM to the existing CANCEL ALTER TABLE grammar path, because the current command model cannot represent or execute stream alter cancellation. The parser, logical-plan builder, command/visitor type, privilege validation, and table-stream execution path need to agree on the intended CANCEL ALTER STREAM semantics.

Missing information to confirm before implementing:

  • The intended exact syntax: for example CANCEL ALTER STREAM <stream_name> versus a FROM form, and whether job-id filtering should be supported.
  • Which ALTER STREAM operations create cancellable jobs. If some stream alterations are synchronous, the expected no alter stream job error should be defined as a stable semantic error for the no-active-job path.
  • A public branch/PR or full commit SHA for d4a077caf8a, if that commit contains newer table-stream DDL code not present on current public upstream/master.

Suggested next steps:

  • Add a CANCEL ALTER STREAM parser alternative and a builder visitor that produces a stream-aware command, or extend the existing cancel command only if a real STREAM dispatch path is added at the same time.
  • Implement the semantic handler in the table-stream/catalog layer: resolve the stream name, validate the object is a table stream, check the appropriate alter privilege, locate any active alter-stream job, and return a stable "no alter stream job" style error when none exists.
  • Add focused coverage for parsing and execution: a parser/unit test for CANCEL ALTER STREAM s_cancel;, the reported regression case for the no-active-job error, and an active-job cancellation case if async alter-stream jobs exist.

zclllyybb avatar Jul 08 '26 12:07 zclllyybb

i don't think there are cases need to cancel a alter stream

TsukiokaKogane avatar Jul 09 '26 12:07 TsukiokaKogane

The Alter Stream command is not yet supported, so there is no need for a Cancel Alter Stream command either;

this issue can be closed for now.

AntiTopQuark avatar Sep 08 '26 08:09 AntiTopQuark