Skip to content

[pyspark] Validate the validation indicator column type.#11535

Merged
trivialfis merged 3 commits into
dmlc:masterfrom
trivialfis:pyspark-check-valid-col
Jul 2, 2025
Merged

[pyspark] Validate the validation indicator column type.#11535
trivialfis merged 3 commits into
dmlc:masterfrom
trivialfis:pyspark-check-valid-col

Conversation

@trivialfis

Copy link
Copy Markdown
Member

Close #11496 .

@trivialfis trivialfis changed the title [pyspark] Validation the validation indicator column type. [pyspark] Validate the validation indicator column type. Jun 26, 2025
@trivialfis trivialfis force-pushed the pyspark-check-valid-col branch from 273def2 to dac4a67 Compare June 26, 2025 07:21
@trivialfis

Copy link
Copy Markdown
Member Author

cc @wbo4958 @WeichenXu123

@trivialfis trivialfis requested a review from Copilot June 27, 2025 04:41

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 pull request introduces validation to ensure that the validation indicator column is of boolean type. Key changes include:

  • Addition of a new test (test_valid_type) in the Spark test suite to verify that non-boolean indicator values result in an error.
  • Introduction of the helper function is_bool_column in the Spark data module.
  • Update of the make_blob function to raise a TypeError when the validation indicator column is not boolean.

Reviewed Changes

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

File Description
tests/test_distributed/test_with_spark/test_spark_local.py Added a negative test case to confirm the validation indicator column type check
python-package/xgboost/spark/data.py Added is_bool_column helper and updated make_blob to raise an error if the column type is invalid
Comments suppressed due to low confidence (2)

tests/test_distributed/test_with_spark/test_spark_local.py:1311

  • [nitpick] Consider adding a brief inline comment to explain why a generic Exception is expected in this test case due to the variability of Spark's error types.
    def test_valid_type(self, spark: SparkSession) -> None:

python-package/xgboost/spark/data.py:75

  • [nitpick] It may be helpful to include an inline comment clarifying the dual check using both cuDF and pandas boolean type verifications to improve maintainability.
            if not is_bool_column(col.dtype):

@wbo4958

wbo4958 commented Jun 30, 2025

Copy link
Copy Markdown
Contributor

How about validating validation_indicator ahead of time, like in the driver side?

@trivialfis trivialfis force-pushed the pyspark-check-valid-col branch from bac33d7 to 796409d Compare June 30, 2025 09:47
@trivialfis

Copy link
Copy Markdown
Member Author

Changed to the driver side.

@trivialfis

Copy link
Copy Markdown
Member Author

ping @wbo4958

@wbo4958 wbo4958 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.

@trivialfis trivialfis merged commit 4a78c3a into dmlc:master Jul 2, 2025
60 of 61 checks passed
@trivialfis trivialfis deleted the pyspark-check-valid-col branch July 2, 2025 08:47
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.

XGBoost Stage failed because barrier task ResultTask

3 participants