Repository navigation
fix(sources)!: DataFrameSource accepts data frames only; Python containers go to DictSource or ListSource (ITL-1330) - #624
Draft
eywalker wants to merge 132 commits into
Conversation
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…(ITL-1471) core/row_ids.py holds the three nested row ids and their preimages. A data datagram gives its source-info tokens as a one-row table (source_info_table), and the EmptyData placeholder carries tokens built as a real output's are, with the sentinel EPHEMERAL_RESULT_GONE in place of the result id. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…_v2, tdb_v2 (ITL-1471) A function node looks a row up by its instance id and keys it by its record id; the recomputation index and the query before every write are gone. Side effects and functions that take the invocation context are keyed by the entry id, the log column record_id_hash is entry_id, and PostRunPayload.record_id_hash is result_id. The operator cache stores the entry id and its insertion time beside its row key, outside the key. FunctionRun.entry_id is record_id. BREAKING CHANGE: stored pipeline tables, operator caches and side-effect logs move to new layouts; every invocation hash changes once; an operator cache on a SQLite database is refused when it is attached. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…n changes (ITL-1471) A pipeline table's record id holds the result id, a UUIDv7, so it cannot be pinned: the golden cases pin the instance ids instead. The 18 changes the developer approved on 2026-11-25 (golden-changes.md of ITL-1466): 6 record-id pins removed, 6 instance-id pins added, 6 table paths moved from pdb_v1 to pdb_v2, in pipeline-02.json (4 entries) and provisional/pipeline.json (8), and the open revision of v1.json. No other value moves. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…TL-1471) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ut (ITL-1471) On the async path the second copy of an identical input either computes its own result (two records) or takes the first's (one record), by scheduling. The first CI run showed the second outcome. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…described (ITL-1471) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Failing on b556376: placeholders fed through async_execute, both jobs' traces after a token-only rerun, and an inactive function node given rows whose token column cannot be typed again from its values. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…input hash (ITL-1471) async_execute sent a placeholder whose instance is not stored to the function like any miss; the pipeline writer then read it as a table and raised EmptyDataAccessError although the result was stored. It now goes to _empty_data_cache_hit, as on the sync route: no call, no pipeline row. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
After a token-only rerun a function's table holds two records of one entry that name one result. The trace matched on system tags and result alone, found both and refused every row of the first job. It now keeps the entry whose stored input tokens are the input row's. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…L-1471) A row read from an Arrow table keeps that table's source-info columns, and source_info_table() returns them with a row's own nullable fields. A token's type is never worked out again from its value, so a lookup no longer fails on rows with a nested token column that the function is never called for. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…races and placeholders (ITL-1471) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…lumn types (ITL-1471) Failing on 2d8a6a8: a token column whose Arrow type is not the type its values would be given again (a list column holding a null; a nested list). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…as made from (ITL-1471)
_add_pipeline_record stored the columns of as_table(columns={'source': True}),
typed again from the token values, while the instance id read the row's typed
columns. One helper, source_info_table(), now gives both, so every stored row
gives its instance and record id again from its own columns. For ordinary rows
the two tables are equal, so no stored column type and no id moves.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…nested tokens are recorded (ITL-1471) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
source_info_table() of a row with no token has no column and no row; the pipeline record leaves it out, as before the change, and the row's ids are recomputed from the stored row all the same. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ference (ITL-1471) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Failing on f3f6842 (18 cases): two nodes sharing a pipeline table, a trace over the source after a rerun with other tokens, and a placeholder without a stored result under the row failure policy on the async route. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…; placeholders under the row failure policy (ITL-1471) One pipeline table holds the rows of every node with one pipeline hash. Keyed by the record id alone, a second node that recorded a shared instance with the cached result lost its row as a duplicate. The key is now the node's content hash with the record id (row_ids.pipeline_row_key), and the record id is stored in its own column; its recipe is unchanged. On the async route a placeholder whose result is not stored is one failed row under the row failure policy, with the sync route's events (the row starts before the lookup), instead of aborting the run. FunctionJobNode.held_instance_ids says which instance each held row is under. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ry branch (ITL-1471) The branch for a function over its source took the one entry before choosing an instance, and the other branch compared token values. Both now keep the stored records of the instance id the node holds the row under. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…e placeholder policy (ITL-1471) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ry (ITL-1471) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Failing on 69d8ec1 (17 cases): sessions whose null tokens are typed differently share a table; a null token's instance id does not follow its column's type; differing token types in one table are refused naming the column. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…or two types in one column (ITL-1471) A null token is a large_string null whatever type its column declares, for the instance id's preimage and for the stored column alike; a non-null token keeps its typed column. So sessions whose null token columns are declared differently share a pipeline table again, and a null token's instance id is a function of the row alone. A row whose token column has another type than the rows recorded is refused naming the column and both types. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ma read (ITL-1471) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…e events on both routes (ITL-1471) Failing on 4a916ec (4 cases): the async route reports the row's start only. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…fore a fatal error stops the run (ITL-1471) A database error or an identity error in a placeholder's result lookup is never a row failure. The async route raised it after the row's start event alone; it now reports the row's crash first, as the sync route does. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…thon into eywalker/itl-1557-re-evaluate-a-sources-source-info-token # Conflicts: # tests/test_channels/test_native_async_operators.py
A dict, a list or any other container of Python values, a NumPy array, a Series and a LazyFrame are refused when the source is built, with a TypeError naming the type given and the remedy. Python values go to DictSource or ListSource, which type them by Orcapod's rules; Polars no longer types them around those rules (nanoseconds dropped, naive datetimes stored unzoned). BREAKING CHANGE: DataFrameSource no longer builds from Python containers. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
|
…thon into eywalker/itl-1557-re-evaluate-a-sources-source-info-token
Restate the PR 601 item-metadata channel test for the declared-type rule, and document the held-type replacement rule and the first-batch rule (ITL-1557). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Result-cache validation now sees the Arrow token type on serialization even when its value is null. Enable the regression test and update the result-cache documentation.
…sources-source-info-token' into eywalker/itl-1330-dataframesource-built-from-python-values
Base automatically changed from
eywalker/itl-1557-re-evaluate-a-sources-source-info-token
to
main
November 28, 2026 21:45
…aframesource-built-from-python-values
…aframesource-built-from-python-values
…aframesource-built-from-python-values
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes ITL-1330
Includes
mainthrough3e640fb5, including #607, #633, #634 and #645. This draft restrictsDataFrameSourceto data frames and retains the existing conversion for supported frames.Data frame inputs
DataFrameSourceaccepts pandas and Polars data frames and Arrow C exporters of struct data, including Arrow tables, record batches and record batch readers. Python containers, NumPy arrays, pandas or Polars Series, Polars lazy frames, and non-struct Arrow exporters raiseTypeErrorduring construction. The message names the input type and gives a remedy. UseDictSourcefor row dictionaries andListSourcefor lists of values. Convert mappings of Python columns to row dictionaries forDictSource. Useto_frame()for a Series andcollect()for a lazy frame. For NumPy inputs, including lists, tuples and mappings that mix arrays with Python lists, or non-struct Arrow data, build apyarrow.Tablewith named columns of supported types and pass it toArrowTableSource. For an iterator of positional rows that Polars can infer as supported Arrow columns, useArrowTableSource(pl.DataFrame(data).to_arrow()). For Polars Series with distinct names and supported Arrow types, useArrowTableSource(pa.table({series.name: series for series in data})).Column type declarations
Pandas
objectcolumns require an explicitschema=(D26). With a schema, the source uses native frame conversion, drops auxiliary system columns and casts the remaining Arrow table to the schema. PolarsObjectcolumns use the same conversion as on main, including for frames without a schema. The existing custom system tag checks still apply.string, Arrow-backed dtypes and typed datetime columnsobjectObjectFor a pandas object column supplied without a schema, the error names the column and points to
schema=, a typed dtype orDictSource. To preserve timestamp nanoseconds, build a typed pandas datetime column withpd.to_datetimeand use atimestamp[ns]field. Native frame conversion can truncate these timestamps when they are carried in object columns.Verification
Public-interface tests cover input eligibility, typed frame values and identities, object declarations across column roles and layouts, categorical and Polars Object columns, and the existing cast's successful values and refusals. Golden hashes and the source ID pinned by the existing input tests match.
Review findings
No CodeRabbit review threads were present when this draft was updated.
framecases intest_in_memory_sources_register_by_objectpassed onmainand raisedTypeErroron the merged draft because the fixture passed a list toDataFrameSource. The fixture now constructs a Polars frame and still checks source registration with both orchestrators.mainand failed on the merged draft because the example constructed an object-typedcountscolumn. The sample now uses Arrow-backed pandas dtypes and produces the four documented results.Independent review
Compared the reviewed head with
origin/mainat146fcbfbefore applying the fixes.test_declared_pandas_object_columns_convert_missing_values_to_nulls,test_declared_pandas_missing_values_require_nullable_fieldspd.NAin a nullable list itemlist<int64>column with[[1, pd.NA], []]stores[[1, None], []]on main and raised during construction on the reviewed head.test_declared_pandas_object_columns_convert_missing_values_to_nulls, including list items and struct fieldsDataFrameSource(pa.array([1, 2]))and its chunked equivalent. The PR promises a refusal that names the input type and gives a remedy. Both routes now point toArrowTableSourcewith a named table column.test_non_struct_arrow_exporters_are_refused_with_a_remedytest_several_declared_pandas_object_columnsexercises multiple declared objects, two custom system tags, two keys, both key and tag orders, two layouts, and plain and data-tag roles. It checks column names, values, source and record IDs, hashes, and sync and async rows.to_frame()andcollect()remedies. The changelog now describes the current refusals and their remedies.test_an_input_that_is_not_a_data_frame_is_refusedchecks both remedies.After the fix, 420 accepted cases in the main comparison matched in values, source IDs, content hashes, and pipeline hashes. The comparison covered
None, Python NaN,pd.NA, andpd.NaTin declared scalar fields, variable and fixed-size list items, and struct fields. Golden hashes and the source ID pinned by the existing input tests matched.Independent review of
f05a7cebCompared the reviewed draft with
origin/mainata958449a. The draft had bypassed the native pandas-to-Polars conversion and Arrow schema cast for declared object columns. Restoring that path resolved the differences below.test_declared_pandas_object_columns_use_native_frame_conversion,test_declared_float16_keeps_numpy_float32_nan[True, False]to[1, 0]. The draft refused both values.test_declared_pandas_object_columns_use_native_frame_conversiontest_declared_pandas_object_columns_use_native_frame_conversiondecimal128(12, 2), a Boolean for Float16, and all-None object columns declared as time or duration.test_declared_pandas_object_columns_keep_native_cast_errorstest_pandas_declared_object_timestamp_uses_native_precision,test_pandas_declared_object_duration_uses_native_precision,test_pandas_typed_timestamps_keep_nanosecondstest_pandas_categorical_keeps_native_conversion,test_declared_pandas_string_categorical_cast_decodes_dictionary,test_declared_polars_object_column_keeps_native_conversionThe differential matrix crossed 31 Arrow types with 55 Python, NumPy and pandas value cases, seven field shapes (scalar, variable list, fixed list, struct, list of structs, struct containing a list, map), and top-level nullability. Values included bool, signed and unsigned integers, float, Decimal, text, bytes, temporal values, every NumPy integer and float width, missing values, lists and dicts. The 55 cells combining a required scalar null field with each value were excluded. Of 23,815 cells, the reviewed draft refused 2,990 that main accepted, accepted 52 that main refused, and changed the output in 36 accepted cases. After the fix, all 23,815 matched main for acceptance or refusal. All 7,294 accepted cells also matched the Arrow table bytes, default source ID, content hash and pipeline hash.
Independent review of
eeea191bReproduced all three findings on
origin/mainata958449aand the reviewed draft before applying the fixes.schema=pa.schema([("x", pa.int64())]), main accepts a pandas or Polars frame with integerxand an object-typed_note. It drops_noteand emits nullable Int64x. The reviewed draft refused both frames.test_schema_ignores_auxiliary_object_columnpl.DataFrame({"x": pl.Series([1, 2], dtype=pl.Object)})and emits non-nullable Int64x. The reviewed draft required a schema. D26 applies to pandas.test_polars_object_column_without_schema_keeps_native_conversionArrowTableSourcewith named Arrow columns and retain the Polars frame option.test_numpy_inputs_are_refused_with_a_named_sourceThe five new test cases failed on the reviewed head and pass after the fix. The accepted frame reproductions match main in Arrow schema, values, default source ID, content hash and pipeline hash.
Independent review of
cb6449b3Reproduced both findings on
origin/mainatbf2582d4and the reviewed head.(np.array([1, 2]), np.array([3, 4]))and a mapping of names to those arrays as two-column tables. The reviewed head refuses both as intended and omits the promised Arrow migration. The refusal now names the container type and points to named table columns andArrowTableSource. Mapping guidance also explains how to prepare rows forDictSource.test_numpy_inputs_are_refused_with_a_named_source,test_the_refusal_of_a_python_container_points_to_both_sourcesDataFrameSource(pa.array(["a", "b"]).dictionary_encode())andDataFrameSource(pa.nulls(2))raise Arrow's schema error on main and give the recipe on the reviewed head. On both revisions,ArrowTableSource(pa.table({"column": data}))refuses those column types. The refusal now directs users to a named table with supported column types.test_non_struct_arrow_exporters_are_refused_with_a_remedychecks arrays and chunked arrays, and verifies migration after decoding a dictionary array or typing a null array.The eight new or tightened diagnostic checks failed before the changes and pass with them.
Independent review of
7b658d2borigin/mainat3e640fb5,DataFrameSource((np.array([1, 2]), [3, 4]))builds two non-nullable Int64 columns with rows(1, 3)and(2, 4). I reproduced the same result with a list and with the array in either position. The reviewed head intentionally refuses all four inputs and omits the promised Arrow migration. One diagnostic builder now names the container and its item types and explains how to build a namedpyarrow.TableforArrowTableSourceor Python row dictionaries forDictSource. The parametrized tests cover all four mixed variants and verify that Arrow tables and record batches still build.Independent review of
39efb582Reproduced both findings against
origin/mainat08c048a7and the reviewed draft.test_mixed_row_iterators_can_migrate_to_arrow_table_sourceappliesArrowTableSource(pl.DataFrame(data).to_arrow())to the original iterator and compares the rows in both item orders, for generators and list iterators.test_named_polars_series_can_migrate_to_arrow_table_sourceappliesArrowTableSource(pa.table({series.name: series for series in data}))to the original list, tuple, or generator and checks column names and rows. The test also verifies the frame option for lists and tuples.The four mixed list and tuple cases also run each recipe from the diagnostic and verify the resulting rows.
Found in review, present on main, not addressed here
PRE-EXISTING (input eligibility).
DataFrameSource(pd.Series([1, 2]))andDataFrameSource(pl.DataFrame({"x": [1, 2]}).lazy())already failed on main. See the migration guidance above.PRE-EXISTING (input eligibility).
DataFrameSource(pa.array([1, 2]))andDataFrameSource(pa.chunked_array([[1], [2]]))already failed on main. The incomplete refusal message is addressed above.PRE-EXISTING (NumPy NaN). An object column containing
np.float32("nan")stores NaN in declared Float32 and Float64 fields on main, the reviewed draft and the updated draft.PRE-EXISTING (timestamp precision).
pd.Series([pd.Timestamp("2026-01-02T03:04:05.123456789Z")], dtype=object)loses 789 ns during main's frame conversion even with a declaredtimestamp[ns, UTC]field. The updated draft matches main.PRE-EXISTING (custom system tags). A Polars Object column created with
pl.Series(["left"], dtype=pl.Object)is refused as a custom system tag even with a non-nullable text field. Use a typed text column.