Skip to content

Commit 2d33323

Browse files
committed
[MLlib] Add support for BooleanType to VectorAssembler.
Author: Reynold Xin <[email protected]> Closes apache#5648 from rxin/vectorAssembler-boolean and squashes the following commits: 1bf3d40 [Reynold Xin] [MLlib] Add support for BooleanType to VectorAssembler.
1 parent d9e70f3 commit 2d33323

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mllib/src/main/scala/org/apache/spark/ml/feature/VectorAssembler.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class VectorAssembler extends Transformer with HasInputCols with HasOutputCol {
5555
schema(c).dataType match {
5656
case DoubleType => UnresolvedAttribute(c)
5757
case t if t.isInstanceOf[VectorUDT] => UnresolvedAttribute(c)
58-
case _: NumericType =>
58+
case _: NumericType | BooleanType =>
5959
Alias(Cast(UnresolvedAttribute(c), DoubleType), s"${c}_double_$uid")()
6060
}
6161
}
@@ -68,7 +68,7 @@ class VectorAssembler extends Transformer with HasInputCols with HasOutputCol {
6868
val outputColName = map(outputCol)
6969
val inputDataTypes = inputColNames.map(name => schema(name).dataType)
7070
inputDataTypes.foreach {
71-
case _: NumericType =>
71+
case _: NumericType | BooleanType =>
7272
case t if t.isInstanceOf[VectorUDT] =>
7373
case other =>
7474
throw new IllegalArgumentException(s"Data type $other is not supported.")

0 commit comments

Comments
 (0)