Skip to content

feat(Queries): multiple full result [YTFRONT-5615]#1457

Open
SimbiozizV wants to merge 1 commit intomainfrom
YTFRONT-5615
Open

feat(Queries): multiple full result [YTFRONT-5615]#1457
SimbiozizV wants to merge 1 commit intomainfrom
YTFRONT-5615

Conversation

@SimbiozizV
Copy link
Collaborator

@SimbiozizV SimbiozizV commented Mar 12, 2026

https://nda.ya.ru/t/mdLWDa4Q7WZwTD

## Summary by Sourcery

Support displaying and handling multiple full query result tables, including existence checks and richer UI controls.

New Features:

  • Allow query result metadata to expose one or multiple full result tables instead of a single table.
  • Add a UI list for full query results with navigation and query-editor path insertion controls.
  • Introduce an engine-aware path builder for full result links and editor insertion.

Enhancements:

  • Augment full result metadata with an existence flag by checking table presence via ytApiV3 before rendering.
  • Show clearer status in the UI when a full result table has been removed from the cluster.
  • Extend YQL engine info with supported feature flags, including multiple full results support.

@sourcery-ai
Copy link

sourcery-ai bot commented Mar 12, 2026

Reviewer's Guide

Adds support for multiple full-result tables in the query tracker UI, including existence checks in the backend flow and a new UI component to list, navigate to, and paste full-result table paths, plus engine feature metadata for capabilities.

Sequence diagram for loading query result meta with multiple full results and existence checks

sequenceDiagram
    participant QueryResultsView
    participant loadQueryResult
    participant getQueryResultMeta
    participant attachExistenceToFullResult
    participant getClusterConfigByName
    participant getClusterProxy
    participant ytApiV3

    QueryResultsView->>loadQueryResult: dispatch loadQueryResult(queryId, resultIndex)
    activate loadQueryResult
    loadQueryResult->>getQueryResultMeta: dispatch getQueryResultMeta(queryId, resultIndex)
    activate getQueryResultMeta
    getQueryResultMeta-->>loadQueryResult: meta
    deactivate getQueryResultMeta

    alt meta.full_result is defined
        loadQueryResult->>attachExistenceToFullResult: attachExistenceToFullResult(meta.full_result)
        activate attachExistenceToFullResult
        attachExistenceToFullResult->>attachExistenceToFullResult: normalize to array items
        loop for each item in items
            attachExistenceToFullResult->>getClusterConfigByName: getClusterConfigByName(cluster)
            getClusterConfigByName-->>attachExistenceToFullResult: clusterConfig
            attachExistenceToFullResult->>getClusterProxy: getClusterProxy(clusterConfig)
            getClusterProxy-->>attachExistenceToFullResult: proxy
            attachExistenceToFullResult->>ytApiV3: ytApiV3.exists(proxy, path)
            ytApiV3-->>attachExistenceToFullResult: boolean exists or error
            attachExistenceToFullResult->>attachExistenceToFullResult: map to exist flag
        end
        attachExistenceToFullResult-->>loadQueryResult: full_result with exist flags
        deactivate attachExistenceToFullResult
        loadQueryResult->>loadQueryResult: meta.full_result = result
    end

    loadQueryResult-->>QueryResultsView: resultReady state with full_result and exist flags
    deactivate loadQueryResult

    QueryResultsView->>QueryReadyResultView: render with result and engine
    QueryReadyResultView->>QueryFullResultList: render fullResult and engine
    QueryFullResultList->>QueryFullResultRow: render rows for each full result item
Loading

Sequence diagram for user pasting a full result path into the query editor

sequenceDiagram
    actor User
    participant QueryResultsView
    participant QueryFullResultList
    participant QueryFullResultRow
    participant useMonaco
    participant makePathByQueryEngine
    participant insertTextWhereCursor

    User->>QueryResultsView: Open query results page
    QueryResultsView->>QueryFullResultList: Render with fullResult and engine
    QueryFullResultList->>QueryFullResultRow: Render each row

    User->>QueryFullResultRow: Click paste path button
    QueryFullResultRow->>useMonaco: getEditor(queryEditor)
    useMonaco-->>QueryFullResultRow: editor
    QueryFullResultRow->>makePathByQueryEngine: makePathByQueryEngine(cluster, path, engine)
    makePathByQueryEngine-->>QueryFullResultRow: engineSpecificPath
    QueryFullResultRow->>insertTextWhereCursor: insertTextWhereCursor(engineSpecificPath, editor)
    insertTextWhereCursor-->>QueryFullResultRow: text inserted
    QueryFullResultRow-->>User: Path appears in query editor
Loading

Updated class diagram for query tracker full result metadata and UI components

classDiagram
    class QueryFullResult {
        string cluster
        string table_path
        boolean exist
    }

    class QueryResultMeta {
        string id
        number result_index
        any schema
        any yql_type
        any statistics
        any partition_statistics
        QueryFullResult full_result
    }

    class QueryResultsView {
        +render()
    }

    class QueryReadyResultView {
        +props result
        +props engine
        +props onShowPreview
        +render()
    }

    class QueryFullResultList {
        +props fullResult
        +props engine
        +props className
        +render()
    }

    class QueryFullResultRow {
        +props id
        +props engine
        +props cluster
        +props path
        +props isExist
        +handlePastePath()
        +render()
    }

    class YqlEnginesInfo {
        string[] available_yql_versions
        string default_yql_ui_version
        SupportedFeatures supported_features
    }

    class SupportedFeatures {
        boolean declare_params
        boolean multiple_full_results
        boolean yql_runner
    }

    QueryResultMeta --> QueryFullResult : full_result 0..*
    QueryResultsView --> QueryReadyResultView : renders
    QueryReadyResultView --> QueryFullResultList : passes fullResult and engine
    QueryFullResultList --> QueryFullResultRow : renders multiple
    YqlEnginesInfo --> SupportedFeatures : has
Loading

File-Level Changes

Change Details Files
Enrich query result metadata with full-result existence information when loading results.
  • Introduce attachExistenceToFullResult helper to normalize full_result to an array, probe table existence via ytApiV3.exists, and annotate each entry with an exist flag, handling errors as non-existing
  • Update loadQueryResult to call getQueryResultMeta, then augment meta.full_result with existence info before continuing the load pipeline
packages/ui/src/ui/store/actions/query-tracker/queryResult.ts
Extend query result types and YQL engine metadata for multiple full results and feature flags.
  • Add QueryFullResult type and allow QueryResultMeta.full_result to be either a single QueryFullResult or an array of them
  • Extend YqlEnginesInfo with an optional supported_features structure including multiple_full_results and related flags
packages/ui/src/ui/types/query-tracker/api.ts
packages/ui/src/shared/yt-types.d.ts
Replace single full-result link in the query results view with a list component that supports multiple entries and engine-aware path pasting.
  • Pass the current QueryEngine into QueryReadyResultView via selector getQueryEngine
  • Render QueryFullResultList above result info when full_result is present and remove the old single full-result Link
  • Adjust styles to account for the new full-result list block spacing
packages/ui/src/ui/pages/query-tracker/QueryResultsView/index.tsx
packages/ui/src/ui/pages/query-tracker/QueryResultsView/index.scss
Introduce QueryFullResultList and row components to render and interact with each full-result table.
  • Add QueryFullResultList to normalize full_result into an array of QueryFullResult entries and render a QueryFullResultRow per item
  • Implement QueryFullResultRow to show table metadata, indicate when the table no longer exists, open navigation in a new tab, and paste an engine-specific table reference into the query editor using makePathByQueryEngine and insertTextWhereCursor
  • Add basic layout and styling for the list and rows using BEM classes
packages/ui/src/ui/pages/query-tracker/QueryResultsView/QueryFullResultList/QueryFullResultRow.tsx
packages/ui/src/ui/pages/query-tracker/QueryResultsView/QueryFullResultList/QueryFullResultList.tsx
packages/ui/src/ui/pages/query-tracker/QueryResultsView/QueryFullResultList/QueryFullResultRow.scss
packages/ui/src/ui/pages/query-tracker/QueryResultsView/QueryFullResultList/QueryFullResultList.scss
packages/ui/src/ui/pages/query-tracker/QueryResultsView/QueryFullResultList/index.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions
Copy link
Contributor

Storybook is ready.

@github-actions
Copy link
Contributor

Playwright components report is ready.

@github-actions
Copy link
Contributor

Statoscope report is ready.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 12, 2026

E2E-local report is ready.
E2E-remote report is ready.
E2E-screenshots report is ready.
E2E-passwd report is ready.

@SimbiozizV SimbiozizV marked this pull request as ready for review March 13, 2026 06:40
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 2 issues, and left some high level feedback:

  • In loadQueryResult you mutate meta.full_result in place after getQueryResultMeta; consider cloning the meta object (or returning an enriched copy from attachExistenceToFullResult) to avoid unexpected side effects if other code assumes query result metadata is immutable.
  • The user-facing text Table has been removed from cluster in QueryFullResultRow is hard-coded; it would be better to hook this into the existing i18n system to keep translations consistent with the rest of the query tracker UI.
  • In QueryFullResultList, the fullResult prop is typed as Required<QueryResultMeta>['full_result'] but you immediately normalize it to an array; you might simplify and make the component’s contract clearer by changing the prop type to QueryFullResult[] and doing the array normalization at the call site.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `loadQueryResult` you mutate `meta.full_result` in place after `getQueryResultMeta`; consider cloning the meta object (or returning an enriched copy from `attachExistenceToFullResult`) to avoid unexpected side effects if other code assumes query result metadata is immutable.
- The user-facing text `Table has been removed from cluster` in `QueryFullResultRow` is hard-coded; it would be better to hook this into the existing i18n system to keep translations consistent with the rest of the query tracker UI.
- In `QueryFullResultList`, the `fullResult` prop is typed as `Required<QueryResultMeta>['full_result']` but you immediately normalize it to an array; you might simplify and make the component’s contract clearer by changing the prop type to `QueryFullResult[]` and doing the array normalization at the call site.

## Individual Comments

### Comment 1
<location path="packages/ui/src/ui/pages/query-tracker/QueryResultsView/QueryFullResultList/QueryFullResultRow.tsx" line_range="40" />
<code_context>
+
+    return (
+        <div className={b()}>
+            <Text variant="subheader-1">Full Result {id}</Text>
+            {!isExist && <span>Table has been removed from cluster</span>}
+            {isExist ? (
</code_context>
<issue_to_address>
**suggestion:** Consider avoiding hardcoded English text to keep this view consistent with the rest of the localized UI.

This label is the only hardcoded English string in this view; the surrounding `QueryResults` content uses `i18n(...)`. Please wire this text through the same i18n mechanism (reusing an existing key if possible) for consistency with the localized UI.

Suggested implementation:

```typescript
    return (
        <div className={b()}>
            <Text variant="subheader-1">
                {i18n('query_tracker.full_result.title', 'Full Result')}{' '}
                {id}
            </Text>
            {!isExist && (
                <span>
                    {i18n(
                        'query_tracker.full_result.table-removed',
                        'Table has been removed from cluster',
                    )}
                </span>
            )}

```

1. Ensure `i18n` is imported in this file in the same way it is imported elsewhere in the Query Tracker UI (for example: `import {i18n} from '../../../../utils/i18n';` or the appropriate path/utility used in nearby components).
2. Add (or reuse) the keys `query_tracker.full_result.title` and `query_tracker.full_result.table-removed` in your localization resources, with translations for each supported language.
3. If your `i18n` helper uses a different signature (e.g. `i18n('key')` without a default string, or uses interpolation instead of concatenation), adjust the calls accordingly, potentially to something like `i18n('query_tracker.full_result.title', {id})`.
</issue_to_address>

### Comment 2
<location path="packages/ui/src/ui/pages/query-tracker/QueryResultsView/QueryFullResultList/QueryFullResultRow.tsx" line_range="41" />
<code_context>
+    return (
+        <div className={b()}>
+            <Text variant="subheader-1">Full Result {id}</Text>
+            {!isExist && <span>Table has been removed from cluster</span>}
+            {isExist ? (
+                <Link target="_blank" href={navigationLink}>
</code_context>
<issue_to_address>
**issue (review_instructions):** The user-facing message is slightly ungrammatical; it should read "removed from the cluster" rather than "removed from cluster".

To fix the grammar in this user-facing string, please add the article:

```tsx
{!isExist && <span>Table has been removed from the cluster</span>}
```

This keeps the meaning the same while correcting the English phrasing.

<details>
<summary>Review instructions:</summary>

**Path patterns:** `packages/ui/**/*.js,packages/ui/**/*.ts,packages/ui/**/*.tsx,packages/ui/**/*.jsx`

**Instructions:**
Do not pass grammatical issues

</details>
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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.

1 participant