Skip to content

feat(client): Log "Running <query_id>..." in Presto cli in non-interactive mode#27359

Merged
spershin merged 1 commit intoprestodb:masterfrom
spershin:export-D96955453
Mar 18, 2026
Merged

feat(client): Log "Running <query_id>..." in Presto cli in non-interactive mode#27359
spershin merged 1 commit intoprestodb:masterfrom
spershin:export-D96955453

Conversation

@spershin
Copy link
Copy Markdown
Contributor

@spershin spershin commented Mar 17, 2026

Summary:
It is frustrating not to know the query ID, when yopu running a query
from a file or an SQL statement.
This fixes it.

Differential Revision: D96955453

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== NO RELEASE NOTE ==

Summary by Sourcery

Enhancements:

  • Add a non-interactive mode message that prints the current query ID before processing status updates.

Summary:
It is frustrating not to know the query ID, when yopu running a query
from a file or an SQL statement.
This fixes it.

Differential Revision: D96955453
@spershin spershin requested a review from a team as a code owner March 17, 2026 18:19
@prestodb-ci prestodb-ci added the from:Meta PR from Meta label Mar 17, 2026
@linux-foundation-easycla
Copy link
Copy Markdown

CLA Missing ID CLA Not Signed

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Mar 17, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Logs the query ID to the error channel when Presto CLI is running in non-interactive mode so users can see which query is executing.

Sequence diagram for logging query ID in Presto CLI non-interactive mode

sequenceDiagram
    actor User
    participant PrestoCli
    participant Query
    participant StatusPrinter
    participant ErrorChannel
    participant QueryStatusInfo

    User->>PrestoCli: runCliWithSqlOrFile()
    PrestoCli->>Query: renderQueryOutput(out, outputFormat, interactive = false)

    alt non_interactive_mode
        Query->>Query: currentStatusInfo()
        Query->>QueryStatusInfo: getId()
        QueryStatusInfo-->>Query: queryId
        Query->>ErrorChannel: printf(Running %s ..., queryId)
        Query->>StatusPrinter: processInitialStatusUpdates(warningsPrinter)
    else interactive_mode
        Query->>StatusPrinter: printInitialStatusUpdates()
    end

    StatusPrinter-->>PrestoCli: initial status rendered
    PrestoCli-->>User: stdout results, stderr shows Running queryId ...
Loading

File-Level Changes

Change Details Files
Log the current query ID when running in non-interactive mode.
  • In the non-interactive branch of renderQueryOutput, print a message to the error channel indicating the running query ID before processing initial status updates
  • Use client.currentStatusInfo().getId() to obtain and interpolate the query ID in the log message
presto-cli/src/main/java/com/facebook/presto/cli/Query.java

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

Copy link
Copy Markdown
Contributor

@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 left some high level feedback:

  • Consider guarding the client.currentStatusInfo().getId() call (or reusing an existing status object) to avoid potential null/empty IDs or additional RPCs at this early point in non-interactive execution.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider guarding the `client.currentStatusInfo().getId()` call (or reusing an existing status object) to avoid potential null/empty IDs or additional RPCs at this early point in non-interactive execution.

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.

@spershin spershin changed the title Log "Running <query_id>..." in Presto cli in non-interactive mode. feat : Log "Running <query_id>..." in Presto cli in non-interactive mode. Mar 17, 2026
@spershin spershin changed the title feat : Log "Running <query_id>..." in Presto cli in non-interactive mode. feat : Log "Running <query_id>..." in Presto cli in non-interactive mode Mar 17, 2026
@spershin spershin changed the title feat : Log "Running <query_id>..." in Presto cli in non-interactive mode feat(cli): Log "Running <query_id>..." in Presto cli in non-interactive mode Mar 17, 2026
@spershin spershin changed the title feat(cli): Log "Running <query_id>..." in Presto cli in non-interactive mode feat(client): Log "Running <query_id>..." in Presto cli in non-interactive mode Mar 17, 2026
@spershin spershin requested a review from arhimondr March 17, 2026 22:18
Copy link
Copy Markdown
Member

@skyelves skyelves left a comment

Choose a reason for hiding this comment

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

LGTM

@spershin spershin merged commit f6f7cfd into prestodb:master Mar 18, 2026
85 of 95 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants