CurtHagenlocher commented on code in PR #4983: URL: https://github.com/apache/arrow-adbc/pull/4983#discussion_r4426193774
########## csharp/src/Apache.Arrow.Adbc/C/CAdbcDriverImporter.Streams.cs: ########## @@ -0,0 +1,223 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading; +using System.Threading.Tasks; +using Apache.Arrow.Adbc.Extensions; +using Apache.Arrow.C; +using Apache.Arrow.Ipc; + +namespace Apache.Arrow.Adbc.C +{ + public static partial class CAdbcDriverImporter + { + /// <summary> + /// A result stream imported from a driver. When the stream fails, it asks the driver + /// for the ADBC error behind the failure (see <c>AdbcErrorFromArrayStream</c>) and + /// throws it as an <see cref="AdbcException"/>. + /// </summary> + private sealed unsafe class ImportedArrayStream : IArrowArrayStream + { + private readonly ImportedAdbcDriver? _driver; + private readonly Schema _schema; + private CArrowArrayStream* _cStream; Review Comment: Fixed in 87397b98d. The imported stream now takes a driver reference once the import succeeds and releases it when the stream is disposed (including from the finalizer), matching the database, connection and statement wrappers. A failed import never takes the reference, so there's nothing to roll back. Covered by `StreamKeepsDriverLoaded`, which disposes the driver and its wrappers before reading a failing stream and fails without the fix. -- 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]
