title: Type MisMatch Require Tuple2, but Map Found
body: <p>it seems that we can't use Map as the return type, the below code will show error, <strong><em>Tuple2 require, but Map Found.</em></strong>, Any tips is appreciated. Thanks~</p>
  
  <pre><code>def GetCategories(df: DataFrame, col: String)= mutable.Map[String, Int] {
    val distinctValues = df.select(col).distinct().collect()
    var dict: Map[String, Int] = mutable.Map[String, Int]()
  
    for (a &lt;- 0 until distinctValues.size) {
      dict.put(distinctValues(a).toString(), a)
    }
  
    dict.foreach(println)
    dict
  }
  </code></pre>