title: Cannot resolve overloaded method 'groupByKey'
body: <p>I'm trying to compile this code:</p>
  
  <pre><code>// Imports
  import org.apache.spark.sql.{Row, SQLContext, SparkSession}
  import org.apache.spark.sql.types._
  import org.apache.spark.{SparkConf, SparkContext}
  
  ...
  
  // Initialization
  val conf = new SparkConf().setAppName("spark-test").setMaster("local")
  val sc = new SparkContext(conf)
  val sparkSession = SparkSession.builder.config(sc.getConf).getOrCreate()
  import sparkSession.implicits._
  
  ...
  
  val sqlContext = sparkSession
  val dfPlayersT = sqlContext.createDataFrame(nPlayer,schemaN)
  
  dfPlayersT.createOrReplaceTempView("tPlayers")
  val dfPlayers = sqlContext.sql("select age-min_age as exp,tPlayers.* from 
    tPlayers join (select name,min(age)as min_age from tPlayers group by name) 
       as t1 on tPlayers.name=t1.name order by tPlayers.name, exp ")
  
  
  val pStats = dfPlayers.sort(dfPlayers("name"),dfPlayers("exp").asc)
    .map(x=&gt;(x.getString(1),(x.getDouble(50),x.getDouble(40),x.getInt(2),
      x.getInt(3),Array(x.getDouble(31),x.getDouble(32),x.getDouble(33),
      x.getDouble(34),x.getDouble(35),x.getDouble(36),x.getDouble(37),
      x.getDouble(38),x.getDouble(39)),x.getInt(0))))
      .groupByKey()  // Error
  </code></pre>
  
  <p>But getting an error:</p>
  
  <pre><code>Error:(217, 57) overloaded method value groupByKey with alternatives:
    [K](func: org.apache.spark.api.java.function.MapFunction[(String, (Double, Double, Int, Int, Array[Double], Int)),K], encoder: org.apache.spark.sql.Encoder[K])org.apache.spark.sql.KeyValueGroupedDataset[K,(String, (Double, Double, Int, Int, Array[Double], Int))] &lt;and&gt;
    [K](func: ((String, (Double, Double, Int, Int, Array[Double], Int))) =&gt; K)(implicit evidence$4: org.apache.spark.sql.Encoder[K])org.apache.spark.sql.KeyValueGroupedDataset[K,(String, (Double, Double, Int, Int, Array[Double], Int))]
   cannot be applied to ()
          x.getDouble(38),x.getDouble(39)),x.getInt(0)))).groupByKey()
  </code></pre>
  
  <p>Here's my build.sbt file:</p>
  
  <pre><code>name := "ScalaHello"
  
  version := "0.1"
  
  scalaVersion := "2.12.8"
  
  libraryDependencies += "org.apache.spark" %% "spark-core" % "2.4.2"
  libraryDependencies += "org.apache.spark" %% "spark-catalyst" % "2.4.2"
  libraryDependencies += "org.apache.spark" %% "spark-sql" % "2.4.2"
  </code></pre>
  
  <p>I think the problem is about initialization of sparkSession, but can't get what's wrong.</p>