kou commented on code in PR #963:
URL: https://github.com/apache/arrow-adbc/pull/963#discussion_r1286490751


##########
go/adbc/drivermgr/adbc_driver_manager.cc:
##########
@@ -128,14 +128,71 @@ static AdbcStatusCode ReleaseDriver(struct AdbcDriver* 
driver, struct AdbcError*
   return status;
 }
 
+// ArrowArrayStream wrapper to support AdbcErrorFromArrayStream
+
+struct ErrorArrayStream {
+  struct ArrowArrayStream stream;
+  struct AdbcDriver* private_driver;
+};
+
+void ErrorArrayStreamRelease(struct ArrowArrayStream* stream) {
+  if (stream->release != ErrorArrayStreamRelease || !stream->private_data) 
return;
+
+  auto* private_data = reinterpret_cast<struct 
ErrorArrayStream*>(stream->private_data);
+  private_data->stream.release(&private_data->stream);
+  delete private_data;
+  std::memset(stream, 0, sizeof(*stream));
+}
+
+const char* ErrorArrayStreamGetLastError(struct ArrowArrayStream* stream) {
+  if (stream->release != ErrorArrayStreamRelease || !stream->private_data) 
return nullptr;
+  auto* private_data = reinterpret_cast<struct 
ErrorArrayStream*>(stream->private_data);
+  return private_data->stream.get_last_error(&private_data->stream);

Review Comment:
   > Do you mean, changing get_last_error to always return the error message 
from ErrorFromArrayStream?
   
   Yes.
   
   > I chose not to do that just to make the original C Stream Interface 
functions act the same way they do without this extension, as much as possible. 
I think they will usually be the same error message, anyways.
   
   OK. It makes sense.
   



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

Reply via email to