I have the following function in Scala:

```
  def getData(spark: SparkSession,
              indices: Option[String]): Option[DataFrame] = {

    indices match {
      case None => {
        println("Undefined field.")
        None
      }
      case Some(ind) => {
        val df = spark
          .read.format("org.elasticsearch.spark.sql")
          .load(ind)
        df
      }
    }
}

```

However, I get the compilation error:

> 
> Expression of type sql.DataFrame does not conform the expected type
>  Option[sql.DataFrame]
> 
> 
> 

I tried to return `Option[df]`, but it compiles neither.