[Cherry-pick to branch-1.3] [#12526] feat(trino-connector): Support Starburst SPI compatibility (#12527) - #12699
Merged
jerryshao merged 1 commit intoAug 28, 2026
Conversation
…lity (apache#12527) ### What changes were proposed in this pull request? Add compatibility handling for Starburst SPI variants in the Trino connector, including `BlockEncodingManager` instantiation, SPI version parsing, and newer DynamicFilter/ConnectorFactory SPI methods. ### Why are the changes needed? Starburst SPI differs from baseline open-source Trino in several interfaces and internal constructor signatures. Without these compatibility methods, the Gravitino connector may fail to load or execute on Starburst. Fix: apache#12526 ### Does this PR introduce any user-facing change? The Gravitino Trino connector can run with compatible Starburst SPI distributions. No new configuration or public Gravitino API is introduced. ### How was this patch tested? ```text ./gradlew spotlessApply ./gradlew :trino-connector:trino-connector:test -PskipITs ``` Both commands completed successfully. (cherry picked from commit 7e26ce9)
Contributor
There was a problem hiding this comment.
Pull request overview
This cherry-pick improves cross-compatibility of the Gravitino Trino connector with Starburst / newer Trino SPI variants by adding reflective fallbacks for SPI shape differences (constructors + optional methods) and hardening SPI version parsing, with accompanying unit tests.
Changes:
- Add a compatibility instantiation path for
io.trino.metadata.BlockEncodingManageracross multiple constructor signatures. - Add SPI-version parsing that accepts vendor-suffixed versions and add
getSecuritySensitivePropertyNames(...)for newer SPI compatibility. - Add reflective forwarding for
DynamicFilter#getPreferredDynamicFilterTimeout()and introduce tests for the new behaviors.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| trino-connector/trino-connector/src/main/java/org/apache/gravitino/trino/connector/util/json/JsonCodec.java | Adds reflective BlockEncodingManager instantiation logic to support multiple Trino/Starburst constructor variants. |
| trino-connector/trino-connector/src/main/java/org/apache/gravitino/trino/connector/GravitinoConnectorFactory.java | Adds vendor-tolerant SPI version parsing and getSecuritySensitivePropertyNames for newer SPI contracts. |
| trino-connector/trino-connector/src/main/java/org/apache/gravitino/trino/connector/GravitinoDynamicFilter.java | Adds reflective forwarding for getPreferredDynamicFilterTimeout() when present at runtime. |
| trino-connector/trino-connector/src/test/java/org/apache/gravitino/trino/connector/util/json/TestJsonCodec.java | New unit tests for constructor-probing behavior in JsonCodec. |
| trino-connector/trino-connector/src/test/java/org/apache/gravitino/trino/connector/TestGravitinoConnectorFactory.java | New unit tests for sensitive-property detection and SPI version parsing. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| class TestJsonCodec { | ||
|
|
||
| static class NoArgManager {} |
Comment on lines
+78
to
+81
| Object instance = | ||
| JsonCodec.instantiateBlockEncodingManager(FeaturesConfigManager.class, CLASS_LOADER); | ||
| assertThat(instance).isInstanceOfSatisfying(FeaturesConfigManager.class, m -> {}); | ||
| } |
Comment on lines
+145
to
+163
| try { | ||
| Class<?> featuresConfigClass = classLoader.loadClass("io.trino.FeaturesConfig"); | ||
| Constructor<?> ctor = blockEncodingManagerClass.getConstructor(featuresConfigClass); | ||
| Object featuresConfig = featuresConfigClass.getConstructor().newInstance(); | ||
| Object instance = ctor.newInstance(featuresConfig); | ||
| LOG.debug("Instantiated BlockEncodingManager with FeaturesConfig"); | ||
| return instance; | ||
| } catch (NoSuchMethodException | ClassNotFoundException ignored) { | ||
| // fall through | ||
| } | ||
|
|
||
| try { | ||
| Constructor<?> setCtor = blockEncodingManagerClass.getConstructor(Set.class); | ||
| Object instance = setCtor.newInstance(Collections.emptySet()); | ||
| LOG.debug("Instantiated BlockEncodingManager with an empty BlockEncoding set"); | ||
| return instance; | ||
| } catch (NoSuchMethodException ignored) { | ||
| // fall through to last-resort scan | ||
| } |
Code Coverage Report
Files
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-pick Information:
branch-1.3