Skip to content

Fixes for upcoming dbplyr 2.6.0 release#334

Open
hadley wants to merge 2 commits intoprestodb:masterfrom
hadley:dbplyr-2.6.0
Open

Fixes for upcoming dbplyr 2.6.0 release#334
hadley wants to merge 2 commits intoprestodb:masterfrom
hadley:dbplyr-2.6.0

Conversation

@hadley
Copy link
Contributor

@hadley hadley commented Feb 17, 2026

Along with changes in tidyverse/dbplyr#1807

I'd really appreciate it if you could run your live tests too, just to make sure I haven't messed up anything else.

@sourcery-ai
Copy link

sourcery-ai bot commented Feb 17, 2026

Reviewer's Guide

Updates Presto dbplyr integration to align with dbplyr 2.6.0 API changes by replacing deprecated helpers, adjusting SQL wrapping for field discovery, updating compute.tbl_presto table construction, and modernizing test expectations and helper usage.

Sequence diagram for updated sql_query_fields.PrestoConnection SQL wrapping

sequenceDiagram
    participant PrestoConnection
    participant sql_query_fields_PrestoConnection
    participant dbplyr

    PrestoConnection->>sql_query_fields_PrestoConnection: sql_query_fields(con, sql)
    sql_query_fields_PrestoConnection->>dbplyr: sql_query_wrap(con, sql)
    dbplyr-->>sql_query_fields_PrestoConnection: wrapped_sql
    sql_query_fields_PrestoConnection->>dbplyr: build_sql("SELECT * FROM ", wrapped_sql, " WHERE 1 = 0", con = con)
    dbplyr-->>sql_query_fields_PrestoConnection: sql_query
    sql_query_fields_PrestoConnection-->>PrestoConnection: sql_query
Loading

Flow diagram for updated compute.tbl_presto pipeline

flowchart TD
    A["compute.tbl_presto called with tbl_presto x"] --> B["Resolve name and temporary flags"]
    B --> C["Call dbplyr::remote_con(x)"]
    C --> D["Construct dplyr::tbl(remote_con, from = name, vars = colnames(x))"]
    D --> E["Apply dplyr::group_by with dbplyr::op_grps(x)"]
    E --> F["Apply dbplyr::window_order with dbplyr::op_sort(x)"]
    F --> G["Return grouped and ordered remote table"]
Loading

File-Level Changes

Change Details Files
Introduce a local db_query_fields helper and update tests to use dbplyr::sql_query_wrap instead of dplyr::sql_subquery for field discovery.
  • Define a db_query_fields(con, sql, ...) helper that builds the SQL via sql_query_fields() and retrieves column names with DBI::dbGetQuery().
  • Replace test usages of dplyr::db_query_fields() with the new db_query_fields() helper in live and mock tests.
  • Replace dplyr::sql_subquery() with dbplyr::sql_query_wrap() when wrapping SELECT queries under test.
tests/testthat/test-db_query_fields.R
Align Presto sql_query_fields() implementation with dbplyr’s new SQL wrapping helper.
  • Change sql_query_fields.PrestoConnection() to call dbplyr::sql_query_wrap(con, sql) instead of dplyr::sql_subquery(con, sql) when constructing the SELECT * FROM ... WHERE 1 = 0 query.
R/dbplyr-sql.R
Update compute.tbl_presto to construct tbls using the remote connection instead of the remote src, matching the latest dbplyr/dplyr API.
  • Change dplyr::tbl() call in compute.tbl_presto() to pass dbplyr::remote_con(x) as the first argument instead of src = dbplyr::remote_src(x).
  • Keep downstream grouping and windowing logic unchanged (group_by and window_order).
R/dbplyr-src.R
Modernize tests to use current testthat and dbplyr/dplyr idioms.
  • Replace deprecated expect_is(..., 'tbl_presto') with expect_s3_class(..., 'tbl_presto') in multiple compute() retry tests.
  • Update translate_sql tests to use dbplyr::sql_query_wrap() instead of dplyr::sql_subquery() when constructing subqueries for dplyr::tbl().
tests/testthat/test-dbplyr-src.R
tests/testthat/test-translate_sql.R

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

@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:

  • The change from dplyr::tbl(src = dbplyr::remote_src(x), ...) to dplyr::tbl(dbplyr::remote_con(x), ...) alters the expected type of the first argument (src vs. connection); consider either guarding this with a dplyr/dbplyr version check or adding a brief comment explaining why this is safe across supported versions.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The change from `dplyr::tbl(src = dbplyr::remote_src(x), ...)` to `dplyr::tbl(dbplyr::remote_con(x), ...)` alters the expected type of the first argument (src vs. connection); consider either guarding this with a dplyr/dbplyr version check or adding a brief comment explaining why this is safe across supported versions.

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.

@hadley hadley mentioned this pull request Feb 17, 2026
16 tasks
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