RounakKumarAgarwal commented on PR #67170:
URL: https://github.com/apache/doris/pull/67170#issuecomment-5424305504

   ## What this PR does
   
   Implements the feature requested in #66661: query history and result caching 
for the Playground SQL console in the FE Web UI.
   
   ### 3. What features were added, and why
   
   Previously the Web UI SQL console had no way to view past queries or their 
results — inconvenient for the simple, repeated testing the console is meant 
for (as described in #66661). This PR adds two features, both entirely 
client-side in `ui/`:
   
   **Query history**
   - Executed statements are persisted in `localStorage`, scoped per FE host, 
as a ~100-entry ring buffer, each tagged with success/error status and a 
timestamp.
   - A History drawer (opened from a new button beside Execute) lists past 
statements. Clicking one reloads it into the editor via the existing 
`openInEditorSubject`. Supports per-item delete and clear-all.
   
   **Result cache**
   - Re-running an identical statement (keyed on normalized SQL + selected 
database) within a TTL replays the cached result instead of issuing another 
query.
   - Cached row count and total entries are capped to bound `localStorage` 
usage.
   - Replayed results carry a "Cached" tag in the result view so they are never 
mistaken for a fresh run against a changing table.
   
   **i18n**
   - Adds the corresponding en-US and zh-CN strings.
   
   ### 2. Behavior changes
   
   - The console's Execute path is unchanged for a first run. On a repeat of an 
identical statement within the TTL, the result is now served from cache 
(visibly tagged) rather than re-queried. History recording is additive and does 
not alter query execution.
   - No change to any FE/BE endpoint or API. No server-side state is introduced.
   
   ### 1 / 4 / 5. Bug fixes / refactors / optimizations
   
   - No bug fix, no refactor of existing logic. The new logic is isolated in a 
new module (`ui/src/utils/query-store.ts`); wiring into `content/index.tsx` and 
`content-result.tsx` is minimal and additive.
   
   ### Files changed
   - `ui/src/utils/query-store.ts` (new) — history + cache localStorage module
   - `ui/src/pages/playground/content/index.tsx` — record history/cache, 
cache-aware run, History drawer
   - `ui/src/pages/playground/content/content-result.tsx` — "Cached" tag
   - `ui/public/locales/en-us.json`, `ui/public/locales/zh-cn.json` — new 
strings
   
   ### Testing
   - Builds cleanly with `npm run build`.
   - Not yet verified against a running FE end-to-end; happy to follow up with 
screenshots/validation.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to