blaze / blaze/datashape

Declaration/syntax for sum types/union arrays?

Open
#237 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
189
Forks
62
PR merge metrics
No merged PRs in 30d

Description

The flip-side of record types (product types), in which each element has an instance of all fields, are tagged union types (sum types), in which each element has an instance of exactly one type from a list of possible types. For example,

```
union[int32, string] -> [1, 2, "three"]
union[int32, var * int32] -> [1, 2, [3, 4], [], 5]
union[tuple[int32, int32], tuple[int32, int32, int32]] -> [(1, 2), (3, 4, 5)]
```

This can be implemented, for instance, with an array of tags (types), optional indexes (offsets), and an array for each type. See, for example, the [Arrow implementation](https://arrow.apache.org/docs/memory_layout.html#dense-union-type).

Are there any plans to support specifications of this kind of data?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.