Skip to content

Include server status messages in CLI success output - #19539

Draft
Caideyipi wants to merge 2 commits into
apache:masterfrom
Caideyipi:codex/cli-server-message-20261204
Draft

Caideyipi wants to merge 2 commits into
apache:masterfrom
Caideyipi:codex/cli-server-message-20261204

Conversation

@Caideyipi

@Caideyipi Caideyipi commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Append a server-provided status message to the standard CLI success message on one line, separated by a space.

Example

SQL: DROP TABLE test_table
Server status: Table deletion task 123 has been submitted for asynchronous execution.

Before: the server status and generic success message are printed on separate lines.
After: Msg: The statement is executed successfully. Table deletion task 123 has been submitted for asynchronous execution. is printed on one line.

Tests

  • Unit: AbstractCliTest#testServerMessageIsAppendedToSuccessMessage
  • Unit: AbstractCliTest#testNoOpServerMessageIsAppendedToSuccessMessage
  • Integration: ExplainJsonCliOutputIT#testServerMessageIsAppendedToSuccessMessage runs a real CLI DROP TABLE against the test cluster and checks the combined output line.

Split out from #19523.

.println(
String.format(
CliMessages.LOG_MSG_ARG_240992E0, Objects.toString(SUCCESS_MESSAGE)));
String.format(CliMessages.LOG_MSG_ARG_240992E0, SUCCESS_MESSAGE + serverMessage));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

minor iotdb-client/cli/src/main/java/org/apache/iotdb/cli/AbstractCli.java:780 — Success message and server status concatenated without separator

When getLastStatementMessage() returns a non-blank message, SUCCESS_MESSAGE + serverMessage joins the two sentences with no delimiter: EXCEPTION_THE_STATEMENT_IS_EXECUTED_SUCCESSFULLY_B07F8CCB ends with "." and server messages such as "Table deletion task %s has been submitted..." have no leading space, so the CLI prints "Msg: The statement is executed successfully.Table deletion task 123 has been submitted for asynchronous execution." The rewritten tests (AbstractCliTest:140-146 and :168-174) assert this exact malformed string, locking the defect in.

Fix: Join with a separator, e.g. String.format(CliMessages.LOG_MSG_ARG_240992E0, SUCCESS_MESSAGE + " " + serverMessage), and update the two test expectations to include the space.

@Caideyipi
Caideyipi marked this pull request as draft December 4, 2026 09:45
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.

2 participants