CurtHagenlocher commented on code in PR #2801:
URL: https://github.com/apache/arrow-adbc/pull/2801#discussion_r2231236115


##########
go/adbc/pkg/snowflake/driver.go:
##########
@@ -97,7 +97,27 @@ func setErrWithDetails(err *C.struct_AdbcError, adbcError 
adbc.Error) {
                return
        }
 
+       for i := 0; i < 5; i++ {
+               err.sqlstate[i] = C.char(adbcError.SqlState[i])
+       }
+
        if err.vendor_code != C.ADBC_ERROR_VENDOR_CODE_PRIVATE_DATA {
+               // Caller is not interested in `private_data` if `vendor_code` 
is not
+               // `ADBC_ERROR_VENDOR_CODE_PRIVATE_DATA` so let's use the field 
for
+               // `vendor_code` instead, but make sure it's not set to the 
value
+               // that would indicate `private_data` is set.
+               if adbcError.VendorCode != 
C.ADBC_ERROR_VENDOR_CODE_PRIVATE_DATA {
+                       err.vendor_code = C.int(adbcError.VendorCode)
+               }
+               setErr(err, adbcError.Msg)
+               return
+       }
+
+       numDetails := len(adbcError.Details)
+       // If there are no details, but we have a `VendorCode`, let's override
+       // `vendor_code` and not populate `private_data` with the error details.
+       if numDetails == 0 && adbcError.VendorCode != 0 && adbcError.VendorCode 
!= C.ADBC_ERROR_VENDOR_CODE_PRIVATE_DATA {
+               err.vendor_code = C.int(adbcError.VendorCode)

Review Comment:
   So this is strictly an issue with the C Interop layer? There are interop 
tests in both the Rust and C# implementations that exercise the Snowflake 
driver.



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to