title: Type Mismatch while returning Map(String,java.sql.Date)
body: <p>I have recently started to work with Spark-Scala and now I am facing a issue which might be too trivial and basic but I am not able to catch it .</p>
  <p>AIM -</p>
  <p>I have a function which should take <code>dateTime:String</code> and should return a <code>Map(String,java.sql.Date)</code>.</p>
  <p>Code -</p>
  <pre><code>def newgetWeekStartDate(dateTime:String,mode:String):Map[String,java.sql.Date] = {
  
      mode match {
        case ExecMode.incremental =&gt;
  
          logInfo(s&quot; ****************** ACCESSING TIMEUTILS IN INCREMENTAL MODE ******************&quot;)
          val currentWeek = weekStartDate.getWeekStartDate(dateTime)
          val weekRelatedInformationMap = Map(&quot;currentWeek&quot; -&gt; currentWeek)
          weekRelatedInformationMap
        //        getWeekStartDate(dateTime)
  
        case ExecMode.full =&gt;
          logInfo(s&quot; ****************** ACCESSING TIMEUTILS in FULL MODE i.e 90 Days ******************&quot;)
          val sdfOutput = new SimpleDateFormat(&quot;yyyy-MM-dd'T'HH:mm:ss&quot;)
          val cal = Calendar.getInstance()
          cal.add(Calendar.DATE, -90)
          val quarterDate = sdfOutput.format(cal.getTime())
          val rangeWeek = weekStartDate.getWeekStartDate(quarterDate)
          val currentWeek = weekStartDate.getWeekStartDate(dateTime)
  
          val formattedCurrentWeek = Date.valueOf(currentWeek)
          val formattedRangeWeek = Date.valueOf(rangeWeek)
  
  
          val weekRelatedInformationMap1 = Map(&quot;currentWeek&quot; -&gt; formattedCurrentWeek,
            &quot;rangeWeek&quot; -&gt; formattedRangeWeek).withDefaultValue(&quot;NONE&quot;)
  
          weekRelatedInformationMap1
  
      }
    }
  </code></pre>
  <p>Now when I am returning the Map, I am getting this error -</p>
  <pre><code>[ERROR] .............. \src\main\scala\com\eg\modulename\utils\utils.scala:50: error: type mismatch;
  [INFO]  found   : scala.collection.immutable.Map[String,Comparable[_ &gt;: java.util.Date with String &lt;: Comparable[_ &gt;: java.util.Date with String &lt;: java.io.Serializable] with java.io.Serializable] with java.io.
  Serializable]
  </code></pre>
  <p>UPDATE -</p>
  <p>This is how I am planning on calling this function -</p>
  <pre><code>val crrntWeek = utils.newgetWeekStartDate(utils.currentDate,&quot;incremental&quot;).getOrElse(&quot;currentWeek&quot;,&quot;currentWeek Not Found&quot;)
  </code></pre>
  <p>This will then be used like this -</p>
  <pre><code>val existingDF = reader.readFrmHive(ConfigUtils.existingPath).filter(to_date(col(&quot;datetime&quot;),&quot;yyyy-MM-dd&quot;) &gt;= crrntWeek
  </code></pre>
  <p>Complete Stack Trace -</p>
  <pre><code>    C:\Users\patrag\Documents\Git_REpo\new-winnew-update&gt;mvn clean install
  [INFO] Scanning for projects...
  [WARNING]
  [WARNING] Some problems were encountered while building the effective model for com.eg.modulename:winnew-update:jar:0.1.0
  [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 112, column 15
  [WARNING] 'build.plugins.plugin.version' for org.jacoco:jacoco-maven-plugin is missing. @ line 138, column 15
  [WARNING]
  [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
  [WARNING]
  [WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
  [WARNING]
  [INFO]
  [INFO] ------------------------------------------------------------------------
  [INFO] Building winnew-update 0.1.0
  [INFO] ------------------------------------------------------------------------
  [INFO]
  [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ winnew-update ---
  [INFO] Deleting C:\Users\patrag\Documents\Git_REpo\new-winnew-update\target
  [INFO]
  [INFO] --- jacoco-maven-plugin:0.8.5:prepare-agent (default) @ winnew-update ---
  [INFO] argLine set to -javaagent:C:\\Users\\patrag\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.8.5\\org.jacoco.agent-0.8.5-runtime.jar=destfile=C:\\Users\\patrag\\Documents\\Git_REpo\\new-windows-softwar
  e-update\\target\\jacoco.exec
  [INFO]
  [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ winnew-update ---
  [INFO] Using 'UTF-8' encoding to copy filtered resources.
  [INFO] Copying 5 resources
  [INFO]
  [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ winnew-update ---
  [INFO] No sources to compile
  [INFO]
  [INFO] --- maven-scala-plugin:2.15.2:compile (default) @ winnew-update ---
  [INFO] Checking for multiple versions of scala
  [WARNING]  Expected all dependencies to require Scala version: 2.11.0
  [WARNING]  com.twitter:chill_2.11:0.9.3 requires scala version: 2.11.12
  [WARNING] Multiple versions of scala libraries detected!
  [INFO] includes = [**/*.java,**/*.scala,]
  [INFO] excludes = []
  [INFO] C:\Users\patrag\Documents\Git_REpo\new-winnew-update\src\main\scala:-1: info: compiling
  [INFO] Compiling 22 source files to C:\Users\patrag\Documents\Git_REpo\new-winnew-update\target\classes at 1592903601259
  [ERROR] C:\Users\patrag\Documents\Git_REpo\new-winnew-update\src\main\scala\com\eg\modulename\utils\utils.scala:50: error: type mismatch;
  [INFO]  found   : scala.collection.immutable.Map[String,Comparable[_ &gt;: java.util.Date with String &lt;: Comparable[_ &gt;: java.util.Date with String &lt;: java.io.Serializable] with java.io.Serializable] with java.io.
  Serializable]
  [INFO]  required: Map[String,String]
  [INFO]         weekRelatedInformationMap1
  [INFO]         ^
  [WARNING] C:\Users\patrag\Documents\Git_REpo\new-winnew-update\src\main\scala\com\eg\modulename\writer\BaseWriter.scala:3: warning: imported `Writer' is permanently hidden by definition of trait Write
  r in package writer
  [INFO] import com.eg.modulename.writer.Writer
  [INFO]                                 ^
  [WARNING] one warning found
  [ERROR] one error found
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 15.915 s
  [INFO] Finished at: 2020-06-23T14:43:26+05:30
  [INFO] Final Memory: 26M/620M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.scala-tools:maven-scala-plugin:2.15.2:compile (default) on project winnew-update: wrap: org.apache.commons.exec.ExecuteException: Process exited with an error: 1(Exi
  t value: 1) -&gt; [Help 1]
  [ERROR]
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR]
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
  </code></pre>