Skip to content
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

[pyspark] disable repartition_random_shuffle by default #8283

Merged
merged 2 commits into from Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion python-package/xgboost/spark/core.py
Expand Up @@ -88,6 +88,7 @@
"features_cols",
"enable_sparse_data_optim",
"qid_col",
"repartition_random_shuffle",
]

_non_booster_params = ["missing", "n_estimators", "feature_types", "feature_weights"]
Expand Down Expand Up @@ -477,7 +478,7 @@ def __init__(self):
num_workers=1,
use_gpu=False,
force_repartition=False,
repartition_random_shuffle=True,
repartition_random_shuffle=False,
feature_names=None,
feature_types=None,
arbitrary_params_dict={},
Expand Down
7 changes: 7 additions & 0 deletions python-package/xgboost/spark/data.py
Expand Up @@ -9,6 +9,8 @@

from xgboost import DataIter, DeviceQuantileDMatrix, DMatrix

from .utils import get_logger # type: ignore


def stack_series(series: pd.Series) -> np.ndarray:
"""Stack a series of arrays."""
Expand Down Expand Up @@ -246,6 +248,11 @@ def make(values: Dict[str, List[np.ndarray]], kwargs: Dict[str, Any]) -> DMatrix
else:
append_fn = append_m
cache_partitions(iterator, append_fn)
if len(train_data) == 0:
get_logger("XGBoostPySpark").warning(
"Detected an empty partition in the training data. "
"Consider to enable repartition_random_shuffle"
)
dtrain = make(train_data, kwargs)
else:
cache_partitions(iterator, append_dqm)
Expand Down