Repository navigation
[fix](ui) Skip empty statements and standalone comments in Playground scripts - #69934
Open
VictorMoni wants to merge 1 commit into
Open
VictorMoni wants to merge 1 commit into
VictorMoni wants to merge 1 commit into
Conversation
… 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
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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; -- donesubmits 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)
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.npm run lint,npm run build(includes TypeScript checking), andgit diff --checkpassed.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:
Does this need documentation?
Check List (For Reviewer who merge this PR)