File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
mllib/src/main/scala/org/apache/spark/mllib/tree/impl Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -107,11 +107,11 @@ private[tree] object DecisionTreeMetadata extends Logging {
107107 numTrees : Int ,
108108 featureSubsetStrategy : String ): DecisionTreeMetadata = {
109109
110- require(! input.isEmpty, s " DecisionTree requires size of input RDD > 0, " +
111- s " but was given by an empty one. " )
112-
110+ val numFeatures = input.map(_.features.size).take(1 ).headOption.getOrElse {
111+ throw new IllegalArgumentException (s " DecisionTree requires size of input RDD > 0, " +
112+ s " but was given by empty one. " )
113+ }
113114 val numExamples = input.count()
114- val numFeatures = input.take(1 )(0 ).features.size
115115 val numClasses = strategy.algo match {
116116 case Classification => strategy.numClasses
117117 case Regression => 0
You can’t perform that action at this time.
0 commit comments