Skip to content

test: Add test for querying iceberg branch#27268

Merged
agrawalreetika merged 1 commit intoprestodb:masterfrom
agrawalreetika:iceberg-branch-test
Mar 6, 2026
Merged

test: Add test for querying iceberg branch#27268
agrawalreetika merged 1 commit intoprestodb:masterfrom
agrawalreetika:iceberg-branch-test

Conversation

@agrawalreetika
Copy link
Copy Markdown
Member

@agrawalreetika agrawalreetika commented Mar 5, 2026

Description

Add test for querying the iceberg branch

Motivation and Context

Add test for querying the iceberg branch

Impact

Add test for querying the iceberg branch

Test Plan

Test Added

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.
  • If adding new dependencies, verified they have an OpenSSF Scorecard score of 5.0 or higher (or obtained explicit TSC approval for lower scores).

Release Notes

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

== NO RELEASE NOTE ==

Summary by Sourcery

Tests:

  • Add an Iceberg integration test that verifies querying a branch via FOR SYSTEM_VERSION AS OF and dot-notation syntaxes and compares results with the main table.

@agrawalreetika agrawalreetika self-assigned this Mar 5, 2026
@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Mar 5, 2026
@prestodb-ci prestodb-ci requested review from a team, Dilli-Babu-Godari and ShahimSharafudeen and removed request for a team March 5, 2026 15:15
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Mar 5, 2026

Reviewer's Guide

Adds a new Iceberg connector integration test to validate querying table branches via both FOR SYSTEM_VERSION AS OF and dot-notation syntaxes for branches, and touches the Iceberg connector documentation file (no visible content changes in the provided diff).

File-Level Changes

Change Details Files
Add distributed Iceberg test covering querying branch snapshots via FOR SYSTEM_VERSION AS OF and dot-notation syntaxes, ensuring consistency between them and correctness of branch vs main table data.
  • Create test table and insert initial rows, then create an Iceberg branch on the table using the snapshot management API
  • Insert additional rows after branching to diverge main table from the branch snapshot
  • Assert row counts when querying the branch and main via FOR SYSTEM_VERSION AS OF syntax, validating snapshot isolation by branch name
  • Assert row counts and row contents when querying the branch via quoted dot-notation table name
  • Compare MaterializedResult outputs from FOR SYSTEM_VERSION and dot-notation queries to ensure both syntaxes return identical results
  • Verify that the main table sees all inserted rows and that the table is dropped at the end of the test
presto-iceberg/src/test/java/com/facebook/presto/iceberg/IcebergDistributedTestBase.java
Touch Iceberg connector documentation source file (no concrete change shown in the provided diff).
  • Iceberg connector Sphinx documentation file is modified or at least part of the commit, but the specific content changes are not present in the snippet
presto-docs/src/main/sphinx/connector/iceberg.rst

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

@agrawalreetika agrawalreetika changed the title testing: Add test for querying iceberg branch test: Add test for querying iceberg branch Mar 5, 2026
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 found 1 issue, and left some high level feedback:

  • Consider wrapping the table creation and test body in a try/finally (or equivalent cleanup mechanism) so that the test table is reliably dropped even if an assertion fails, preventing state leakage across tests.
  • The dot-notation reference "test_branch_dot_notation.branch_audit_branch" encodes a specific naming convention (branch_ + branchName); it would be safer to either derive this from a single constant/utility or add a short comment explaining the expected mapping so future connector changes don’t silently break the test.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider wrapping the table creation and test body in a try/finally (or equivalent cleanup mechanism) so that the test table is reliably dropped even if an assertion fails, preventing state leakage across tests.
- The dot-notation reference "test_branch_dot_notation.branch_audit_branch" encodes a specific naming convention (branch_ + branchName); it would be safer to either derive this from a single constant/utility or add a short comment explaining the expected mapping so future connector changes don’t silently break the test.

## Individual Comments

### Comment 1
<location path="presto-docs/src/main/sphinx/connector/iceberg.rst" line_range="2227" />
<code_context>
 Iceberg supports branches and tags which are named references to snapshots.

-Query Iceberg table by specifying the branch name:
+Query Iceberg table by specifying the branch name using ``FOR SYSTEM_VERSION AS OF``:

 .. code-block:: sql
</code_context>
<issue_to_address>
**suggestion (typo):** Consider adding an article for grammatical correctness ("Query an Iceberg table").

Suggested wording: `Query an Iceberg table by specifying the branch name using FOR SYSTEM_VERSION AS OF:`

```suggestion
Query an Iceberg table by specifying the branch name using ``FOR SYSTEM_VERSION AS OF``:
```
</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.

Iceberg supports branches and tags which are named references to snapshots.

Query Iceberg table by specifying the branch name:
Query Iceberg table by specifying the branch name using ``FOR SYSTEM_VERSION AS OF``:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion (typo): Consider adding an article for grammatical correctness ("Query an Iceberg table").

Suggested wording: Query an Iceberg table by specifying the branch name using FOR SYSTEM_VERSION AS OF:

Suggested change
Query Iceberg table by specifying the branch name using ``FOR SYSTEM_VERSION AS OF``:
Query an Iceberg table by specifying the branch name using ``FOR SYSTEM_VERSION AS OF``:

Copy link
Copy Markdown
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

LGTM! (docs)

Pull branch, local doc build, looks good. Thanks!

Copy link
Copy Markdown
Member

@hantangwangd hantangwangd left a comment

Choose a reason for hiding this comment

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

@agrawalreetika agrawalreetika merged commit 530823e into prestodb:master Mar 6, 2026
84 of 91 checks passed
@agrawalreetika agrawalreetika deleted the iceberg-branch-test branch March 6, 2026 05:42
garimauttam pushed a commit to garimauttam/presto that referenced this pull request Mar 9, 2026
## Description
Add test for querying the iceberg branch

## Motivation and Context
Add test for querying the iceberg branch

## Impact
Add test for querying the iceberg branch

## Test Plan
Test Added

## Contributor checklist

- [ ] Please make sure your submission complies with our [contributing
guide](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md),
in particular [code
style](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#code-style)
and [commit
standards](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#commit-standards).
- [ ] PR description addresses the issue accurately and concisely. If
the change is non-trivial, a GitHub Issue is referenced.
- [ ] Documented new properties (with its default value), SQL syntax,
functions, or other functionality.
- [ ] If release notes are required, they follow the [release notes
guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines).
- [ ] Adequate tests were added if applicable.
- [ ] CI passed.
- [ ] If adding new dependencies, verified they have an [OpenSSF
Scorecard](https://securityscorecards.dev/#the-checks) score of 5.0 or
higher (or obtained explicit TSC approval for lower scores).

## Release Notes
Please follow [release notes
guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines)
and fill in the release notes below.

```
== NO RELEASE NOTE ==
```

## Summary by Sourcery

Tests:
- Add an Iceberg integration test that verifies querying a branch via
FOR SYSTEM_VERSION AS OF and dot-notation syntaxes and compares results
with the main table.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants