Skip to content

[#9414] feat (trino-connector) Add support for querying iceberg metadata tables#9415

Merged
diqiu50 merged 4 commits intoapache:mainfrom
josephperez3:trino-connector-iceberg-metadata
Dec 12, 2025
Merged

[#9414] feat (trino-connector) Add support for querying iceberg metadata tables#9415
diqiu50 merged 4 commits intoapache:mainfrom
josephperez3:trino-connector-iceberg-metadata

Conversation

@josephperez3
Copy link
Contributor

What changes were proposed in this pull request?

Added getSystemTable() override in GravitinoMetadata to delegate system table lookups to internal connector. This enables querying Iceberg metadata tables like $snapshots and $manifests, with trino connector.

Why are the changes needed?

For a bug fix - as of right now iceberg metadata tables are not queryable with the gravitino trino connector.

Fix: #9414

Does this PR introduce any user-facing change?

Yes, users will now be able to query iceberg metatables.

How was this patch tested?

Without fix, unit test fails:

TestGravitinoMetadataGetSystemTable > testGetSystemTableDelegatesToInternalMetadata() FAILED
    org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
        at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
        at app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
        at app//org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
        at app//org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
        at app//org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:31)
        at app//org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:179)
        at app//org.apache.gravitino.trino.connector.TestGravitinoMetadataGetSystemTable.testGetSystemTableDelegatesToInternalMetadata(TestGravitinoMetadataGetSystemTable.java:58)

Also, made a targz of the change with ./gradlew assembleTrinoConnector and added trino deployment, then querying snapshots worked.

@roryqi roryqi requested a review from diqiu50 December 9, 2025 03:08
@hqbhoho
Copy link
Contributor

hqbhoho commented Dec 10, 2025

@diqiu50
Copy link
Contributor

diqiu50 commented Dec 10, 2025

SQL-level tests and distributed-environment tests are required.

@josephperez3
Copy link
Contributor Author

Just added a SQL integration test, can you help with re-running the workflow to check?

Copy link
Contributor

@diqiu50 diqiu50 left a comment

Choose a reason for hiding this comment

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

LGTM

@diqiu50 diqiu50 merged commit 181cee3 into apache:main Dec 12, 2025
23 checks passed
@diqiu50 diqiu50 changed the title [#9414] fix(trino-connector) Add support for querying iceberg metadata tables [#9414] feat (trino-connector) Add support for querying iceberg metadata tables Dec 12, 2025
yuqi1129 pushed a commit that referenced this pull request Feb 6, 2026
…a tables (#9415)

<!--
1. Title: [#<issue>] <type>(<scope>): <subject>
   Examples:
     - "[#123] feat(operator): support xxx"
     - "[#233] fix: check null before access result in xxx"
     - "[MINOR] refactor: fix typo in variable name"
     - "[MINOR] docs: fix typo in README"
     - "[#255] test: fix flaky test NameOfTheTest"
   Reference: https://www.conventionalcommits.org/en/v1.0.0/
2. If the PR is unfinished, please mark this PR as draft.
-->

### What changes were proposed in this pull request?

Added `getSystemTable()` override in `GravitinoMetadata` to delegate
system table lookups to internal connector. This enables querying
Iceberg metadata tables like `$snapshots` and `$manifests`, with trino
connector.

### Why are the changes needed?

For a bug fix - as of right now iceberg metadata tables are not
queryable with the gravitino trino connector.

Fix: #9414

### Does this PR introduce _any_ user-facing change?

Yes, users will now be able to query iceberg metatables.

### How was this patch tested?

Without fix, unit test fails:
```
TestGravitinoMetadataGetSystemTable > testGetSystemTableDelegatesToInternalMetadata() FAILED
    org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
        at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
        at app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
        at app//org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
        at app//org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
        at app//org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:31)
        at app//org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:179)
        at app//org.apache.gravitino.trino.connector.TestGravitinoMetadataGetSystemTable.testGetSystemTableDelegatesToInternalMetadata(TestGravitinoMetadataGetSystemTable.java:58)
```

Also, made a targz of the change with ```./gradlew
assembleTrinoConnector ``` and added trino deployment, then querying
snapshots worked.

---------

Co-authored-by: Yuhui <hui@datastrato.com>
FANNG1 pushed a commit to FANNG1/gravitino that referenced this pull request Mar 6, 2026
…etadata tables (apache#9415)

<!--
1. Title: [#<issue>] <type>(<scope>): <subject>
   Examples:
     - "[apache#123] feat(operator): support xxx"
     - "[apache#233] fix: check null before access result in xxx"
     - "[MINOR] refactor: fix typo in variable name"
     - "[MINOR] docs: fix typo in README"
     - "[apache#255] test: fix flaky test NameOfTheTest"
   Reference: https://www.conventionalcommits.org/en/v1.0.0/
2. If the PR is unfinished, please mark this PR as draft.
-->

### What changes were proposed in this pull request?

Added `getSystemTable()` override in `GravitinoMetadata` to delegate
system table lookups to internal connector. This enables querying
Iceberg metadata tables like `$snapshots` and `$manifests`, with trino
connector.

### Why are the changes needed?

For a bug fix - as of right now iceberg metadata tables are not
queryable with the gravitino trino connector.

Fix: apache#9414

### Does this PR introduce _any_ user-facing change?

Yes, users will now be able to query iceberg metatables.

### How was this patch tested?

Without fix, unit test fails:
```
TestGravitinoMetadataGetSystemTable > testGetSystemTableDelegatesToInternalMetadata() FAILED
    org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
        at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
        at app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
        at app//org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
        at app//org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
        at app//org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:31)
        at app//org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:179)
        at app//org.apache.gravitino.trino.connector.TestGravitinoMetadataGetSystemTable.testGetSystemTableDelegatesToInternalMetadata(TestGravitinoMetadataGetSystemTable.java:58)
```

Also, made a targz of the change with ```./gradlew
assembleTrinoConnector ``` and added trino deployment, then querying
snapshots worked.

---------

Co-authored-by: Yuhui <hui@datastrato.com>
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.

[Feature] Trino connector support Iceberg metadata tables ($snapshots, $history, etc...)

3 participants