Extract analytics-api module for JDK 21 downstream consumers#21574
Conversation
PR Code Analyzer ❗AI-powered 'Code-Diff-Analyzer' found issues on commit 34366be.
The table above displays the top 10 most important findings. Pull Requests Author(s): Please update your Pull Request according to the report above. Repository Maintainer(s): You can Thanks. |
Depends on: opensearch-project/OpenSearch#21574, which extracts QueryPlanExecutor and OpenSearchSchemaBuilder into a new org.opensearch.sandbox:analytics-api module targeting JDK 21. With analytics-api in place, sql can drop two workarounds added in the previous commit: 1. The component-metadata rule overriding org.gradle.jvm.version on analytics-framework / analytics-engine is no longer needed. sql now depends on analytics-api, which publishes jvm.version=21 natively, so variant selection matches without intervention. 2. The compileOnly dependency on analytics-engine is no longer needed. OpenSearchSchemaBuilder moved out of analytics-engine into analytics-api, and sql does not reference any other analytics-engine type. transitive = false is still set on the analytics-api declarations. The new module still advertises calcite-core:1.41.0-opensearch-1 as an api dependency (OpenSearchSchemaBuilder returns Calcite types), and sql wants to keep its vanilla calcite-core:1.41.0 on the compile classpath rather than resolving that transitive conflict. At runtime sql delegates to analytics-engine's classloader via extendedPlugins parent-first, where the ae-provided patched calcite wins — consistent with the previous commit's reasoning. Verification: - ./gradlew :core:compileJava :opensearch-sql-plugin:compileJava (BUILD SUCCESSFUL) - ./gradlew :opensearch-sql-plugin:jarHell (BUILD SUCCESSFUL) - Local analytics-api artifact sourced from mavenLocal off the OpenSearch PR branch. Signed-off-by: bowenlan-amzn <bowenlan23@gmail.com>
a2c0ec2 to
34366be
Compare
Creates sandbox/libs/analytics-api targeting JDK 21, containing only the
interface surface that downstream plugins (e.g. opensearch-sql) need to
compile against:
- org.opensearch.analytics.exec.QueryPlanExecutor (moved from analytics-framework)
- org.opensearch.analytics.schema.OpenSearchSchemaBuilder (moved from analytics-engine)
Motivation:
analytics-framework and analytics-engine use java.lang.foreign (FFM) APIs
that finalize only in JDK 22, so those modules must target JDK 25. Their
published Gradle Module Metadata declares org.gradle.jvm.version=25,
which blocks consumption from projects that target JVM 21 — most notably
opensearch-sql, which uses QueryPlanExecutor and OpenSearchSchemaBuilder
but does not touch FFM types.
Extracting these two interfaces into a JVM-21-targeted module unblocks
those consumers without forcing the whole sandbox to downgrade (FFM is
load-bearing for the engine).
Packages are unchanged (org.opensearch.analytics.{exec,schema}), so
existing imports in sandbox consumers (analytics-framework, analytics-engine,
dsl-query-executor, test-ppl-frontend) continue to resolve transitively
via the new `api project(':sandbox:libs:analytics-api')` edge in
analytics-framework/build.gradle.
thirdPartyAudit is disabled on analytics-api: it is a compile-time API
surface consumed transitively with the full Calcite runtime provided by
analytics-framework or analytics-engine, so there is no standalone runtime
where Calcite's optional references could load.
Verification:
- ./gradlew check -p sandbox -Dsandbox.enabled=true (full sandbox check: BUILD SUCCESSFUL)
- analytics-api jar bytecode is class version 65 (JDK 21) as expected.
- Published Gradle Module Metadata declares org.gradle.jvm.version=21.
- Downstream sql prototype compiles against the new artifact from mavenLocal.
Signed-off-by: bowenlan-amzn <bowenlan23@gmail.com>
34366be to
0833d01
Compare
PR Reviewer Guide 🔍(Review updated until commit 2a375f5)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 2a375f5
Previous suggestionsSuggestions up to commit 0833d01
|
Depends on: opensearch-project/OpenSearch#21574, which extracts QueryPlanExecutor and OpenSearchSchemaBuilder into a new org.opensearch.sandbox:analytics-api module targeting JDK 21. With analytics-api in place, sql can drop two workarounds added in the previous commit: 1. The component-metadata rule overriding org.gradle.jvm.version on analytics-framework / analytics-engine is no longer needed. sql now depends on analytics-api, which publishes jvm.version=21 natively, so variant selection matches without intervention. 2. The compileOnly dependency on analytics-engine is no longer needed. OpenSearchSchemaBuilder moved out of analytics-engine into analytics-api, and sql does not reference any other analytics-engine type. transitive = false is still set on the analytics-api declarations. The new module still advertises calcite-core:1.41.0-opensearch-1 as an api dependency (OpenSearchSchemaBuilder returns Calcite types), and sql wants to keep its vanilla calcite-core:1.41.0 on the compile classpath rather than resolving that transitive conflict. At runtime sql delegates to analytics-engine's classloader via extendedPlugins parent-first, where the ae-provided patched calcite wins — consistent with the previous commit's reasoning. Verification: - ./gradlew :core:compileJava :opensearch-sql-plugin:compileJava (BUILD SUCCESSFUL) - ./gradlew :opensearch-sql-plugin:jarHell (BUILD SUCCESSFUL) - Local analytics-api artifact sourced from mavenLocal off the OpenSearch PR branch. Signed-off-by: bowenlan-amzn <bowenlan23@gmail.com>
|
Persistent review updated to latest commit 2a375f5 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #21574 +/- ##
============================================
+ Coverage 73.45% 73.50% +0.05%
- Complexity 74591 74636 +45
============================================
Files 5980 5980
Lines 338779 338777 -2
Branches 48848 48848
============================================
+ Hits 248849 249030 +181
+ Misses 70079 69862 -217
- Partials 19851 19885 +34 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
What
Extract
sandbox/libs/analytics-api(JDK 21) holding just the interfaces downstream plugins compile against:org.opensearch.analytics.exec.QueryPlanExecutor— moved fromanalytics-frameworkorg.opensearch.analytics.schema.OpenSearchSchemaBuilder— moved fromanalytics-engineWhy
analytics-framework/analytics-enginetarget JDK 25 (they use FFM). Published Gradle metadata pinsjvm.version=25, which blocks JDK-21 consumers likeopensearch-sqlfrom depending on these modules — even thoughopensearch-sqlonly needs the two interfaces above, not FFM.A thin JDK-21 module unblocks those consumers without downgrading the engine.
Design
analytics-apideclares Calcite ascompileOnly. The types appear in its public signatures, but the module never loads standalone — consumers bring their own Calcite.analytics-apiexplicitly (compileOnlyin sandbox plugins,implementationinanalytics-engine). No transitiveapire-exports.Verification
./gradlew check -p sandbox -Dsandbox.enabled=true— BUILD SUCCESSFUL.jvm.version: 21.opensearch-sqlPR compiles against the artifact frommavenLocaland passesjarHell. Switch sandbox deps to analytics-api (JDK 21 surface) sql#5426Check List