Description
Reproducible example:
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)
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.