Class SqlStateClassifier


  • public final class SqlStateClassifier
    extends Object
    Reclassifies SQL states for known transient or mis-categorized server errors so callers can programmatically identify retryable failures.

    Patterns handled:

    • Unity Catalog unavailability (UC_CLIENT_EXCEPTION) → 08S01 (communication link failure, retryable).
    • Connection-acquisition / parquet read deadlines (PARQUET_FAILED_READ_FOOTER, DEADLINE_EXCEEDED: acquiring connection) → 08S01.
    • Server-side java.util.ConcurrentModificationException mis-mapped to 42000 (syntax/access violation) → 40001 (serialization failure, retryable). Only applied when the original SQL state is 42000 so unrelated 42xxx states are preserved.

    Patterns are anchored on stable server-emitted tokens (Spark error classes, fully-qualified Java exception names) rather than English prose, so server message rewording does not silently regress the classifier.

    • Method Detail

      • classifyTransientSqlState

        public static String classifyTransientSqlState​(String errorMessage,
                                                       String originalSqlState)
        Returns a remapped SQL state if errorMessage matches a known transient pattern, or originalSqlState otherwise. Pure function — callers should log the remap separately with their own context (statement ID, response).