Skip to content

Commit 3cae948

Browse files
authored
Fix chunk download failures mis-bucketed as CONNECTION_ERROR in telemetry (#1469)
## Summary The 5-arg `DatabricksSQLException(reason, cause, statementId, chunkIndex, sqlState)` constructor — used exclusively by `ChunkDownloadTask` — hardcoded `CONNECTION_ERROR.name()` in its `exportFailureLog` call, ignoring the `sqlState` argument passed in by the caller. `ChunkDownloadTask.java:98` passes `CHUNK_DOWNLOAD_ERROR.name()` as `sqlState`, so chunk download failures were: - stored on the `SQLException` with sqlState `CHUNK_DOWNLOAD_ERROR` (visible to JDBC consumers), but - recorded in telemetry under the `CONNECTION_ERROR` bucket. This divergence was flagged by a pre-existing `// TODO : Check chunk retry telemetry logic` comment. The fix passes the caller's `sqlState` through to `exportFailureLog`, so the telemetry `errorName` matches the SQLException's sqlState and the caller's intent. ## Test plan - [ ] `mvn test -pl . -Dtest=ChunkDownloadTaskTest` - [ ] `mvn test -pl . -Dtest=DatabricksSQLExceptionTest` - [ ] Confirm telemetry dashboards bucket chunk download failures under `CHUNK_DOWNLOAD_ERROR` going forward (was `CONNECTION_ERROR`). NO_CHANGELOG=true This pull request and its description were written by Isaac. Signed-off-by: samikshya-chand_data <samikshya.chand@databricks.com>
1 parent 927496d commit 3cae948

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/main/java/com/databricks/jdbc/exception/DatabricksSQLException.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ public DatabricksSQLException(String reason, Throwable cause, String sqlState) {
2727
this(reason, sqlState, DatabricksVendorCode.getVendorCode(cause), cause);
2828
}
2929

30-
// This constructor is used to export chunk download failure logs
31-
// TODO : Check chunk retry telemetry logic
30+
// Chunk-download path: routes statementId + chunkIndex into the telemetry record so failures
31+
// can be bucketed per chunk. Other constructors do not carry chunkIndex.
3232
public DatabricksSQLException(
3333
String reason, Throwable cause, String statementId, Long chunkIndex, String sqlState) {
3434
super(reason, sqlState, DatabricksVendorCode.getVendorCode(cause), cause);
3535
exportFailureLog(
3636
DatabricksThreadContextHolder.getConnectionContext(),
37-
DatabricksDriverErrorCode.CONNECTION_ERROR.name(),
37+
sqlState,
3838
reason,
3939
statementId,
4040
chunkIndex,

0 commit comments

Comments
 (0)