Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/nanoarrow/ipc/decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,22 @@ static int ArrowIpcDecoderSetTypeUnion(struct ArrowSchema* schema,
return ArrowIpcDecoderSetTypeSimpleNested(schema, union_types_str, error);
}

static int ArrowIpcDecoderSetTypeRunEndEncoded(struct ArrowSchema* schema,
int64_t n_children,
struct ArrowError* error) {
// The RunEndEncoded type table has no parameters: the run ends and values
// types are carried by its two children (run_ends, then values)
if (n_children != 2) {
ArrowErrorSet(error,
"Expected RunEndEncoded field to have exactly two children but found "
"%" PRId64,
n_children);
return EINVAL;
}

return ArrowIpcDecoderSetTypeSimpleNested(schema, "+r", error);
}

static int ArrowIpcDecoderSetType(struct ArrowSchema* schema, ns(Field_table_t) field,
int64_t n_children, struct ArrowError* error) {
ns(Type_union_type_t) type_type = ns(Field_type_type(field));
Expand Down Expand Up @@ -1266,8 +1282,7 @@ static int ArrowIpcDecoderSetType(struct ArrowSchema* schema, ns(Field_table_t)
case ns(Type_Union):
return ArrowIpcDecoderSetTypeUnion(schema, type, n_children, error);
case ns(Type_RunEndEncoded):
ArrowErrorSet(error, "RunEndEncoded not yet supported in IPC reader");
return ENOTSUP;
return ArrowIpcDecoderSetTypeRunEndEncoded(schema, n_children, error);
default:
ArrowErrorSet(error, "Unrecognized Field type with value %d", type_type);
return EINVAL;
Expand Down
4 changes: 4 additions & 0 deletions src/nanoarrow/ipc/decoder_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2039,6 +2039,10 @@ INSTANTIATE_TEST_SUITE_P(
arrow::dense_union({arrow::field("col1", arrow::int32()),
arrow::field("col2", arrow::utf8())},
{126, 127}),
// Run-end encoded
arrow::run_end_encoded(arrow::int16(), arrow::utf8()),
arrow::run_end_encoded(arrow::int32(), arrow::int64()),
arrow::run_end_encoded(arrow::int64(), arrow::float64()),

// Type with nested metadata
arrow::list(arrow::field("some_custom_name", arrow::int32(),
Expand Down
2 changes: 1 addition & 1 deletion src/nanoarrow/ipc/files_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ INSTANTIATE_TEST_SUITE_P(
TestFile::OK("cpp-21.0.0/generated_nested_dictionary.stream"),
TestFile::NotSupported("cpp-21.0.0/generated_list_view.stream"),
TestFile::NotSupported("cpp-21.0.0/generated_binary_view.stream"),
TestFile::NotSupported("cpp-21.0.0/generated_run_end_encoded.stream")
TestFile::OK("cpp-21.0.0/generated_run_end_encoded.stream")
// Comment to keep line from wrapping
));

Expand Down
Loading