paleolimbot commented on code in PR #396:
URL: https://github.com/apache/arrow-nanoarrow/pull/396#discussion_r1522405288
##########
python/src/nanoarrow/_lib.pyx:
##########
@@ -2198,6 +2250,129 @@ cdef class CArrayStream:
return _repr_utils.array_stream_repr(self)
+cdef class CMaterializedArrayStream:
+ cdef CSchema _schema
+ cdef CBuffer _array_ends
+ cdef list _arrays
+ cdef int64_t _capacity_arrays
+ cdef int64_t _total_length
+
+ def __cinit__(self):
+ self._arrays = []
+ self._total_length = 0
+ self._schema = CSchema.allocate()
+ self._array_ends = CBuffer.empty()
+ cdef int code = ArrowBufferAppendInt64(self._array_ends._ptr, 0)
+ Error.raise_error_not_ok("ArrowBufferAppendInt64()", code)
+
+ cdef _finalize(self):
+ self._array_ends._set_data_type(NANOARROW_TYPE_INT64)
+
+ @property
+ def schema(self):
+ return self._schema
+
+ @property
+ def array_ends(self):
+ return self._array_ends
+
+ cdef int _resolve_chunk(self, const int64_t* sorted_offsets, int64_t
index, int64_t start_offset_i,
+ int64_t end_offset_i) noexcept nogil:
+ if start_offset_i >= (end_offset_i - 1):
Review Comment:
Ok, this is now `ArrowResolveChunk64()` in the C library. It will also be
needed for random access into REE arrays and I'd like to use it in the R
package to do something similar to this PR in the R package.
--
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]