Skip to content

[fix](ui) Skip empty statements and standalone comments in Playground scripts - #69934

Open
VictorMoni wants to merge 1 commit into
apache:masterfrom
VictorMoni:fix/playground-empty-statements
Open

VictorMoni wants to merge 1 commit into
apache:masterfrom
VictorMoni:fix/playground-empty-statements

Conversation

@VictorMoni

Copy link
Copy Markdown

What problem does this PR solve?

Issue Number: N/A

Related PR: N/A

Problem Summary:

Running the complete editor script ; SELECT 1;; /* between */; SELECT 2; -- done submits empty separators and standalone comments as separate Web SQL requests. The API requires exactly one statement per request, so an empty range can stop the script before a valid query, and a trailing comment can report a failure after successful queries.

Reuse the existing scanner to track SQL outside comments and skip empty ranges in the complete-document execution queue. Preserve editor offsets, comments attached to SQL, and quoted comment markers. Keep unterminated block comments for server-side syntax validation. Explicit selections retain their existing behavior; the backend validator and supported scanner syntax are unchanged.

Tests cover these cases and verify the Run button sends only the two real queries, or shows the existing warning for a comment-only script. Clear sessionStorage between page tests to isolate persisted editor history.

Release note

Fix SQL Playground script execution stopping on empty statements or reporting failures for standalone comments.

Check List (For Author)

  • Test
    • Regression test
    • Unit Test: cd ui && npm test — 31 files, 126 tests passed. Focused scanner/page suites: 22 tests passed. The new scanner cases and both page tests fail on the original scanner.
    • Manual test: npm run lint, npm run build (includes TypeScript checking), and git diff --check passed.
    • No need to test or manual test.

No live Doris cluster, FE/BE build, or Playwright end-to-end suite was run. Vitest emits jsdom pseudo-element getComputedStyle notices; the build emits its bundle-size warning.

  • Behavior changed:

    • No.
    • Yes. Complete-document execution skips empty and standalone-comment ranges.
  • Does this need documentation?

    • No. No new options or SQL syntax.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

… scripts

### What problem does this PR solve?

Issue Number: N/A

Related PR: N/A

Problem Summary:

Running a complete editor script such as `; SELECT 1;; /* between */; SELECT 2; -- done` submits each semicolon-delimited range to the Web SQL API, including `;`, `/* between */;`, and the trailing comment. The API requires exactly one SQL statement per request, so an empty range can stop execution before a valid query, and a trailing comment can report a failure after successful queries.

Reuse the existing scanner to track whether each range contains SQL outside comments. Skip empty and comment-only ranges when building the execution queue, while preserving editor ranges and comments attached to real statements. Keep unterminated block comments in the queue for server-side syntax validation.

This change applies to running the complete editor document. Explicit text selections retain their existing execution behavior. It does not change the backend SQL validator or add SQL syntax support to the browser scanner.

Tests cover empty separators, standalone and attached comments, quoted comment markers and semicolons, malformed SQL, unchanged editor offsets, and the Run button's request sequence and empty-script warning. Clear sessionStorage between page tests to isolate persisted editor history.

### Release note

Fix SQL Playground script execution stopping on empty statements or reporting failures for standalone comments.

### Check List (For Author)

- Test
    - [ ] Regression test
    - [x] Unit Test: `cd ui && npm test` — 31 files, 126 tests passed; focused scanner/page suites — 22 tests passed.
    - [x] Manual test: `npm run lint`, `npm run build` (includes TypeScript checking), and `git diff --check` passed.
    - [ ] No need to test or manual test.

The new scanner tests and both page tests fail on the original scanner. No live Doris cluster, FE/BE build, or Playwright end-to-end suite was run. Vitest emits jsdom pseudo-element getComputedStyle notices; the production build emits its bundle-size warning.

- Behavior changed:
    - [ ] No.
    - [x] Yes. Complete-document execution skips empty and standalone-comment ranges.

- Does this need documentation?
    - [x] No. Restores expected script execution without new options or syntax.
    - [ ] Yes.

### Check List (For Reviewer who merge this PR)

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

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