You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Joseph K. Bradley (JIRA)" <ji...@apache.org> on 2015/09/14 19:03:46 UTC

[jira] [Commented] (SPARK-10573) IndexToString transformSchema adds output field as DoubleType

    [ https://issues.apache.org/jira/browse/SPARK-10573?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14743825#comment-14743825 ] 

Joseph K. Bradley commented on SPARK-10573:
-------------------------------------------

I think your assessment is correct.  Would you mind sending a PR?  Thanks!

> IndexToString transformSchema adds output field as DoubleType
> -------------------------------------------------------------
>
>                 Key: SPARK-10573
>                 URL: https://issues.apache.org/jira/browse/SPARK-10573
>             Project: Spark
>          Issue Type: Bug
>          Components: ML
>    Affects Versions: 1.5.0
>            Reporter: Nick Pritchard
>
> Reproducible example:
> {code}
> val stage = new IndexToString().setInputCol("input").setOutputCol("output")
> val inSchema = StructType(Seq(StructField("input", DoubleType)))
> val outSchema = stage.transformSchema(inSchema)
> assert(outSchema("output").dataType == StringType)
> {code}
> The root cause seems to be that it uses {{NominalAttribute.toStructField}} which assumes {{DoubleType}}. It would probably be better to just use {{SchemaUtils.appendColumn}} and explicitly set the data type.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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