[jvm-packages] fix "key not found: train" issue (#6842)

* [jvm-packages] fix "key not found: train" issue

* fix bug
This commit is contained in:
Bobby Wang
2021-04-19 14:28:39 +08:00
committed by GitHub
parent 556a83022d
commit 2c684ffd32
2 changed files with 16 additions and 2 deletions

View File

@@ -377,7 +377,7 @@ object XGBoost extends Serializable {
// to workaround the empty partitions in training dataset,
// this might not be the best efficient implementation, see
// (https://github.com/dmlc/xgboost/issues/1277)
if (watches.toMap("train").rowNum == 0) {
if (!watches.toMap.contains("train")) {
throw new XGBoostError(
s"detected an empty partition in the training data, partition ID:" +
s" ${TaskContext.getPartitionId()}")