Commit 7de6215
committed
Add containsSubQuery fast-path + unit tests on the discriminator
Without the fast-path, the rewrite path's HepPlanner.setRoot(plan) calls
.getCluster() on the input — which is null on the mocked RelNodes the
existing AnalyticsExecutionEngineTest passes through execute(). Six of
the suite's nine tests started failing with 'NullPointerException:
cluster' after this PR's first commit.
Add a containsSubQuery(RelNode) pre-check that walks the plan with a
RelHomogeneousShuttle + RexShuttle, returns true the moment it sees a
RexSubQuery, and false otherwise. The rewrite chain only runs when the
discriminator says there's something to remove — restores compatibility
with the existing mock-based tests and skips HEP entirely for the
typical query that has no subqueries.
Adds two focused unit tests on the discriminator (package-private so the
test can call it directly):
* containsSubQuery_falseForPlanWithoutSubQuery — vanilla mocked plan
reports false, preventing the HEP/decorrelator path from ever firing
on cluster-less mocks.
* containsSubQuery_trueWhenRelNodeExposesRexSubQueryDuringTraversal —
stub the RelNode.accept(RexShuttle) to surface a RexSubQuery and
verify it's detected.
The HEP+decorrelator chain itself is Calcite-tested; the end-to-end
behavior is covered by CalcitePPLExistsSubqueryIT (0/19 -> 6/19 pass,
zero remaining 'Unrecognized filter operator' failures).
Signed-off-by: Jialiang Liang <jialianl@amazon.com>
Signed-off-by: Jialiang Liang <jiallian@amazon.com>1 parent 328ee1b commit 7de6215
2 files changed
Lines changed: 85 additions & 0 deletions
File tree
- core/src
- main/java/org/opensearch/sql/executor/analytics
- test/java/org/opensearch/sql/executor/analytics
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| 21 | + | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| |||
177 | 180 | | |
178 | 181 | | |
179 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
180 | 189 | | |
181 | 190 | | |
182 | 191 | | |
183 | 192 | | |
184 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
185 | 217 | | |
Lines changed: 53 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| 28 | + | |
| 29 | + | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| |||
276 | 280 | | |
277 | 281 | | |
278 | 282 | | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
279 | 332 | | |
280 | 333 | | |
281 | 334 | | |
| |||
0 commit comments