Resolve analytics-engine/framework from remote, drop vendored libs/#5425
Resolve analytics-engine/framework from remote, drop vendored libs/#5425ahkcs wants to merge 1 commit into
Conversation
PR Code Analyzer ❗AI-powered 'Code-Diff-Analyzer' found issues on commit 17d5014.
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. |
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| java: [21, 25] |
There was a problem hiding this comment.
do we have other bwc tests then?
RyanL1997
left a comment
There was a problem hiding this comment.
https://github.com/opensearch-project/sql/actions/runs/25582284285/workflow?pr=5425#L111 we shoud not drop the BWC for the entire build.
Replaces three vendored binaries under libs/ with build-time downloads:
- analytics-framework / analytics-engine jars: maven coordinates against the
OpenSearch CI snapshot repo (org.opensearch.sandbox:*). Already declared
as a subproject repository.
- analytics-engine + arrow-flight-rpc plugin zips: the snapshot maven repo
doesn't publish plugin distribution zips, so two new root tasks
(:downloadAnalyticsEngineZip, :downloadArrowFlightRpcZip) fetch them from
the feature-build artifact URL via de.undercouch.download (the same plugin
integ-test/doctest already use). Output lands in
${rootProject.buildDir}/distributions/. The existing analyticsEngineZip
ext property points at the downloaded path; -PanalyticsEngineZip=/path
and -ParrowFlightRpcZip=/path overrides still work and skip the download.
Test cluster setup in plugin/, integ-test/, doctest/ now installs
arrow-flight-rpc *before* analytics-engine — the latter declares the former
as an extendedPlugins parent, so OpenSearch's plugin install fails with
"Missing plugin [arrow-flight-rpc], dependency of [analytics-engine]"
otherwise. All RestIntegTestTask / StandaloneRestIntegTestTask / RunTask
consumers dependsOn both download tasks.
Two Gradle-side blockers handled to make remote consumption work without a
JDK source/target bump:
1. JVM variant mismatch
AF/AE publish Gradle Module Metadata declaring jvm.version=25 because
the sandbox uses the FFM API (finalized in JDK 22). sql targets JVM 21,
so Gradle's variant matcher would refuse them. componentMetadataRules
in subprojects rewrite TARGET_JVM_VERSION to 21 for these two modules
only. Safe because: (a) sql code references only non-FFM interfaces of
AF, (b) production runtime is JVM 25 nodes where the actual JDK 25
bytecode runs fine, (c) rule is scoped to org.opensearch.sandbox:*.
2. Calcite version conflict
AF transitively pulls calcite-core:1.41.0-opensearch-1 (patched fork);
sql declares vanilla calcite-core:1.41.0. transitive = false on the
AF/AE dependency declarations cuts the patched calcite out of sql's
classpath. At runtime, sql's classloader delegates to AE's via
`extendedPlugins = ['analytics-engine;optional=true']` parent-first,
so AE's bundled patched-calcite wins; sql's vanilla copy sits idle.
mavenLocal { excludeGroup 'org.opensearch.sandbox' }: a locally-published
OpenSearch core build can install these artifacts with Gradle Module
Metadata declaring different attributes than the published snapshot, which
can shadow the remote and break resolution. Sandbox artifacts always come
from the CI snapshot repo.
Verified locally under JDK 25 (Temurin 25.0.1+8):
- ./gradlew :core:compileJava ✓
- ./gradlew :opensearch-sql-plugin:compileJava ✓
- ./gradlew --continue build -x integTest -x yamlRestTest -x doctest ✓
- ./gradlew :downloadAnalyticsEngineZip ✓
- ./gradlew :downloadArrowFlightRpcZip ✓
- :downloadAnalyticsEngineZip -PanalyticsEngineZip=/path skips ✓
Known: JDK 21 CI legs will fail with "class file has wrong version 69.0,
should be 65.0" — javac 21 cannot read JDK 25 bytecode, regardless of
Gradle-level overrides. Will be resolved when analytics-engine graduates
from sandbox (publishing JDK 21 bytecode again) or when SQL plugin's
MIN compat moves to JDK 25 ecosystem-wide. Iteration over perfection.
Signed-off-by: Kai Huang <ahkcs@amazon.com>
f0d1d16 to
17d5014
Compare
Summary
Replaces three vendored binaries under
libs/with build-time downloads from the OpenSearch CI snapshot repo (jars) and feature-build artifact URL (zips). No source compatibility changes; surgical Gradle features handle the JVM-version and Calcite-version skew between sql (JVM 21 / vanilla Calcite) and the sandbox publish (JVM 25 / patched Calcite).libs/analytics-framework-3.7.0-SNAPSHOT.jarorg.opensearch.sandbox:analytics-framework:3.7.0-SNAPSHOT(CI snapshot repo, already declared)libs/analytics-engine-3.7.0-SNAPSHOT.jarorg.opensearch.sandbox:analytics-engine:3.7.0-SNAPSHOTlibs/analytics-engine-3.7.0-SNAPSHOT.zip:downloadAnalyticsEngineZip(de.undercouch.download) →${rootProject.buildDir}/distributions/analytics-engine-3.7.0-SNAPSHOT.ziparrow-flight-rpc.zip:downloadArrowFlightRpcZip→${rootProject.buildDir}/distributions/arrow-flight-rpc-3.7.0-SNAPSHOT.zipExisting
analyticsEngineZipand newarrowFlightRpcZipext properties default to the downloaded paths;-PanalyticsEngineZip=/path/-ParrowFlightRpcZip=/pathoverrides still work and skip the download. AllRestIntegTestTask/StandaloneRestIntegTestTask/RunTaskconsumersdependsOnboth download tasks.Two Gradle blockers solved without a JDK bump
1. JVM variant mismatch —
componentMetadataRulesAF/AE publish Gradle Module Metadata declaring
org.gradle.jvm.version=25(the sandbox uses FFM API, finalized in JDK 22). sql targets JVM 21, so Gradle's variant matcher would refuse them. AcomponentMetadataRulesblock insubprojectsrewritesTARGET_JVM_VERSIONto 21 fororg.opensearch.sandbox:*only:Safe because: sql code references only non-FFM interfaces of AF (
QueryPlanExecutor,SchemaProvider, etc.); production runtime is JVM 25 nodes where the actual JDK 25 bytecode runs fine; rule is scoped to a two-module group — no effect on any other dependency.2. Calcite version conflict —
transitive = falseAF transitively pulls
calcite-core:1.41.0-opensearch-1(patched fork). sql declares vanillacalcite-core:1.41.0.transitive = falseon the AF/AE dependency declarations cuts the patched calcite out of sql's compile classpath. At runtime, sql's classloader delegates to AE's viaextendedPlugins = ['analytics-engine;optional=true']parent-first delegation, so AE's bundled patched calcite wins; sql's vanilla copy sits idle.Test cluster wiring: install arrow-flight-rpc first
The remote
analytics-engine.zipdeclaresarrow-flight-rpcas anextendedPluginsparent. Without this PR's wiring, the cluster install fails with:plugin/build.gradle,integ-test/build.gradleanddoctest/build.gradlenow installarrow-flight-rpcimmediately beforeanalytics-enginein every test-cluster definition.mavenLocalsandbox exclusionmavenLocal { content { excludeGroup 'org.opensearch.sandbox' } }A locally-published OpenSearch core build can install these artifacts into
~/.m2/repositorywith Gradle Module Metadata declaring different attributes than the published snapshot, which can shadow the remote and break resolution. Sandbox artifacts always come from the CI snapshot repo.Verified locally (JDK 25 / Temurin 25.0.1+8)
./gradlew :core:compileJava./gradlew :opensearch-sql-plugin:compileJava./gradlew --continue build -x integTest -x yamlRestTest -x doctest— full unit-test build./gradlew :downloadAnalyticsEngineZip --rerun-tasks→ 16.7 MB zip./gradlew :downloadArrowFlightRpcZip --rerun-tasks→ 13.3 MB zip-PanalyticsEngineZip=/local/pathcorrectly skips the downloadKnown limitation: JDK 21 CI legs will fail
The variant override gets past Gradle's resolver, but javac 21 still can't read JDK 25 bytecode:
This is a hard JDK limit; no Gradle trick fixes it. The JDK 21 leg of CI will fail on
:core:compileJava. Same limitation as #5426 (similar approach by @bowenlan-amzn). Resolves naturally when either:Iteration over perfection — landing the libs→remote migration now unblocks the day-to-day "vendored zip drifts every snapshot" pain even while the JDK 21 CI gap remains.
Diff scope
8 files, +140 / -11. No source/target compat bump, no Lombok bump, no calcite version forcing, no CI matrix changes.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.