[pyspark] Validate the validation indicator column type.#11535
Merged
Conversation
273def2 to
dac4a67
Compare
Member
Author
Contributor
There was a problem hiding this comment.
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):
Contributor
|
How about validating validation_indicator ahead of time, like in the driver side? |
bac33d7 to
796409d
Compare
Member
Author
|
Changed to the driver side. |
Member
Author
|
ping @wbo4958 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close #11496 .