Repository navigation
Commit 52584a8
authored
fix(workflow-operator): qualify the AsterixDB FROM clause; add AsterixDBSourceOpExec unit tests (apache#6878)
### What changes were proposed in this PR?
**Source fix.** `AsterixDBSourceOpExec.addBaseSelect` built its query
with
```scala
s"... FROM $desc.database.$desc.table WHERE 1 = 1 "
```
In Scala that interpolates the `desc` **object** and then appends the
literal text `.database` / `.table`, so the generated FROM clause was
malformed and the operator's main query could never run. Line 288 of the
same file already does it correctly (`desc.database + "." +
desc.table`), confirming the intent. Fixed to
`${desc.database}.${desc.table}`.
The bug surfaced while writing tests for this file, which had **0%
coverage**. A reviewer rightly pointed out the first draft pinned the
buggy string; the spec now asserts the corrected clause instead.
**Tests.** Adds `AsterixDBSourceOpExecSpec` (47 tests) covering the
SQL++ string-building surface (no JDBC in this class):
- `addFilterConditions` and each branch it dispatches to —
`addKeywordSearch` (ftcontains; `IllegalArgumentException` on a
non-STRING column), `addRegexSearch`, `addGeoSearch` (create_rectangle
for 2 corners, create_polygon beyond that, OR-joined spatial_intersect,
`NumberFormatException` on a malformed point),
`addGeneralFilterCondition`;
- the skip paths for every toggle-off / missing-input case, and the
composed keyword→regex→geo→general ordering;
- schema derivation from the AsterixDB datatype, and the
base-select/limit/offset fragments.
**Test-infra fix.** `AsterixDBConnUtilSpec` now removes only its own
keys from the JVM-wide `AsterixDBConnUtil.asterixDBVersionMapping`
singleton instead of calling `clear()`: sbt runs suites in parallel
within one JVM, so a blanket clear could evict the new suite's cached
entry mid-run. Both suites also now call `super.beforeAll`/`beforeEach`
and wrap `afterAll` teardown in try/finally.
### Any related issues, documentation, discussions?
Closes apache#6875.
### How was this PR tested?
`sbt -java-home <jbr-17> "WorkflowOperator/testOnly *AsterixDB*"` -> 84
succeeded, 0 failed (across `AsterixDBSourceOpExecSpec`,
`AsterixDBConnUtilSpec`, `AsterixDBSourceOpDescSpec`).
`Test/scalafmtCheck`, `scalafmtCheck`, `Test/scalafix --check` and
`scalafix --check` all clean.
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8 [1M context])1 parent d5b852a commit 52584a8
3 files changed
Lines changed: 752 additions & 8 deletions
File tree
- common/workflow-operator/src
- main/scala/org/apache/texera/amber/operator/source/sql/asterixdb
- test/scala/org/apache/texera/amber/operator/source/sql/asterixdb
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
311 | | - | |
| 311 | + | |
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
117 | 120 | | |
118 | 121 | | |
119 | | - | |
120 | | - | |
121 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
122 | 130 | | |
123 | 131 | | |
124 | 132 | | |
125 | | - | |
126 | | - | |
127 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
128 | 138 | | |
129 | 139 | | |
130 | 140 | | |
| |||
0 commit comments