Repository navigation
[Python] Report dotted column names in Lance exports #11635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -384,6 +384,19 @@ def test_export_lance_rejects_invalid_projection_before_writing(conn, tmp_path, | |
| assert not path.exists() | ||
|
|
||
|
|
||
| def test_export_lance_rejects_dotted_output_column_before_writing(conn, tmp_path): | ||
| table = _table(conn, "dotted_columns", {"id": pa.int32(), "next.done": pa.bool_()}, | ||
| [{"id": 1, "next.done": True}]) | ||
| path = tmp_path / "dotted_columns.lance" | ||
|
|
||
| with pytest.raises(ValueError, match=r"'next\.done'.*project it out"): | ||
| table.scan().export_lance(str(path)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Since |
||
|
|
||
| assert not path.exists() | ||
| table.scan().select(["id"]).export_lance(str(path)) | ||
| assert _rows(path) == [{"id": 1}] | ||
|
|
||
|
|
||
| def test_export_lance_rejects_search_queries(conn, tmp_path): | ||
| table = _table(conn, "search", {"id": pa.int32(), "embedding": pa.list_(pa.float32(), 2)}) | ||
| queries = [ | ||
|
|
||
There was a problem hiding this comment.
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 overfieldsto validate each output column before building the Arrow/Lance schema. Moving thisif "." in field.name:check into_validate_export_fieldswould keep all output-field checks in one helper and avoid iterating overfieldstwice.