juliuszsompolski commented on code in PR #43457:
URL: https://github.com/apache/spark/pull/43457#discussion_r1366773394


##########
connector/connect/common/src/main/protobuf/spark/connect/base.proto:
##########
@@ -852,6 +852,10 @@ message FetchErrorDetailsResponse {
 
     // The query context of a SparkThrowable.
     repeated QueryContext query_contexts = 3;
+
+    // Portable error identifier across SQL engines
+    // If null, error class or SQLSTATE is not set.
+    optional string sql_state = 4;

Review Comment:
   I believe from binary perspective, it will work without optional.
   It will be seen just as an empty string coming from older clients (because 
default value of a type is not transmitted on the wire, so it's assumed that if 
"nothing" came, this is the default value, being empty string).
   But adding the optional, allows us to explicitly check if this was set or 
not, because optional adds the "hasSqlState" method.
   It is cleaner to check `if (sparkThrowable.hasSqlState)` than `if 
(sparkThrowable.getSqlState != "")` (in the latter case it is also not possible 
to distinguish if it was not set at all, or if it was explicitly set to empty 
string)



##########
connector/connect/common/src/main/protobuf/spark/connect/base.proto:
##########
@@ -852,6 +852,10 @@ message FetchErrorDetailsResponse {
 
     // The query context of a SparkThrowable.
     repeated QueryContext query_contexts = 3;
+
+    // Portable error identifier across SQL engines
+    // If null, error class or SQLSTATE is not set.
+    optional string sql_state = 4;

Review Comment:
   I believe from binary perspective, it would work without optional.
   It will be seen just as an empty string coming from older clients (because 
default value of a type is not transmitted on the wire, so it's assumed that if 
"nothing" came, this is the default value, being empty string).
   But adding the optional, allows us to explicitly check if this was set or 
not, because optional adds the "hasSqlState" method.
   It is cleaner to check `if (sparkThrowable.hasSqlState)` than `if 
(sparkThrowable.getSqlState != "")` (in the latter case it is also not possible 
to distinguish if it was not set at all, or if it was explicitly set to empty 
string)



-- 
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