Commit 280d3b4
committed
Make analytics-engine an optional dependency
sql plugin previously declared analytics-engine as a hard dependency:
extendedPlugins = ['opensearch-job-scheduler', 'analytics-engine']
Installing opensearch-sql on a distribution that doesn't ship
analytics-engine failed with:
Missing plugin [analytics-engine], dependency of [opensearch-sql]
Marking the dep ;optional=true alone is not enough — TransportPPLQueryAction
Guice-injects QueryPlanExecutor on its constructor, and Guice's OpenSearch
fork rejects a required constructor parameter whose binding is missing at
injector-build time ("constructors cannot be optional").
Move QueryPlanExecutor from a required constructor parameter to an
@Inject(optional=true) setter. Guice invokes the setter only when a binding
for QueryPlanExecutor<RelNode, Iterable<Object[]>> exists — i.e. when
analytics-engine's createGuiceModules has run and bound DefaultPlanExecutor.
Absent analytics-engine, the setter is silently skipped,
unifiedQueryHandler stays null, and all PPL queries route to the v2
Calcite-to-OpenSearch path already in the sql plugin.
Drop the bundlePlugin exclude list. OpenSearch's jar-hell check skips the
extended-plugin cross-check when the dep is marked optional
(PluginsService.java:763), so sql can bundle every jar it needs to run
self-sufficiently. When analytics-engine is installed, parent-first
classloader delegation still lets analytics-engine's copies win for any
shared class; sql's bundled copies sit idle.
Promote analytics-framework.jar from compileOnly to api so
QueryPlanExecutor is reachable from sql's own classloader when the plugin
is absent. analytics-engine.jar stays compileOnly (required only for
OpenSearchSchemaBuilder, which lives in the engine plugin and is reached
only through RestUnifiedQueryAction — a class that never loads when the
setter is skipped).
Validated on a live 2-node cluster in both configurations:
- With analytics-engine installed: legacy and analytics PPL both return
expected rows; routing to the analytics path still fires for
parquet_-prefixed indices.
- Without analytics-engine (only opensearch-job-scheduler + opensearch-sql
installed): cluster starts cleanly, PPL and SQL queries against Lucene
indices return expected rows, parquet_-prefixed lookups return a clean
IndexNotFoundException instead of a NullPointerException or
NoClassDefFoundError.
Signed-off-by: bowenlan-amzn <bowenlan23@gmail.com>1 parent e113b7f commit 280d3b4
2 files changed
Lines changed: 50 additions & 53 deletions
File tree
- plugin
- src/main/java/org/opensearch/sql/plugin/transport
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
105 | 68 | | |
106 | 69 | | |
107 | 70 | | |
| |||
204 | 167 | | |
205 | 168 | | |
206 | 169 | | |
207 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
208 | 178 | | |
209 | 179 | | |
210 | 180 | | |
| |||
Lines changed: 36 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
66 | 71 | | |
67 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
68 | 80 | | |
69 | 81 | | |
70 | 82 | | |
71 | 83 | | |
72 | 84 | | |
73 | 85 | | |
74 | 86 | | |
75 | | - | |
76 | | - | |
| 87 | + | |
77 | 88 | | |
| 89 | + | |
| 90 | + | |
78 | 91 | | |
79 | 92 | | |
80 | 93 | | |
| |||
86 | 99 | | |
87 | 100 | | |
88 | 101 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | 102 | | |
93 | 103 | | |
94 | 104 | | |
| |||
98 | 108 | | |
99 | 109 | | |
100 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
101 | 126 | | |
102 | 127 | | |
103 | 128 | | |
| |||
134 | 159 | | |
135 | 160 | | |
136 | 161 | | |
137 | | - | |
138 | | - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
139 | 166 | | |
140 | 167 | | |
141 | 168 | | |
| |||
0 commit comments