java.lang.Object
org.apache.arrow.c.ArrowArrayStream
- All Implemented Interfaces:
AutoCloseable
,BaseStruct
C Stream Interface ArrowArrayStream.
Represents a wrapper for the following C structure:
struct ArrowArrayStream { int (*get_schema)(struct ArrowArrayStream*, struct ArrowSchema* out); int (*get_next)(struct ArrowArrayStream*, struct ArrowArray* out); const char* (*get_last_error)(struct ArrowArrayStream*); void (*release)(struct ArrowArrayStream*); void* private_data; };
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Snapshot of the ArrowArrayStream raw data. -
Method Summary
Modifier and TypeMethodDescriptionstatic ArrowArrayStream
allocateNew
(BufferAllocator allocator) Create ArrowArrayStream by allocating memory.void
close()
Close to release the main buffer.void
getNext
(ArrowArray array) Get the next batch in the stream.void
getSchema
(ArrowSchema schema) Get the schema of the stream.void
Mark the array as released.long
Get memory address.void
release()
Call the release callback of an ArrowArray.void
save
(ArrowArrayStream.Snapshot snapshot) Write values from Snapshot to the underlying ArrowArrayStream memory buffer.snapshot()
Take a snapshot of the ArrowArrayStream raw values.static ArrowArrayStream
wrap
(long memoryAddress) Create ArrowArrayStream from an existing memory address.
-
Method Details
-
wrap
Create ArrowArrayStream from an existing memory address.The resulting ArrowArrayStream does not own the memory.
- Parameters:
memoryAddress
- Memory address to wrap- Returns:
- A new ArrowArrayStream instance
-
allocateNew
Create ArrowArrayStream by allocating memory.The resulting ArrowArrayStream owns the memory.
- Parameters:
allocator
- Allocator for memory allocations- Returns:
- A new ArrowArrayStream instance
-
markReleased
public void markReleased()Mark the array as released. -
memoryAddress
public long memoryAddress()Description copied from interface:BaseStruct
Get memory address.- Specified by:
memoryAddress
in interfaceBaseStruct
- Returns:
- Memory address
-
release
public void release()Description copied from interface:BaseStruct
Call the release callback of an ArrowArray.This function must not be called for child arrays.
- Specified by:
release
in interfaceBaseStruct
-
getSchema
Get the schema of the stream.- Parameters:
schema
- The ArrowSchema struct to output to- Throws:
IOException
- if the stream returns an error
-
getNext
Get the next batch in the stream.- Parameters:
array
- The ArrowArray struct to output to- Throws:
IOException
- if the stream returns an error
-
close
public void close()Description copied from interface:BaseStruct
Close to release the main buffer.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceBaseStruct
-
snapshot
Take a snapshot of the ArrowArrayStream raw values.- Returns:
- snapshot
-
save
Write values from Snapshot to the underlying ArrowArrayStream memory buffer.
-