irx.record_batch
irx.record_batch
Source: packages/irx/src/irx/record_batch.py
title: Record batch streaming API.Classes
IrxColumnType(IntEnum)
title: IrxColumnType.RecordBatchSchema
title: RecordBatchSchema.
attributes:
_handle:
type: ctypes.c_void_p
_lib:
type: ctypes.CDLL
_released:
type: bool
_col_types:
type: list[IrxColumnType]Methods
add_field(self, name: str, col_type: IrxColumnType, nullable: bool=True) -> 'RecordBatchSchema'
title: add_field.
parameters:
name:
type: str
col_type:
type: IrxColumnType
nullable:
type: bool
returns:
type: RecordBatchSchemanum_fields(self) -> int
title: Return the number of schema fields.
returns:
type: intrelease(self) -> None
title: Release the underlying schema handle.RecordBatchBuilder
title: RecordBatchBuilder.
attributes:
_handle:
type: ctypes.c_void_p
_lib:
type: ctypes.CDLL
_released:
type: bool
_col_types:
type: list[IrxColumnType]Methods
append_int8(self, col: int, v: int) -> None
title: Append an 8-bit signed integer to a column.
parameters:
col:
type: int
v:
type: intappend_int16(self, col: int, v: int) -> None
title: Append a 16-bit signed integer to a column.
parameters:
col:
type: int
v:
type: intappend_int32(self, col: int, v: int) -> None
title: Append a 32-bit signed integer to a column.
parameters:
col:
type: int
v:
type: intappend_int64(self, col: int, v: int) -> None
title: Append a 64-bit signed integer to a column.
parameters:
col:
type: int
v:
type: intappend_uint8(self, col: int, v: int) -> None
title: Append an 8-bit unsigned integer to a column.
parameters:
col:
type: int
v:
type: intappend_uint16(self, col: int, v: int) -> None
title: Append a 16-bit unsigned integer to a column.
parameters:
col:
type: int
v:
type: intappend_uint32(self, col: int, v: int) -> None
title: Append a 32-bit unsigned integer to a column.
parameters:
col:
type: int
v:
type: intappend_uint64(self, col: int, v: int) -> None
title: Append a 64-bit unsigned integer to a column.
parameters:
col:
type: int
v:
type: intappend_float32(self, col: int, v: float) -> None
title: Append a 32-bit floating-point value to a column.
parameters:
col:
type: int
v:
type: floatappend_float64(self, col: int, v: float) -> None
title: Append a 64-bit floating-point value to a column.
parameters:
col:
type: int
v:
type: floatappend_bool(self, col: int, v: bool) -> None
title: Append a boolean value to a column.
parameters:
col:
type: int
v:
type: boolappend_string(self, col: int, v: str) -> None
title: Append a UTF-8 string to a utf8 or large_utf8 column.
parameters:
col:
type: int
v:
type: strappend_date(self, col: int, v: date | int) -> None
title: Append a value to a date32 or date64 column.
summary: |-
Accepts a datetime.date or a raw storage int (days since epoch for
DATE32, milliseconds since epoch for DATE64).
parameters:
col:
type: int
v:
type: date | intappend_timestamp(self, col: int, v: datetime | int) -> None
title: Append a value to a timestamp column.
summary: |-
Accepts a datetime.datetime (naive treated as UTC) or a raw storage
int already scaled to the column's unit (seconds, milliseconds,
microseconds, or nanoseconds since epoch).
parameters:
col:
type: int
v:
type: datetime | intappend_time(self, col: int, v: time | int) -> None
title: Append a value to a time32 or time64 column.
summary: |-
Accepts a datetime.time or a raw storage int scaled to the column's
unit (seconds, milliseconds, microseconds, or nanoseconds since
midnight).
parameters:
col:
type: int
v:
type: time | intappend_null(self, col: int) -> None
title: Append a null value to a column.
parameters:
col:
type: intfinish(self) -> 'RecordBatch'
title: finish.
returns:
type: RecordBatchrelease(self) -> None
title: Release the underlying builder handle.RecordBatch
title: RecordBatch.
summary: |-
Null-slot behaviour is uniform across every getter: a null value reads
back as the zero value of its type (0 for numerics, empty string for
utf8/large_utf8, epoch-relative 0 for date/timestamp/time). Callers
that need to distinguish a real zero/empty value from a null must
check ``is_null(col, row)`` first.
attributes:
_handle:
type: ctypes.c_void_p
_lib:
type: ctypes.CDLL
_released:
type: boolMethods
num_rows(self) -> int
title: Return the number of rows in the batch.
returns:
type: intnum_columns(self) -> int
title: Return the number of columns in the batch.
returns:
type: intget_int8(self, col: int, row: int) -> int
title: Return an 8-bit signed integer value from the batch.
parameters:
col:
type: int
row:
type: int
returns:
type: intget_int16(self, col: int, row: int) -> int
title: Return a 16-bit signed integer value from the batch.
parameters:
col:
type: int
row:
type: int
returns:
type: intget_int32(self, col: int, row: int) -> int
title: Return a 32-bit signed integer value from the batch.
parameters:
col:
type: int
row:
type: int
returns:
type: intget_int64(self, col: int, row: int) -> int
title: Return a 64-bit signed integer value from the batch.
parameters:
col:
type: int
row:
type: int
returns:
type: intget_uint8(self, col: int, row: int) -> int
title: Return an 8-bit unsigned integer value from the batch.
parameters:
col:
type: int
row:
type: int
returns:
type: intget_uint16(self, col: int, row: int) -> int
title: Return a 16-bit unsigned integer value from the batch.
parameters:
col:
type: int
row:
type: int
returns:
type: intget_uint32(self, col: int, row: int) -> int
title: Return a 32-bit unsigned integer value from the batch.
parameters:
col:
type: int
row:
type: int
returns:
type: intget_uint64(self, col: int, row: int) -> int
title: Return a 64-bit unsigned integer value from the batch.
parameters:
col:
type: int
row:
type: int
returns:
type: intget_float32(self, col: int, row: int) -> float
title: Return a 32-bit floating-point value from the batch.
parameters:
col:
type: int
row:
type: int
returns:
type: floatget_float64(self, col: int, row: int) -> float
title: Return a 64-bit floating-point value from the batch.
parameters:
col:
type: int
row:
type: int
returns:
type: floatget_bool(self, col: int, row: int) -> bool
title: Return a boolean value from the batch.
parameters:
col:
type: int
row:
type: int
returns:
type: boolget_string(self, col: int, row: int) -> str
title: Return a UTF-8 string from a utf8 or large_utf8 column.
summary: |-
Null slots return an empty string rather than an error, matching
the behavior of the numeric getters. Callers that need to
distinguish a real empty string from a null must check
``is_null(col, row)`` first.
parameters:
col:
type: int
row:
type: int
returns:
type: strget_date(self, col: int, row: int) -> int
title: Return the raw storage int for a date32 or date64 column.
summary: |-
Value is days since epoch for DATE32 and milliseconds since epoch
for DATE64.
parameters:
col:
type: int
row:
type: int
returns:
type: intget_timestamp(self, col: int, row: int) -> int
title: Return the raw storage int for a timestamp column.
summary: |-
Value is scaled to the column's unit (seconds, milliseconds,
microseconds, or nanoseconds since epoch).
parameters:
col:
type: int
row:
type: int
returns:
type: intget_time(self, col: int, row: int) -> int
title: Return the raw storage int for a time32 or time64 column.
summary: |-
Value is scaled to the column's unit (seconds, milliseconds,
microseconds, or nanoseconds since midnight).
parameters:
col:
type: int
row:
type: int
returns:
type: intis_null(self, col: int, row: int) -> bool
title: Return whether the value at the supplied location is null.
parameters:
col:
type: int
row:
type: int
returns:
type: boolrelease(self) -> None
title: Release the underlying batch handle.RecordBatchStreamWriter
title: RecordBatchStreamWriter.
attributes:
_handle:
type: ctypes.c_void_p
_lib:
type: ctypes.CDLL
_is_buffer:
type: bool
_closed:
type: bool
_released:
type: boolMethods
open_file(cls, schema: RecordBatchSchema, path: str | os.PathLike[str]) -> 'RecordBatchStreamWriter'
title: Open a stream writer backed by a file path.
parameters:
schema:
type: RecordBatchSchema
path:
type: str | os.PathLike[str]
returns:
type: RecordBatchStreamWriteropen_buffer(cls, schema: RecordBatchSchema) -> 'RecordBatchStreamWriter'
title: Open a stream writer backed by an in-memory buffer.
parameters:
schema:
type: RecordBatchSchema
returns:
type: RecordBatchStreamWriterwrite_batch(self, batch: RecordBatch) -> None
title: Write a completed batch to the stream.
parameters:
batch:
type: RecordBatchclose(self) -> None
title: Close the underlying stream writer.buffer_data(self) -> bytes
title: buffer_data.
returns:
type: bytesrelease(self) -> None
title: Release the underlying stream writer handle.RecordBatchStreamReader
title: RecordBatchStreamReader.
attributes:
_handle:
type: ctypes.c_void_p
_lib:
type: ctypes.CDLL
_closed:
type: boolMethods
open_file(cls, path: str | os.PathLike[str]) -> 'RecordBatchStreamReader'
title: Open a stream reader backed by a file path.
parameters:
path:
type: str | os.PathLike[str]
returns:
type: RecordBatchStreamReaderopen_buffer(cls, data: bytes) -> 'RecordBatchStreamReader'
title: Open a stream reader backed by an in-memory buffer.
parameters:
data:
type: bytes
returns:
type: RecordBatchStreamReadernext_batch(self) -> Optional[RecordBatch]
title: Return the next RecordBatch or None at end-of-stream.
returns:
type: Optional[RecordBatch]close(self) -> None
title: Close the underlying stream reader.