nchammas commented on code in PR #57831:
URL: https://github.com/apache/spark/pull/57831#discussion_r3736549746


##########
common/utils/src/main/resources/error/error-conditions.json:
##########
@@ -4147,17 +4147,20 @@
       "SESSION_CHANGED" : {
         "message" : [
           "The existing Spark server driver instance has restarted. Please 
reconnect."
-        ]
+        ],
+        "sqlState" : "08003"
       },
       "SESSION_CLOSED" : {
         "message" : [
           "Session was closed."
-        ]
+        ],
+        "sqlState" : "08003"
       },
       "SESSION_NOT_FOUND" : {
         "message" : [
           "Session not found."
-        ]
+        ],
+        "sqlState" : "08003"
       }
     },
     "sqlState" : "HY000"

Review Comment:
   I think it's weird -- and maybe even "incorrect"? -- to have a sub-condition 
be in a completely different error class than the parent condition. `HY` is for 
"CLI-specific condition" and `08` is for "Connection Exception".
   
   I know it's not something that this PR introduced, but I think the 
sub-conditions under this condition should be broken up into two groups:
   
   1. `08` class: `SESSION_*`
   2. `HY` class: `FORMAT`, `OPERATION_*`
   



##########
common/utils/src/main/resources/error/README.md:
##########
@@ -157,6 +157,11 @@ Spark prefers to re-use existing SQLSTATEs, preferably 
used by multiple vendors.
 For extension Spark claims the `K**` sub-class range.
 If a new class is needed it will also claim the `K0` class.
 
+A SQLSTATE is assigned at the error condition level and applies to all of the 
condition's
+sub-conditions. A sub-condition that belongs to a different error state than 
its condition may
+override it by declaring its own `sqlState`; Spark resolves the 
sub-condition's SQLSTATE first
+and falls back to the condition's.

Review Comment:
   I don't think this is the correct use of the terminology. Refer to the error 
hierarchy and illustrative example at the start of this README.
   
   A SQLSTATE is assigned at the error state level. Multiple error conditions 
can share the same SQLSTATE.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to