paleolimbot commented on code in PR #82:
URL: https://github.com/apache/arrow-nanoarrow/pull/82#discussion_r1042281285
##########
src/nanoarrow/array_inline.h:
##########
@@ -107,29 +107,69 @@ static inline ArrowErrorCode _ArrowArrayAppendBits(struct
ArrowArray* array,
return NANOARROW_OK;
}
-static inline ArrowErrorCode ArrowArrayAppendNull(struct ArrowArray* array,
int64_t n) {
+static inline ArrowErrorCode _ArrowArrayAppendEmptyInternal(struct ArrowArray*
array,
+ int64_t n, uint8_t
is_valid) {
struct ArrowArrayPrivateData* private_data =
(struct ArrowArrayPrivateData*)array->private_data;
if (n == 0) {
return NANOARROW_OK;
}
- if (private_data->storage_type == NANOARROW_TYPE_NA) {
- array->null_count += n;
- array->length += n;
- return NANOARROW_OK;
+ // Some type-specific handling
+ switch (private_data->storage_type) {
+ case NANOARROW_TYPE_NA:
+ array->null_count += n * !is_valid;
+ array->length += n;
+ return NANOARROW_OK;
+ case NANOARROW_TYPE_DENSE_UNION:
+ // Add one null to the first child and append n references to that child
Review Comment:
The way the append behaviour is currently written, the builder doesn't have
access to a schema against which to check for nullability. That check should
exist, though (probably `ArrowArrayViewValidateFull()` or something).
--
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]