Repository navigation
Conversation
Akash3121
left a comment
There was a problem hiding this comment.
LGTM, Added couple nitpicks
| for field in fields: | ||
| if "." in field.name: | ||
| raise ValueError( | ||
| "export_lance does not support '.' in top-level column %r; project it out." % field.name) |
There was a problem hiding this comment.
Nit: _validate_export_fields(query._table, fields) right below already iterates over fields to validate each output column before building the Arrow/Lance schema. Moving this if "." in field.name: check into _validate_export_fields would keep all output-field checks in one helper and avoid iterating over fields twice.
| path = tmp_path / "dotted_columns.lance" | ||
|
|
||
| with pytest.raises(ValueError, match=r"'next\.done'.*project it out"): | ||
| table.scan().export_lance(str(path)) |
There was a problem hiding this comment.
Nit: Since _blob_descriptor_query_read_builder() appends predicate-only columns to internal_projection before _transform_batch strips them out, it would be nice to also verify that filtering on the dotted column while projecting it out succeeds (e.g., adding a second row {"id": 2, "next.done": False} and asserting table.scan().where("next.done = true").select(["id"]).export_lance(str(path)) exports [{"id": 1}]).
Purpose
Validate the resolved top-level output column names before writing a Lance dataset. A column name containing a dot now produces a
ValueErrorthat names the column and explains how to exclude it from the export.Related to #11630.
Tests
Ran 121 Lance export tests with PyLance 13.0.0. The new regression checks the error message, verifies that the destination is left absent, and exports successfully after projecting out the dotted column.