Skip to content

Commit 733b7fb

Browse files
committed
GH-765: Do not close/free imported BaseStruct objects
1 parent 7c25ce5 commit 733b7fb

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

c/src/main/java/org/apache/arrow/c/ArrayImporter.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ void importArray(ArrowArray src) {
5858
ArrowArray ownedArray = ArrowArray.allocateNew(allocator);
5959
ownedArray.save(snapshot);
6060
src.markReleased();
61-
src.close();
6261

6362
recursionLevel = 0;
6463

c/src/main/java/org/apache/arrow/c/ArrowArrayStreamReader.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ final class ArrowArrayStreamReader extends ArrowReader {
4444
this.ownedStream = ArrowArrayStream.allocateNew(allocator);
4545
this.ownedStream.save(snapshot);
4646
stream.markReleased();
47-
stream.close();
4847
}
4948

5049
@Override

c/src/main/java/org/apache/arrow/c/Data.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ public static void exportArrayStream(
236236
*
237237
* <p>The given ArrowSchema struct is released (as per the C data interface specification), even
238238
* if this function fails.
239+
* <p>The given ArrowSchema struct is not closed (freed). This is the responsibility of the caller.
239240
*
240241
* @param allocator Buffer allocator for allocating dictionary vectors
241242
* @param schema C data interface struct representing the field [inout]
@@ -250,7 +251,6 @@ public static Field importField(
250251
return importer.importField(schema, provider);
251252
} finally {
252253
schema.release();
253-
schema.close();
254254
}
255255
}
256256

@@ -279,8 +279,9 @@ public static Schema importSchema(
279279
/**
280280
* Import Java vector from the C data interface.
281281
*
282-
* <p>The ArrowArray struct has its contents moved (as per the C data interface specification) to
283-
* a private object held alive by the resulting array.
282+
* <p>On successful completion, the ArrowArray struct will have been moved (as per the C data interface specification)
283+
* to a private object held alive by the resulting array. This means the ArrowArray will have been released, but not
284+
* closed (freed). Closing the ArrowArray is the responsibility of the caller.
284285
*
285286
* @param allocator Buffer allocator
286287
* @param array C data interface struct holding the array data
@@ -401,6 +402,10 @@ public static VectorSchemaRoot importVectorSchemaRoot(
401402
/**
402403
* Import an ArrowArrayStream as an {@link ArrowReader}.
403404
*
405+
* <p>On successful completion, the ArrowArrayStream struct will have been moved (as per the C data interface specification)
406+
* to a private object held alive by the resulting ArrowReader. This means the ArrowArrayStream will have been
407+
* released, but not closed (freed). Closing the ArrowArrayStream is the responsibility of the caller.
408+
*
404409
* @param allocator Buffer allocator for allocating the output data.
405410
* @param stream C stream interface struct to import.
406411
* @return Imported reader

0 commit comments

Comments
 (0)