Skip to content
Merged
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
4 changes: 4 additions & 0 deletions changelog.d/ITL-1550.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Changed

- Documented which names form Orcapod's public interface and how provisional features may change.
- Documented how Arrow list item names, metadata and nullability affect column types and hashes.
9 changes: 9 additions & 0 deletions docs/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
This section contains the full API reference for Orcapod, auto-generated from
source code docstrings.

## Public interface

Orcapod's public interface consists of exactly the objects, methods, properties and
arguments shown in this API reference. A name absent from the reference is internal,
even if it has no leading underscore, and may change or disappear in any release.
Features marked provisional in the documentation are public and may change in a later
release, as described for [provisional operators](../concepts/operators.md#provisional-operators)
and [provisional sources](../concepts/sources.md#provisional-sources).

## Package structure

The top-level `orcapod` namespace exposes the most commonly used entry points
Expand Down
39 changes: 39 additions & 0 deletions docs/concepts/sources.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,45 @@ For example, `pa.large_list(pa.field("item", pa.int64(), nullable=False))` decla
required items. That field has a different Arrow schema identity from the default
nullable item. Use matching nested flags when joining sources or binding a slot.

The inner field's `nullable` flag is part of a list column's type. Orcapod preserves the
inner field's name and metadata in the source's Arrow schema. When hashing the schema,
Orcapod ignores the item name and ordinary metadata. An Arrow extension identifier,
stored in `ARROW:extension:*` metadata, contributes to the hash.

Streaming joins compare the types of incoming user columns without considering list item
names or metadata. They check source-info columns more strictly. When validating a
materialized operator result against its declared schema before caching it, Orcapod also
checks the item names and metadata of the fields it validates.

This example compares the original source's pipeline hash with the hash after each schema
change.

```python
import pyarrow as pa

from orcapod.sources import ArrowTableSource


def list_source(field_name="item", *, nullable=True, metadata=None):
item = pa.field(field_name, pa.binary(16), nullable=nullable, metadata=metadata)
values = pa.array([[bytes(16)]], type=pa.large_list(item))
return ArrowTableSource(pa.table({"values": values}))


original = list_source().pipeline_hash()
print("Renamed item:", original == list_source("element").pipeline_hash())
# Renamed item: True
with_note = list_source(metadata={"note": "example"}).pipeline_hash()
print("Ordinary metadata:", original == with_note)
# Ordinary metadata: True
print("Required item:", original == list_source(nullable=False).pipeline_hash())
# Required item: False

uuid_metadata = {"ARROW:extension:name": "arrow.uuid", "ARROW:extension:metadata": ""}
print("UUID extension:", original == list_source(metadata=uuid_metadata).pipeline_hash())
# UUID extension: False
```

When `DictSource` or `ListSource` builds a source from Python values, it checks the
first row for a Python `float` in a top-level column declared `numpy.float32` or
`numpy.float32 | None` in the Python schema. If it finds one, Orcapod issues a
Expand Down
Loading