Skip to content

Require Enum from polars.#12240

Merged
trivialfis merged 2 commits into
dmlc:masterfrom
trivialfis:polars-enum
Jun 15, 2026
Merged

Require Enum from polars.#12240
trivialfis merged 2 commits into
dmlc:masterfrom
trivialfis:polars-enum

Conversation

@trivialfis

Copy link
Copy Markdown
Member

related: #12182

@trivialfis trivialfis changed the title [wip] Require Enum from polars. Require Enum from polars. Jun 11, 2026
@trivialfis trivialfis requested a review from Copilot June 11, 2026 09:20

Copilot AI 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.

Pull request overview

This PR changes the Python Polars data ingestion path to explicitly reject polars.Categorical columns (due to potentially sparse encodings) and requires users to provide polars.Enum instead, updating the Polars integration test accordingly.

Changes:

  • Add a Polars dtype guard that raises a ValueError when a polars.Categorical column is detected.
  • Update test_with_polars.py to expect the rejection of Categorical and validate Enum’s Arrow dictionary/indices behavior.
  • Refresh the test file copyright header.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/python/test_with_polars.py Updates categorical test to require pl.Enum and assert the new rejection behavior for pl.Categorical.
python-package/xgboost/data.py Introduces _reject_polars_categorical and applies it during Polars → Arrow transformation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@trivialfis trivialfis requested a review from RAMitchell June 11, 2026 10:40
@trivialfis trivialfis merged commit dbac88c into dmlc:master Jun 15, 2026
81 checks passed
@trivialfis trivialfis deleted the polars-enum branch June 15, 2026 09:48
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