Commit a8f94f3
authored
Use async wait timeout for SEA when direct results disabled (fix hybrid-path truncation) (#1476)
## Description
When direct results are disabled on the SEA (SQL Execution API) path,
the driver
built the `ExecuteStatement` request with `waitTimeout=10s`
(`SYNC_TIMEOUT_VALUE`)
and `onWaitTimeout=CONTINUE` — the old SEA *hybrid* direct-results path.
For results that span **multiple chunks but compress small**
(highly-compressible
payloads), the server returns only the **first chunk inline** with **no
external
links** (`hasInlineAttachment=true, numExternalLinks=0`). The driver's
inline path
returns just that first chunk and never fetches the rest, so the result
is
**silently truncated**.
This change sets `waitTimeout=0s` (`ASYNC_TIMEOUT_VALUE`) when direct
results are
disabled, avoiding the hybrid inline path. The server then delivers
results via
**external links**, which the driver downloads in full.
Resulting contract (SEA):
- `DirectResults = 0` → `WaitTimeout = 0` (async)
- `DirectResults = 1` → `WaitTimeout` unset (true direct results)
Thrift is unaffected — it has no `waitTimeout` and paginates correctly.
Related: **ES-1714092** (server-side compressed-vs-uncompressed byte
limit on the
hybrid path). This driver change stops using that path; the server-side
fix is
tracked separately.
## Requirement / Motivation
Reported via Slack: SEA with direct results disabled silently truncated
a large,
highly-compressible result (200MB logical → ~0.8MB compressed) to a
handful of
rows, while Thrift returned all rows.
## Testing done
**Repro (manual, against a serverless SQL warehouse)** — query
`SELECT repeat('A', 1024 * 1024) AS payload FROM range(200)` with direct
results
disabled:
| | Before | After |
|---|---|---|
| SEA | 20 / 200 rows, `isCloudFetchUsed=false` (inline) ❌ | 200 / 200
rows, `isCloudFetchUsed=true` (external links) ✅ |
| Thrift | 200 / 200 ✅ | 200 / 200 ✅ |
Additional disambiguation runs (repeating the real table via `UNION ALL`
up to 64×,
9.6M rows, 40s execution) confirmed the trigger is the
**inline-vs-external-links
delivery (compressed size)** — not query time or polling: a fast no-poll
query
truncated while a slow 6-poll query did not.
**Regression — SEA unit + fakeservice suites (all pass, 0 failures):**
- `DatabricksSdkClientTest` (42)
- `SqlExecApiHybridResultsIntegrationTests` (2)
- `DatabricksMetadataQueryClientTest` (57)
- `CommandBuilderTest` (21)
- `DatabricksEmptyMetadataClientTest` (11)
- `SeaCircuitBreakerManagerTest` (13)
## Notes / caveats
- **Latency:** with direct results disabled, queries now always
execute → poll → fetch (one extra round-trip for small results) instead
of
returning inline on the first response.
- The underlying server-side bug (ES-1714092) is separate; this change
avoids the
affected path rather than fixing the server.
---------
Signed-off-by: Sreekanth Vadigi <sreekanth.vadigi@databricks.com>1 parent 41d90d4 commit a8f94f3
3 files changed
Lines changed: 61 additions & 2 deletions
File tree
- src
- main/java/com/databricks/jdbc/dbclient/impl/sqlexec
- test/java/com/databricks/jdbc/dbclient/impl/sqlexec
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
740 | 740 | | |
741 | 741 | | |
742 | 742 | | |
743 | | - | |
| 743 | + | |
744 | 744 | | |
745 | | - | |
| 745 | + | |
746 | 746 | | |
747 | 747 | | |
748 | 748 | | |
| |||
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1402 | 1402 | | |
1403 | 1403 | | |
1404 | 1404 | | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
1405 | 1463 | | |
0 commit comments