From 373317cfdec1fde5f487405abdeee6b8057ba04d Mon Sep 17 00:00:00 2001 From: samikshya-chand_data Date: Wed, 27 May 2026 01:28:49 +0530 Subject: [PATCH] Fix chunk download failures being mis-bucketed as CONNECTION_ERROR in telemetry The 5-arg DatabricksSQLException constructor used by ChunkDownloadTask passes CHUNK_DOWNLOAD_ERROR.name() as sqlState, but the constructor was hardcoding CONNECTION_ERROR.name() in the telemetry export. As a result, chunk download failures were recorded under the CONNECTION_ERROR bucket instead of CHUNK_DOWNLOAD_ERROR, masking the true failure category and making telemetry-driven retry/alerting analysis unreliable. Pass the caller's sqlState through to exportFailureLog so the telemetry errorName matches the SQLException's sqlState and the caller's intent. Co-authored-by: Isaac Signed-off-by: samikshya-chand_data --- .../databricks/jdbc/exception/DatabricksSQLException.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/databricks/jdbc/exception/DatabricksSQLException.java b/src/main/java/com/databricks/jdbc/exception/DatabricksSQLException.java index 7353cb254..ed84e8787 100644 --- a/src/main/java/com/databricks/jdbc/exception/DatabricksSQLException.java +++ b/src/main/java/com/databricks/jdbc/exception/DatabricksSQLException.java @@ -27,14 +27,14 @@ public DatabricksSQLException(String reason, Throwable cause, String sqlState) { this(reason, sqlState, DatabricksVendorCode.getVendorCode(cause), cause); } - // This constructor is used to export chunk download failure logs - // TODO : Check chunk retry telemetry logic + // Chunk-download path: routes statementId + chunkIndex into the telemetry record so failures + // can be bucketed per chunk. Other constructors do not carry chunkIndex. public DatabricksSQLException( String reason, Throwable cause, String statementId, Long chunkIndex, String sqlState) { super(reason, sqlState, DatabricksVendorCode.getVendorCode(cause), cause); exportFailureLog( DatabricksThreadContextHolder.getConnectionContext(), - DatabricksDriverErrorCode.CONNECTION_ERROR.name(), + sqlState, reason, statementId, chunkIndex,