Github user MLnick commented on a diff in the pull request:
https://github.com/apache/spark/pull/13411#discussion_r65631481
--- Diff:
mllib/src/main/scala/org/apache/spark/ml/feature/MaxAbsScaler.scala ---
@@ -39,9 +39,7 @@ private[feature] trait MaxAbsScalerParams extends Params
with HasInputCol with H
/** Validates and transforms the input schema. */
protected def validateAndTransformSchema(schema: StructType): StructType
= {
- val inputType = schema($(inputCol)).dataType
- require(inputType.isInstanceOf[VectorUDT],
- s"Input column ${$(inputCol)} must be a vector column")
+ SchemaUtils.checkColumnType(schema, $(inputCol), new VectorUDT)
--- End diff --
just a note on this - the fact that it requires `new VectorUDT` results in
a message that contains `VectorUDT@XYZ` i.e. an instance, which is ok but not
ideal. For the built-in types we have a case object that makes it cleaner, so
we could think about doing that for VectorUDT as it is used a lot, e.g.
```
private[spark] case object VectorUDT extends VectorUDT
```
Or alternatively, in `SchemaUtils.checkColumnType` we could use
`getClass.getName` instead.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]