Skip to content

fix(polars): support pl.Object conversion to dt.Unknown in PolarsType.to_ibis - #12086

Open
AhmadBilalDSA wants to merge 1 commit into
ibis-project:mainfrom
AhmadBilalDSA:fix/duckdb-compiler-parity
Open

fix(polars): support pl.Object conversion to dt.Unknown in PolarsType.to_ibis#12086
AhmadBilalDSA wants to merge 1 commit into
ibis-project:mainfrom
AhmadBilalDSA:fix/duckdb-compiler-parity

Conversation

@AhmadBilalDSA

Copy link
Copy Markdown

Description

When inferring or converting schemas from Polars tables containing Python object columns (pl.Object), PolarsType.to_ibis previously raised a KeyError: Object due to pl.Object missing from the inverse lookup registry.

This PR adds explicit handling for pl.Object to map cleanly to dt.Unknown(nullable=nullable), matching expected schema behavior when encountering uncoerced Python object columns.

Checklist

  • Added pl.Object handling in ibis/formats/polars.py
  • Added unit test test_object_type_to_ibis in ibis/formats/tests/test_polars.py
  • Ran ruff check and ruff format
  • Verified pytest ibis/formats/tests/test_polars.py (41/41 passing)

@github-actions github-actions Bot added the tests Issues or PRs related to tests label Aug 24, 2026

@deepyaman deepyaman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the PR. Without an issue or some more description, as well as lacking tests, it's not clear what the motivation is. (Sure, I can infer it's somewhere where you have data that maps to pl.Object, but where did you actually experience this bug, and how do I know that's fixed, without investigating myself.)

Comment on lines +180 to +181
def test_object_type_to_ibis():
assert PolarsType.to_ibis(pl.Object) == dt.Unknown()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is insufficient; at the very least, I think need something akin to https://github.com/ibis-project/ibis/blob/12.0.0/ibis/backends/postgres/tests/test_client.py#L207-L210 to test the actual use case.

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

Labels

tests Issues or PRs related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants