Repository navigation
fix(sources): reject stored logical Arrow columns (ITL-1333) - #656
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…rce-refuses-stored-form-logical-column
…rce-refuses-stored-form-logical-column
…rce-refuses-stored-form-logical-column
|
@coderabbitai review Posted by a Codex agent on behalf of @eywalker. |
Action not completed
|
|
@coderabbitai review Posted by a Codex agent on behalf of @eywalker. |
Action not completed
|
Fixes ITL-1333
Sources now raise
InputValidationErrorwhen a plain Arrow field carries a logical type annotation, including in list, struct and map children. The error names the affected columns and their identifiers. Provide a live Arrow extension column, or drop its annotation when the values are meant as plain data.On main, the stored-form Path example read as plain text while sharing the pipeline and content hashes of the live Path example. After removing both extension annotations, the resulting ordinary text input has its own hashes. The golden hashes match and the live form retains its table and hashes.
A directly constructed
ArrowTableStreamretains main's behavior and reads the storage values. Cache, derived source, operator and function result reads retain their existing decoding.Independent review
origin/mainpa.ExtensionArray.from_storage(CustomExtension(), storage).InputValidationErrorafter the C round-trip.table.to_pandas(types_mapper=pd.ArrowDtype). Polars drops the unknown annotation.InputValidationError.The merge from main also brought in a Delta operator-log test that fed an annotated list through
ArrowTableSource. The test now injects the annotation through a raw stream with source provenance, so it still reaches the Delta write guard in both sync and async jobs.The UUID-list example from #654 now shows the source refusal and retains the hash comparison for accepted inputs.
Found in review, present on main, not addressed here
RuntimeErrorduring pandas ingestion. Reproduce withpl.DataFrame(table.to_pandas(types_mapper=pd.ArrowDtype))where the struct's string child carries the Path extension keys. The two Orcapod sources now catch the stored child before it reaches Polars.pa.table(ArroTable.from_arrow(normalize_extension_columns(live_paths)))and inspect the imported field type.int64storage before source validation. Write a Delta table whoseint64field carries the Path extension keys and open it withDeltaTableSourceto reproduce the sameTypeIdentityErroron both revisions.Second independent review
INCOMPLETE — a plain declaration hid stored logical annotations in Polars inputs. Build a Polars frame with two string columns marked using
pl.col("path", "other").ext.to(pl.Extension("test.polars.stored", pl.String, "{}")). Export it to Arrow and remove the metadata from the fields in the declared schema only. Bothorigin/main(1fb2a7f7) and the reviewed PR head (959001cd) accepted the annotated data throughDataFrameSourceand through synchronous and asynchronousPollingSourcereads. All six cases, covering both column orders, failed the refusal test on both revisions. Both sources now check the incoming fields before applying the plain declaration. Their error names both fields and gives the extension identifier and remedy.The shared check is
require_live_logical_types. Its source intake call sites are:ArrowTableSource,ListSource, and Python-inferredDictSourceSourceStreamBuilder.buildchecks the raw schema. Nullability inference preserves field metadata.DictSourcewith an Arrow declarationDictSource.__init__checks the declaration before conversion.DataFrameSourceandPollingSourceread_arrow_frame_inputchecks native PyArrow schemas before C import, other Arrow exporters after import, and pandas Arrow-backed dtypes before Polars ingestion.DataFrameSource.__init__checks the Polars Arrow exports before dropping reserved fields or applying a cast.PollingSource._build_stream_from_dfchecks the Polars Arrow export before rebuilding any fields, for both sync and async reads. Each source also checks its explicit Arrow declaration.CSVSourceCSVSource._read_tablechecks declarations before parsing. The builder checks inferred reader output.DBTableSource,SQLiteTableSource, andPostgreSQLTableSourceDBTableSource._read_tablechecks Arrow batches before applying database column information.DeltaTableSourceSourceStreamBuilder.buildchecks the dataset's Arrow table on open and rebuild.DeltaTableSource.check_for_new_datachecks a changed Arrow schema before reporting schema drift.SpiralDBTableSourceSpiralDBTableSource._read_batcheschecks raw Arrow batches before projection and enrichment.The intake coverage test walks the public source exports and verifies that every external source reader reaches the shared walker on an incoming data field. The cache and derived readers retain decoding for Orcapod-owned records. The proxy delegates to a bound source.
RootSourcedefines the shared base.Summary by CodeRabbit
Bug Fixes
Documentation