Skip to content

[Python] Report dotted column names in Lance exports - #11635

Open
w-yfan wants to merge 1 commit into
apache:masterfrom
w-yfan:codex/lance-export-dotted-columns
Open

w-yfan wants to merge 1 commit into
apache:masterfrom
w-yfan:codex/lance-export-dotted-columns

Conversation

@w-yfan

@w-yfan w-yfan commented Dec 2, 2026

Copy link
Copy Markdown

Purpose

Validate the resolved top-level output column names before writing a Lance dataset. A column name containing a dot now produces a ValueError that 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.

@Akash3121 Akash3121 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}]).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants