Jesshuan opened a new pull request, #11302:
URL: https://github.com/apache/gravitino/pull/11302

   ### What changes were proposed in this pull request?
   
   This PR makes the Gravitino Trino connector build cleanly across both 
open-source Trino and Starburst SPI variants, and documents how a user can 
build it against a Starburst SPI, for his private usage (because Starburst is a 
commercial and private product).
   This PR is the result of a little discussion about this idea at [#10905].
   
   - GravitinoConnectorFactory: a little agnostic change into the declaration 
inside the checkTrinoSpiVersion method. The numeric version is still parsed 
with spiVersion.split("[^0-9]")[0], so non-numeric Starburst version strings 
(e.g. 476-e.0.26) are handled.
   
   - **GravitinoDynamicFilter**: add the getPreferredDynamicFilterTimeout() 
method with an optionalLong empty as return. That method is absent from the 
baseline open-source trino-spi DynamicFilter interface but present in newer 
Trino/Starburst SPIs, where it is still dispatched at runtime by signature. A 
comment documents why @Override is intentionally omitted, to prevent a failure 
at build time for trino SPI users.
   
   - **JsonCodec**: the previous implementation assumed a no-arg public 
constructor for BlockEncodingManager, which broke compatibility with Starburst 
distributions (which require a FeaturesConfig argument) and newer Trino 
branches (which expose a Set<BlockEncoding> variant for Guice multibindings).
   This change introduces a dedicated instantiateBlockEncodingManager helper 
that probes known constructor signatures in order — no-arg, then 
FeaturesConfig, then Set<BlockEncoding> — before falling back to a generic 
reflective scan that attempts to fill unknown parameters with safe defaults 
(null for objects, JVM defaults for primitives).
   This makes the Trino connector resilient to constructor signature 
differences across OSS Trino and Starburst versions without requiring 
version-specific code paths.
   
   **Docs** : add docs/trino-connector/starburst-compatibility.md (with a link 
from docs/trino-connector/index.md) describing, for indication only, how to 
build the connector against a Starburst SPI jar, including the licensing 
rationale and caveats.
   
   ### Why are the changes needed?
   
   These changes keep the shared source cross-version compatible, to allow to 
the Starburst users to benefit and (eventually) maintain an alternative 
trino-connector adapted and built for a specific Starburst/Trino SPI version, 
without any code changes, but just with little changes during the 
trino-connector build time of the gravitino project.
   The new doc page explains the Starburst build path for the TrinoStarburst 
users which the project cannot ship itself because the Starburst trino-spi jar 
is a proprietary, non-redistributable artifact.
   
   Fix: [#10905]
   
   ### Does this PR introduce _any_ user-facing change?
   
   No API or property-key changes. The only user-facing addition is a new 
documentation page, [Starburst 
compatibility](vscode-webview://07991g9jc13v4i7rtg7544n4okvc96gfo7q714pqcv6rf2b24682/docs/trino-connector/starburst-compatibility.md),
 linked from the Trino connector docs index.
   
   ### How was this patch tested?
   
   Built locally with JDK 17: JAVA_HOME=/opt/jdk-17 ./gradlew 
:trino-connector:trino-connector:compileJava succeeds with no errors.
   ./gradlew :trino-connector:trino-connector:spotlessApply is clean.
   ./gradlew :docs:build (OpenAPI validation) passes.
   and manually verified the documented Starburst build path for one 
Starburst-based Trino version in the 473–478 range.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to