Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
752a5d9
perf(datagrams): build the rows of a table without normalizing each r…
eywalker Nov 22, 2026
9f7f1c1
perf(pipeline): count a held node's rows from what it holds, not by b…
eywalker Nov 22, 2026
0e15d0d
perf: import modules that import orcapod loads directly, not through …
eywalker Nov 22, 2026
53e1566
Merge main into eywalker/job-speed (ITL-1344 #474, ITL-1336 #473)
Nov 22, 2026
522f642
perf(pipeline): an operator node hands the table it kept to the nodes…
Nov 22, 2026
6d331e2
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 22, 2026
de98e05
docs(dev): spec, job nodes pass streams of Arrow data; channels opene…
eywalker Nov 22, 2026
edb4148
perf(spiraldb): a source looks its table up once to build and once pe…
eywalker Nov 22, 2026
3fdcf96
docs(dev): ITL-1347 stage 0: measurements and the differential harnes…
eywalker Nov 22, 2026
22bbca8
wip(pipeline): ITL-1347 stage 2: nodes return output streams, arrow_s…
Nov 22, 2026
2d01d29
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 22, 2026
6605376
Merge branch 'eywalker/itl-1347-stage-1-operator-kept-table' into eyw…
Nov 22, 2026
303902a
perf(pipeline): F takes the stream's keys and flags system tags by va…
Nov 22, 2026
840267d
perf(pipeline): arrow_schema() lists F's columns in F's order (ITL-1360)
Nov 22, 2026
e8d5851
docs(changelog): ITL-1360 fragment
Nov 22, 2026
ab0bd08
test(pipeline): L7 for a loaded job (ITL-1360)
Nov 22, 2026
3ab16e5
refactor(streams): F's per-slice step as module functions of streams.…
Nov 22, 2026
e8790d9
Merge main (55567118, #480 Rejoin ITL-1355) into eywalker/job-speed
Nov 22, 2026
a425c84
fix(pipeline): F equals the rows for narrower sources and raw streams…
Nov 22, 2026
b58deca
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 22, 2026
f068463
fix(side_effects): cast the node to StreamProtocol through object (IT…
Nov 22, 2026
5b39d5b
fix(function_node): a type disagreement fails the run with as_table's…
Nov 22, 2026
692c4ca
Merge main (321284ae, #471 database type matrix ITL-1334) into eywalk…
Nov 22, 2026
49a81d6
fix(streams): type the schema metadata row_built_provenance keeps (IT…
Nov 22, 2026
fbf8aff
fix(function_node): a failed write is reported before e9 (ITL-1360)
Nov 22, 2026
1740220
fix(databases): import pyarrow directly in databases/utils.py (ITL-1349)
Nov 22, 2026
149fdd4
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 22, 2026
6947e71
docs(operators): state F's domain; pin its one exception and the bind…
Nov 22, 2026
0b344c9
feat(channels): channels of Arrow record batches and the operators' r…
eywalker Nov 22, 2026
4040385
perf(function_node): entry ids from the input table's slices (ITL-136…
Nov 22, 2026
6f899a1
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 22, 2026
335c4bc
fix(pipeline): F types source info from its tokens, over the whole ta…
Nov 22, 2026
942fe14
fix(source_node): a source's rows keep their data order (ITL-1360)
Nov 22, 2026
a658238
fix(pipeline): async held rows as planned; async outputs built on rea…
Nov 22, 2026
44d95c3
fix(streams): a description never polls; L7 compares column order (IT…
Nov 22, 2026
92b93bb
Merge remote-tracking branch 'origin/eywalker/itl-1360-itl-1347-stage…
Nov 22, 2026
f770d1a
perf(function_node): a stored hit takes its id by a shallow copy (ITL…
Nov 22, 2026
b9f9879
fix(pipeline): channels check source-info types as tokens; no new imp…
Nov 22, 2026
68619fa
Merge remote-tracking branch 'origin/eywalker/itl-1360-itl-1347-stage…
Nov 22, 2026
1319a77
perf(side_effects): a side-effect node hands on its input table at th…
Nov 22, 2026
bdb9a39
perf(function_node): output rows of stored results taken from their t…
Nov 22, 2026
31b9cc1
perf(function_node): input rows are views made only when read (ITL-13…
Nov 22, 2026
f072298
test(function_node): an observer reading row views sees the input row…
Nov 22, 2026
7599ba7
docs(changelog): ITL-1361 fragment
Nov 22, 2026
ea5fbd7
feat(operators): streaming join kernels for Join, MergeJoin and SemiJ…
eywalker Nov 22, 2026
f2ddf55
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 22, 2026
94acfbf
Merge remote-tracking branch 'origin/eywalker/itl-1360-itl-1347-stage…
Nov 22, 2026
25386a1
test(pipeline): name ITL-1366's input as difference e10 (ITL-1360)
Nov 22, 2026
afc0525
fix(function_node): typed row views; the id test counts both paths (I…
Nov 22, 2026
6757ed6
fix(source_node): a narrower bind's rows keep main's key order; descr…
Nov 22, 2026
b5f5a18
fix(pipeline): held streams built when read and not kept; membership …
Nov 22, 2026
c6c47aa
fix(streams): an undeclared poller that has not polled is described w…
Nov 22, 2026
5a1725e
fix(pipeline): any failure of F's whole-table build falls back to the…
Nov 22, 2026
95c9d17
test(pipeline): type the held-lifetime test's streams (ITL-1360)
Nov 22, 2026
ceaeadb
Merge remote-tracking branch 'origin/eywalker/itl-1360-itl-1347-stage…
Nov 22, 2026
63a6af6
fix(function_node): stage 3 falls back to the rows on RowBuiltFormUna…
Nov 22, 2026
7dfff51
feat(operators): streaming Rejoin kernel on Arrow record batches (ITL…
eywalker Nov 22, 2026
324c40e
refactor(channels): open_channel() on every stream; the input channel…
eywalker Nov 22, 2026
8d13df2
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 22, 2026
eb4d050
Merge remote-tracking branch 'origin/eywalker/itl-1360-itl-1347-stage…
Nov 22, 2026
a3d90a5
fix(pipeline): rows built on read off the provably-equal routes (ITL-…
Nov 22, 2026
2064af3
fix(channels): a conversion that never starts releases its reader (IT…
eywalker Nov 22, 2026
a31ed4b
fix(pipeline): RowsOnRead typed through rows_on_read (ITL-1360)
Nov 22, 2026
c757bc0
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 22, 2026
6d484c8
Merge remote-tracking branch 'origin/eywalker/itl-1360-itl-1347-stage…
Nov 22, 2026
3223e64
fix(pipeline): the eager route only for library source kinds; RowsOnR…
Nov 22, 2026
6844386
fix(pipeline): type the protocol-member walk and round-4 tests (ITL-1…
Nov 22, 2026
7da63a1
Merge remote-tracking branch 'origin/eywalker/itl-1360-itl-1347-stage…
Nov 22, 2026
60a9e84
fix(function_node): stage 3-4 outputs keep their rows, tables built w…
Nov 22, 2026
0e357ee
fix(pipeline): eager only for a source kind's own reading; result ord…
Nov 22, 2026
14b28b9
fix(pipeline): type the result keys and token kinds for basedpyright …
Nov 22, 2026
af97d7e
Merge remote-tracking branch 'origin/eywalker/itl-1360-itl-1347-stage…
Nov 22, 2026
352ce7b
fix(pipeline): eager only for exactly a proven class; result order fr…
Nov 22, 2026
32487f8
Merge remote-tracking branch 'origin/eywalker/itl-1360-itl-1347-stage…
Nov 22, 2026
36fd78a
fix(pipeline): every wrapper in a result's chain proven; eager only i…
Nov 22, 2026
2cc13ef
Merge remote-tracking branch 'origin/eywalker/itl-1360-itl-1347-stage…
Nov 22, 2026
dd6b7cd
fix(pipeline): eager only in the node's data context with row-typed s…
Nov 22, 2026
28aa795
Merge remote-tracking branch 'origin/eywalker/itl-1360-itl-1347-stage…
Nov 22, 2026
1c5c045
docs(pipeline): an observer that changes the pipeline mid-run is unsu…
Nov 22, 2026
1a915e7
refactor(channels): to_stream() is a method of the input channel agai…
eywalker Nov 22, 2026
1ae78fb
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 22, 2026
1a4a323
Merge remote-tracking branch 'origin/eywalker/itl-1360-itl-1347-stage…
Nov 22, 2026
392655e
fix(pipeline): an operator node reads its result from the one computa…
Nov 22, 2026
3752094
Merge remote-tracking branch 'origin/eywalker/itl-1360-itl-1347-stage…
Nov 22, 2026
3ceed8a
test(pipeline): no deferred-read test rebinds a source mid-run; docum…
Nov 22, 2026
2d8017a
Merge remote-tracking branch 'origin/eywalker/itl-1360-itl-1347-stage…
Nov 22, 2026
ca8c4ba
perf(pipeline): job nodes hand on Arrow-backed streams on the sync pa…
eywalker Nov 22, 2026
74dd117
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 22, 2026
6b2ffa3
refactor(channels): stage 2's description and settlement in the chann…
eywalker Nov 23, 2026
a6b0a4d
fix(function_node, side_effects): one precondition for every fast pat…
Nov 23, 2026
52cf60f
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 23, 2026
49a16d8
Merge main (4d192bfc: #484 ITL-1363, #486 ITL-1365, #491 ITL-1367, #4…
Nov 23, 2026
f11e09d
fix(function_node): round 2 of PR #494 review; CodeRabbit on 52cf60f6…
Nov 23, 2026
4ede51d
test: expectations of main 4d192bfc after merging it into eywalker/jo…
Nov 23, 2026
4a2e4ba
fix(operators): an operator's description names system tags after its…
eywalker Nov 23, 2026
f6ad62d
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 23, 2026
ad407f8
test(function_node): every review finding of PR #494 covers its class…
Nov 23, 2026
985066d
Merge main (4d192bfc: #484, #486, #491, #499) into eywalker/job-speed…
eywalker Nov 23, 2026
cb3ec69
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 23, 2026
a1bd4af
test(channels): every review finding on the record-batch channel PRs …
Nov 23, 2026
402ac27
test(function_node): type the side-effect node and the cold/warm node…
Nov 23, 2026
5bd9dcc
chore: merge main (2d64d324) into job-speed
Nov 23, 2026
730deee
fix(channels): CodeRabbit on PR 510: nulls under a non-nullable field…
Nov 23, 2026
f896803
fix: CodeRabbit on PR #510, stages 1-2 and the differential harness (…
Nov 23, 2026
c41c53d
fix(pipeline): the system-tag check looks at values and field metadat…
Nov 23, 2026
8841710
fix(types): condition.py imports pyarrow directly, as job-speed requi…
Nov 23, 2026
b1a35f9
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 23, 2026
12102ed
Merge remote-tracking branch 'origin/eywalker/job-speed' into eywalke…
Nov 23, 2026
5190189
Merge pull request #512 from metamorphic-labs/eywalker/itl-1362-revie…
eywalker Nov 23, 2026
c2b78da
Merge pull request #514 from metamorphic-labs/eywalker/itl-1347-pr510…
eywalker Nov 23, 2026
5aa9358
chore: merge main (a8bbf632) into job-speed
Nov 23, 2026
a0a0ffc
chore: merge main (ca1c35d6) into job-speed
Nov 23, 2026
bfc0785
chore: merge main (8ee6c6d4) into job-speed
Nov 23, 2026
5045660
test: the two legacy-store held tests assert main's outcome since ITL…
Nov 23, 2026
5133fc4
Merge pull request #516 from metamorphic-labs/eywalker/itl-1347-legac…
eywalker Nov 23, 2026
087ff54
chore: merge main (83c54764) into job-speed
Nov 23, 2026
40a4ea7
fix(compare): calibration compares raw Arrow values, never Python obj…
Nov 23, 2026
3f6ccfb
fix(channels): Codex on PR 510: a freed reader's feed, token types ac…
Nov 23, 2026
f7a65d5
Merge pull request #518 from metamorphic-labs/eywalker/itl-1347-compa…
eywalker Nov 23, 2026
365f2a0
Merge pull request #519 from metamorphic-labs/eywalker/itl-1362-pr510…
eywalker Nov 23, 2026
490b951
fix(channels): address CodeRabbit's final pass on PR #510 (ITL-1347)
Nov 23, 2026
1b0cd53
test(pipeline): pin that an old-signature sync orchestrator override …
Nov 23, 2026
6babb8e
fix(channels): CodeRabbit's final pass on PR 510: settled token types…
Nov 23, 2026
4f3135c
refactor(channels): leave static_output_pod :1126 and :1219 to PR #52…
Nov 23, 2026
4a3bbd9
docs(changelog): SyncPipelineOrchestrator.run takes held, a breaking …
Nov 23, 2026
c461143
Merge pull request #520 from metamorphic-labs/eywalker/itl-1362-pr510…
eywalker Nov 23, 2026
72bbbd1
Merge pull request #521 from metamorphic-labs/eywalker/itl-1347-pr510…
eywalker Nov 23, 2026
5768e84
fix(streaming_joins): MergeJoin compares settled token types with an …
Nov 23, 2026
f018693
Merge pull request #522 from metamorphic-labs/eywalker/itl-1362-merge…
eywalker Nov 23, 2026
5df03e6
test(channels): the fast-path test fails if a library source's channe…
Nov 23, 2026
e65fc79
test(streaming_rejoin): keep k in the comparison of the unchanged col…
Nov 23, 2026
0a2a9c8
Merge pull request #523 from metamorphic-labs/eywalker/itl-1347-pr510…
eywalker Nov 23, 2026
21b74f6
Merge pull request #524 from metamorphic-labs/eywalker/itl-1362-rejoi…
eywalker Nov 23, 2026
d9f655f
Merge job-speed (the tree of #510) into the stages 3 and 4 branch (IT…
eywalker Nov 24, 2026
4c70280
Record #510's squash commit, whose tree the job-speed merge already h…
eywalker Nov 24, 2026
a6fe116
Merge origin/main into the stages 3 and 4 branch (ITL-1361)
eywalker Nov 24, 2026
f8c6b4c
test(function_node): the held rows are the output's rows in order; re…
eywalker Nov 24, 2026
41ce5a6
fix(function_node): rows for observers with a replaced hook; an async…
eywalker Nov 24, 2026
e9431e4
Merge remote-tracking branch 'origin/main' into eywalker/pr494-refresh
eywalker Nov 24, 2026
dbce437
test(scripts): the cross-version report holds each input with the res…
eywalker Nov 24, 2026
37bdc41
chore(merge): merge main into the Arrow job-node branch
eywalker Nov 27, 2026
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
16 changes: 16 additions & 0 deletions changelog.d/ITL-1361.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### Changed

- **Function and side-effect job nodes work on their input's Arrow table** — on the sync
path, where its input's table is provably its rows' (exactly a table stream, in the
node's data context, with system tags and columns its rows would not retype), a
function job node computes each input row's instance id from slices of that table,
using the same entry and instance preimages and the same input data hash
(`data_table_content_hash`) as the row path; hands the library's row-blind
observers views of its input rows, made only when read (any other observer receives
the rows themselves); gives a stored result the id it was stored under by a shallow
copy; and builds its output with the rows of stored results taken from the stored
table. A side-effect job node hands on its input's table at the rows it passed on,
under the same condition. Any other input takes the row path as before. Every output,
stored row, row id, observer event and error is as before. Third and fourth
stages of the table transport between job nodes
(`docs/dev/specs/itl-1347-job-table-transport.md`). (ITL-1361)
255 changes: 255 additions & 0 deletions docs/dev/scripts/itl_1347/cross_version_entry_ids.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
"""Cross-version check of a function node's instance ids (ITL-1361).

Run once per Orcapod version, each with its own environment, over the same inputs:

PYTHONPATH=<repository root> <env>/bin/python cross_version_entry_ids.py <store dir> write <out.json>
PYTHONPATH=<repository root> <other env>/bin/python cross_version_entry_ids.py <store dir> load <out.json>

(not ``-I``: it ignores ``PYTHONPATH``, which the fixture import needs).

``write`` runs a function job node over each input and stores its results in a Delta
store; ``load`` runs the same node load-only over the same store. A store written by one
version must be hit, row for row, by the other: same stored instance ids, every row
from the store, no call of the function. The inputs cover the several-items family
(tag order, layout, tag roles), list-valued columns after ``Batch`` and ``GroupBy``,
nested source info, nullable and logical values, and raw streams whose rows type their
system tags or columns otherwise (an ``int32`` system tag, a nullable one, an untyped
``null`` data column), each as a job hands it on and as a raw ``ArrowTableStream``.
Needs the repository root on ``PYTHONPATH`` (for ``tests.test_core.operators.several_items``).
"""

from __future__ import annotations

import json
import sys
import warnings
from pathlib import Path
from typing import Any

import pyarrow as pa

from orcapod import function_pod
from orcapod.core.data_tags import stream_data_tags
from orcapod.core.nodes.function_node import FunctionJobNode
from orcapod.core.operators.static_output_pod import StaticOutputOperatorPod
from orcapod.core.streams import ArrowTableStream
from orcapod.databases import DeltaTableDatabase
from orcapod.operators import Batch, GroupBy
from orcapod.pipeline.observer import NoOpObserver
from orcapod.sources import DictSource
from tests.test_core.operators.several_items import MAIN, arrangements, make_source

warnings.simplefilter("ignore")
CALLS: list[Any] = []
DECLARED: dict[str, Any] = {}


@function_pod(output_keys="y")
def flat(d1: int | None) -> int:
CALLS.append(d1)
return -1 if d1 is None else d1 + 1


@function_pod(output_keys="y")
def listed(d1: list[int | None] | None) -> int:
CALLS.append(d1)
return -1 if d1 is None else len(d1)


@function_pod(output_keys="y")
def nullable(i: int | None) -> int:
CALLS.append(i)
return -1 if i is None else i


@function_pod(output_keys="y")
def untyped(x: Any) -> int:
CALLS.append(x)
return -1 if x is None else x


class Cached(NoOpObserver):
def __init__(self) -> None:
self.cached: list[bool] = []
# Each input (its own tag and data) with the result it received, in order.
self.received: list[list[str]] = []

def contextualize(self, *identity_path: str) -> Cached:
return self

def on_data_end(
self, node_label: str, tag: Any, input_data: Any, output_data: Any, cached: bool
) -> None:
self.cached.append(bool(cached))
self.received.append(
[
repr(tag.as_dict(columns={"system_tags": True})),
repr(input_data.as_dict()),
repr(None if output_data is None else output_data.as_dict()),
]
)


def forms(stream: Any) -> dict[str, Any]:
rows = list(stream.iter_data())
handed_on = StaticOutputOperatorPod._materialize_upstream(rows, stream)
raw = ArrowTableStream(
stream.as_table(columns={"system_tags": True, "source": True}),
tag_columns=stream.keys()[0],
data_tags=stream_data_tags(stream),
)
return {"handed_on": handed_on, "raw": raw}


def cases() -> dict[str, tuple[Any, Any]]:
out: dict[str, tuple[Any, Any]] = {}
for arrangement in arrangements(MAIN):
stream = make_source(MAIN, arrangement).select_data_columns(["d1"])
for name, form in forms(stream).items():
out[f"family/{arrangement.id}/{name}"] = (flat, form)
for arrangement in arrangements(MAIN)[::4]:
source = make_source(MAIN, arrangement)
for kind, stream in (
("batch", Batch(batch_size=2)(source)),
("group_by", GroupBy(by=[arrangement.tag_order[0]])(source)),
):
selected = stream.select_data_columns(["d1"])
for name, form in forms(selected).items():
out[f"{kind}/{arrangement.id}/{name}"] = (listed, form)
values = DictSource(
[{"a": 1, "b": "x", "i": 1}, {"a": 2, "b": "y", "i": None}],
tag_columns=["a", "b"],
tag_only_columns=True,
source_id="values",
)
for name, form in forms(values).items():
out[f"nullable/{name}"] = (nullable, form)
raw_tables = {
"int32_system_tag": pa.table(
{"k": ["a", "b"], "d1": [1, 2], "e": pa.array([10, 11], pa.int32())}
),
"nullable_system_tag": pa.table(
{
"k": ["a", "b"],
"d1": [1, 2],
"e": pa.array(["s", None], pa.large_string()),
}
),
}
for name, table in raw_tables.items():
out[f"raw/{name}"] = (
flat,
ArrowTableStream(table, tag_columns=["k"], system_tag_columns=["e"]),
)
out["raw/meta_column"] = (
flat,
ArrowTableStream(
pa.table({"k": ["a", "b"], "d1": [1, 2], "__review": [10, 11]}),
tag_columns=["k"],
),
)
# The node is declared against the clean input and executed on the raw one.
DECLARED["raw/meta_column"] = ArrowTableStream(
pa.table({"k": ["a", "b"], "d1": [1, 2]}), tag_columns=["k"]
)
extension = {b"ARROW:extension:name": b"file", b"ARROW:extension:metadata": b""}
out["raw/extension_metadata_system_tag"] = (
flat,
ArrowTableStream(
pa.Table.from_arrays(
[
pa.array(["a", "b"]),
pa.array([1, 2]),
pa.array(["s", "t"], pa.large_string()),
],
schema=pa.schema(
[
pa.field("k", pa.large_string()),
pa.field("d1", pa.int64()),
pa.field(
"_tag_s",
pa.large_string(),
nullable=False,
metadata=extension,
),
]
),
),
tag_columns=["k"],
),
)
out["raw/null_in_non_null_system_tag"] = (
flat,
ArrowTableStream(
pa.Table.from_arrays(
[
pa.array(["a", "b"]),
pa.array([1, 2]),
pa.array(["s", None], pa.large_string()),
],
schema=pa.schema(
[
pa.field("k", pa.large_string()),
pa.field("d1", pa.int64()),
pa.field("_tag_extra", pa.large_string(), nullable=False),
]
),
),
tag_columns=["k"],
),
)
out["raw/null_data_column"] = (
untyped,
ArrowTableStream(
pa.table({"k": ["a", "b"], "x": pa.nulls(2)}), tag_columns=["k"]
),
)
return out


def main() -> None:
store, mode, report = Path(sys.argv[1]), sys.argv[2], Path(sys.argv[3])
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
if mode not in ("write", "load"):
# Checked before any store is opened: anything else would compute and write.
raise SystemExit(f"mode must be 'write' or 'load', not {mode!r}")
results: dict[str, Any] = {}
for index, (label, (pod, stream)) in enumerate(sorted(cases().items())):
database = DeltaTableDatabase(store / f"case_{index:03d}")
observer = Cached()
CALLS.clear()
try:
node = FunctionJobNode(
pod.pod, DECLARED.get(label, stream), pipeline_database=database
)
node.execute(stream, observer=observer, load_only=(mode == "load"))
database.flush()
ids: list[str] = []
for path in database.list_table_paths():
records = database.get_all_records(path)
if (
records is None
or "__pipeline_instance_id" not in records.column_names
):
continue
ids += [
value.hex()
for value in records["__pipeline_instance_id"].to_pylist()
if isinstance(value, bytes)
]
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
ids.sort()
results[label] = {
"ids": ids,
"cached": observer.cached,
"calls": len(CALLS),
# The inputs as the node was given them, each with its result (not the
# stored entry's own tag): the write and load reports must be the same.
"received": observer.received,
}
except Exception as error: # noqa: BLE001 # the outcome is compared across versions
results[label] = {"error": f"{type(error).__name__}: {error}"}
report.write_text(json.dumps(results, indent=1, sort_keys=True))
print(len(results), "cases")


if __name__ == "__main__":
main()
28 changes: 24 additions & 4 deletions docs/dev/specs/itl-1347-job-table-transport.md
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,24 @@ Counted on `origin/main`, by file, excluding database cursors' own `execute`:

The function is still called once per row. Everything around the call is Arrow data.

**The one precondition (stage 2's, ITL-1361 review).** Every fast path of stages 3 and 4
(the entry ids from the input table's slices, the output's rows of stored results taken
from their stored table, a side-effect node's pass-through as F of its input table) is
used only where the table is provably its rows': the stream is exactly an
`ArrowTableStream` (or the row-built stream a job hands a node), with no member replaced on
the instance, in the node's data context, with system tags that are what rows give
(`system_tags_as_rows_give`: non-null `large_string` fields without field metadata,
holding no null; stage 2's source and operator routes use the same helper), no meta
(`__`) column, and no column a datagram would retype (`_slices_are_rows`; a stored table
is checked the same way). A row's data hash is computed once, when its entry id is
prepared, and a datagram built later for the row keeps it
(`Datagram._keep_content_hash`): the full input datagram is not hashed again for its entry
id or pipeline record. A projection of it (`function_input(...)`, the result cache's input
when data-tags fall through) is another datagram with its own content hash, as on `main`.
Anything else takes `main`'s row path. The entry id has one definition on both paths: the preimage's last
column is `_with_input_data_hash`, and the input data hash is `data_table_content_hash`, a
data datagram's content hash.

1. **Input as Arrow data.** For each input row, the node computes the base entry id from that
row's slice of the Arrow table or record batch: the tag side with system tags, plus the
input data hash. This is the same one-row preimage `_build_record_id_preimage` builds
Expand Down Expand Up @@ -872,10 +890,12 @@ view**: one internal class, `RowView`, that satisfies `TagProtocol` or `DataProt
Arrow table or record batch and a row index. It builds the datagram only when it is first
read.

- `RunCountingObserver` reads only the label and the `cached` flag, so it makes no row.
- The status and logging observers read tag values, so they make the tag datagram of the
rows they report.
- A user's observer gets what it gets today.
- Only the library observers that read no input row, a closed set of exact classes
(`NoOpObserver`, `RunCountingObserver`, and a `CompositeObserver` of only such;
`_reads_no_rows`, never a subclass and never anything an observer states about
itself), receive row views (`_TagView`, `_DataView`, every protocol member declared on
the class). Every other observer receives the rows themselves, as on `main` (ITL-1361
review: a view is not a `Tag`).

Event order stays as today:
- sync: input order;
Expand Down
14 changes: 11 additions & 3 deletions docs/reference/hashing.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ test session with `-p tests.test_hashing.hash_site_trace`.
| schema identity | the `arrow_schema_v1` hashes of a source's or slot's Arrow tag and data schemas, or of a function's output Arrow schema | a source's content and pipeline identity, system-tag column names, the function `uri` | the `ContentHash` objects, nested | `utils/schema_utils.py:arrow_schema_identity`, `utils/schema_utils.py:compute_schema_hash`, `core/data_function.py:DataFunctionBase.output_data_schema_hash` |
| union and generic alias arguments | argument type hashes, sorted by digest, then label (ordering only) | the type hash, via the nested form | as above | `hashing/semantic_hashing/builtin_handlers.py:_sorted_hashes`, `hashing/semantic_hashing/builtin_handlers.py:_sorted_hashes.<locals>.<lambda>` |
| logical-type cell, scalar and container | a value-hashed cell's value hash | the Arrow table hash | `<identifier>::<label>:<digest>`; a container cell: count, then per element a marker, a u64 length and the element token | `hashing/visitors.py:SemanticHashingVisitor.visit_extension` |
| entry-id preimage | the input row's data hash | the entry id, and through it the instance id, the record id and the side-effect log key | `b"<label>:" + digest` | `core/row_ids.py:entry_id_preimage` |
| instance-id preimage | the row's entry id | the instance id | `b"<label>:" + digest` | `core/row_ids.py:instance_id_preimage` |
| entry-id preimage | the input row's data hash | the entry id, and through it the instance id, the record id and the side-effect log key | `b"<label>:" + digest` | `core/row_ids.py:entry_id_preimage_from_parts` |
| instance-id preimage | the row's entry id | the instance id | `b"<label>:" + digest` | `core/row_ids.py:instance_id_preimage_from_tokens` |
| record-id preimage | the recording node's content hash, the row's instance id | the pipeline record id | `b"<label>:" + digest` | `core/row_ids.py:record_id_preimage` |
| operator-cache row | the node content hash | `_record_hash` | `b"<label>:" + digest` | `core/nodes/operator_node.py:OperatorJobNode._store_output_stream` |
| raw-stream tie-break | the Arrow hash (`arrow_v1`) of each row of a tie group | the canonical row order of a raw stream's identity table (compared as bytes, then the table is hashed whole) | `b"<label>:" + digest` | `utils/arrow_utils.py:canonical_identity_row_order` |
Expand All @@ -359,7 +359,7 @@ test session with `-p tests.test_hashing.hash_site_trace`.
|---|---|
| `__input_data_hash`, `__output_data_hash` | `core/result_cache.py:ResultCache.store`, `core/result_cache.py:ResultCache.lookup`, `core/nodes/function_node.py:FunctionJobNode._add_pipeline_record` |
| `__node_content_hash` | `core/nodes/function_node.py:FunctionJobNode._add_pipeline_record`, `core/nodes/function_node.py:FunctionJobNode._fetch_joined_records`, `core/nodes/function_node.py:FunctionJobNode._stored_record_count`, `core/nodes/operator_node.py:OperatorJobNode._store_output_stream`, `core/nodes/operator_node.py:OperatorJobNode._filter_by_content_hash` |
| `__pipeline_instance_id`, the pipeline record id | `core/nodes/function_node.py:FunctionJobNode.compute_instance_id`, `core/nodes/function_node.py:FunctionJobNode._add_pipeline_record` |
| `__pipeline_instance_id`, the pipeline record id | `core/nodes/function_node.py:FunctionJobNode.compute_instance_id`, `core/nodes/function_node.py:FunctionJobNode._instance_id_of_slices`, `core/nodes/function_node.py:FunctionJobNode._add_pipeline_record` |
| `_record_hash` of operator-cache and cached-source tables; the operator cache's `__pipeline_entry_id` | `core/nodes/operator_node.py:OperatorJobNode._store_output_stream`, `core/sources/cached_source.py:CachedSource._live_records` |
| side-effect log key and `entry_id` | `side_effects.py:_execute_side_effect_row` |
| the `_content_hash` column | `core/streams/arrow_table_stream.py:ArrowTableStream._assemble_table.<locals>.hashes`, `core/function_pod.py:FunctionPodStream.as_table.<locals>.all_content_hashes`, `core/function_pod.py:FunctionPodStream.head.<locals>.shown_content_hashes`, `core/function_pod.py:FunctionPodStream.head.<locals>.<lambda>`, `core/nodes/function_node.py:FunctionNodeBase.as_table.<locals>.all_content_hashes`, `core/nodes/function_node.py:FunctionNodeBase._head_of_pairs.<locals>.<lambda>`, `side_effects.py:_table_of_rows` |
Expand Down Expand Up @@ -1255,6 +1255,14 @@ preimage = tag.as_table(columns={"system_tags": True})
| **Uniqueness guarantee** | Unique per `(tag lineage, input_data content)` |
| **Known exclusions** | `NODE_CONTENT_HASH_COL` excluded: the table path does not determine it (with the default pipeline-hash scope one table holds the rows of several nodes), so a pipeline row stores it in `__node_content_hash` and the record id, the table's key, covers it (Site 8b); the entry id and the instance id are a function of the row alone. The source-info tokens are excluded by design: they are provenance, and enter the instance id. |

A synchronous function job node can compute the entry and instance ids from one-row
slices of its input's Arrow table (ITL-1361). The slice path checks that the tag, data
and source-info columns can reproduce the datagram path's preimages. Both paths use
`data_table_content_hash` for the data digest and the same preimage builders in
`core/row_ids.py`. The slice path applies the same source-info normalization as
`Data.source_info_table()` before building the instance preimage. Other inputs and
the asynchronous path compute the instance id from datagrams.

---

### Site 8 — Instance id (`row_ids.instance_id`)
Expand Down
Loading
Loading