Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17879#discussion_r115115725
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/feature/StringIndexer.scala ---
    @@ -107,11 +135,15 @@ class StringIndexer @Since("1.4.0") (
       @Since("2.0.0")
       override def fit(dataset: Dataset[_]): StringIndexerModel = {
         transformSchema(dataset.schema, logging = true)
    -    val counts = 
dataset.na.drop(Array($(inputCol))).select(col($(inputCol)).cast(StringType))
    -      .rdd
    -      .map(_.getString(0))
    -      .countByValue()
    -    val labels = counts.toSeq.sortBy(-_._2).map(_._1).toArray
    +    val values = dataset.na.drop(Array($(inputCol)))
    +      .select(col($(inputCol)).cast(StringType))
    +      .rdd.map(_.getString(0))
    +    val labels = $(stringOrderType) match {
    +      case "freq_desc" => 
values.countByValue().toSeq.sortBy(-_._2).map(_._1).toArray
    --- End diff --
    
    Seems this setting is case-insensitive because your param validator doesn't 
care it, `$(stringOrderType)` might be upper-case here. We may make it 
case-sensitive or do `toLowerCase` here?


---
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]

Reply via email to