You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by MLnick <gi...@git.apache.org> on 2016/06/02 22:40:13 UTC

[GitHub] spark pull request #13411: [SPARK-15668] [ML] ml.feature: update check schem...

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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org