doris icon indicating copy to clipboard operation
doris copied to clipboard

[Bug](Medium) ALTER STREAM SET COMMENT is not supported for table stream

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_alter_comment.groovy
remote log: /mnt/disk1/jianxu/case_output/doris/testrun/table_stream_p0_20260708/test_table_stream_alter_comment.retry2.log
FE: 172.20.49.4:9030

What's Wrong?

ALTER STREAM ... SET COMMENT fails at parser stage, even though table stream creation with an initial comment works and information_schema.table_streams exposes the comment.

Failing SQL:

ALTER STREAM s_alter_comment SET COMMENT 'updated comment';

Actual error:

errCode = 2, detailMessage =
no viable alternative at input 'ALTER STREAM'(line 1, pos 6)

What You Expected?

ALTER STREAM ... SET COMMENT should be parsed and executed successfully, and information_schema.table_streams.STREAM_COMMENT should reflect the updated comment.

How to Reproduce?

Regression case:

regression-test/suites/table_stream_p0/test_table_stream_alter_comment.groovy

Minimal flow:

CREATE TABLE base_dup (
    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_alter_comment ON TABLE base_dup
COMMENT 'initial comment'
PROPERTIES ("type" = "append_only");

ALTER STREAM s_alter_comment SET COMMENT 'updated comment';

Regression Test Result

suite: test_table_stream_alter_comment
command: ALTER STREAM s_alter_comment SET COMMENT 'updated comment'
actual: no viable alternative at input 'ALTER STREAM'(line 1, pos 6)

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_262e995314f2 This content is generated by AI for reference only.

Initial analysis for apache/doris#65388:

This looks like a real FE DDL support gap for table streams, not a bad test expectation. At the reported upstream commit d4a077caf8ae55e78e4fbf88da91a74facc30aed, DorisParser.g4 has CREATE STREAM ... COMMENT, DROP STREAM, SHOW STREAMS, and SHOW CREATE STREAM, but supportedAlterStatement has no ALTER STREAM alternative. Therefore ALTER STREAM s_alter_comment SET COMMENT 'updated comment' fails before analysis with the observed parser error: no viable alternative at input 'ALTER STREAM'.

The catalog side already has the data model needed for stream comments:

  • InternalCatalog.createTableStream() calls newStream.setComment(createStreamInfo.getComment()).
  • BaseTableStream is a TableType.STREAM table and inherits Table.getComment()/setComment().
  • TableStreamManager.fillTableStreamValuesMetadataResult() fills information_schema.table_streams.STREAM_COMMENT from stream.getComment().

This should not be treated as only a syntax alias to generic ALTER TABLE ... MODIFY COMMENT. The generic alter-table path is OLAP/external-table oriented: Alter.processAlterTable() handles OLAP, MATERIALIZED_VIEW, and external table types, while unhandled types fall through to Do not support alter .... A table stream is TableType.STREAM, so a maintainable fix should add stream-specific DDL plumbing instead of depending on the OLAP table comment path.

Suggested next steps:

  1. Add parser support for ALTER STREAM <multipartIdentifier> SET COMMENT <STRING_LITERAL>.
  2. Add a Nereids command for altering stream comments that validates the target is a BaseTableStream, checks ALTER privilege on the stream object, locks the stream metadata, updates setComment, and logs the change.
  3. Reuse the existing table-comment edit log if possible: ModifyCommentOperationLog.forTable(dbId, streamId, comment) plus OP_MODIFY_COMMENT replay should work because Alter.replayModifyComment() resolves by db/table id and calls Table.setComment() for table comments.
  4. Add regression coverage under regression-test/suites/table_stream_p0 for create-with-comment, ALTER STREAM ... SET COMMENT, information_schema.table_streams.STREAM_COMMENT, and preferably SHOW CREATE STREAM. If feasible, add a focused FE/replay check for edit-log persistence.

No blocking information is missing for the initial root-cause direction: the SQL, commit, and parser-stage error are enough to identify the unsupported DDL path. The remote FE log would still be useful for PR validation if the first implementation exposes a later analyzer or catalog-layer error.

zclllyybb avatar Jul 08 '26 12:07 zclllyybb

Hi, I’m interested in preparing a focused fix for #65388, but before starting I’d like to confirm the intended public contract because Table Stream is still in preview and the current public documentation does not define ALTER STREAM.

Could a maintainer confirm:

  1. The exact syntax and name-qualification rules.
  2. Whether the required privilege applies to the stream, base table, or database.
  3. Whether the change must be edit-logged, checkpointed, replayed, and survive an FE restart.
  4. Whether both SHOW CREATE STREAM and information_schema.table_streams must expose the updated comment.
  5. Whether this must work in both on-premise and Cloud deployments, especially alongside #65859.
  6. Whether one PR covering parser, command, authorization, persistence, tests, and documentation is the expected scope.

I have not started implementation and will refresh overlapping PRs before doing so.

johntomcat7408-cmyk avatar Aug 01 '26 10:08 johntomcat7408-cmyk

Hi, I’m interested in preparing a focused fix for #65388, but before starting I’d like to confirm the intended public contract because Table Stream is still in preview and the current public documentation does not define ALTER STREAM.

Could a maintainer confirm:

  1. The exact syntax and name-qualification rules.
  2. Whether the required privilege applies to the stream, base table, or database.
  3. Whether the change must be edit-logged, checkpointed, replayed, and survive an FE restart.
  4. Whether both SHOW CREATE STREAM and information_schema.table_streams must expose the updated comment.
  5. Whether this must work in both on-premise and Cloud deployments, especially alongside [feature](tablet stream) Support Cloud Table Stream control plane #65859.
  6. Whether one PR covering parser, command, authorization, persistence, tests, and documentation is the expected scope.

I have not started implementation and will refresh overlapping PRs before doing so.

Sorry I missed you message and already summit a PR to fix this. Please join our slack channel (https://doris.apache.org/slack) and discuss in #dev channel if you want to pick any other issue

morningman avatar Sep 03 '26 05:09 morningman