title: Field not found during timestamp filtering when loading a dataset on spark
body: <p>I'm new in scala and spark, I have some issue,</p>
  <p>I tried to load a dataset and filtering with timestamp but I got error.</p>
  <p>I have 1 case class that contain 2 case class, after saving generated dataset, I tried to reload dataset.
  this is the schema of created dataset</p>
  <pre><code>// root
  //  |-- date: date (nullable = false)
  //  |-- info: struct (nullable = false)
  //  |    |-- name: string (nullable = true)
  //  |    |-- inlife: bool (nullable = true)
  //  |-- extra: struct (nullable = false)
  //  |    |-- prob: string (nullable = true)
  //  |    |-- ext: string (nullable = true)
  //  |-- dt: string (nullable = true)
  </code></pre>
  <p>But I got error that :</p>
  <pre><code>No such struct field name in prob, ext;
  </code></pre>
  <p>here is the pice of my code</p>
  <pre><code>    val spark = SparkSession.builder()
                          .master(&quot;local[2]&quot;)
                          .getOrCreate()
  
  
  case class Info(
      name: Option[String] = None,
      inLife: Option[Boolean] = None)
  
  case class Extra(
      prob: Option[Float] = None, 
      ext: Option[String] = None)
  
  case class Person(
      date : java.sql.Timestamp = java.sql.Timestamp.from(Instant.EPOCH),
      inf : Info = Info(),
      pExt : Extra = Extra(),
      dt : Option[java.sql.Timestamp] = Option(java.sql.Timestamp.from(Instant.EPOCH))
  )
  
  
  implicit val encI = Encoders.product[Info]
  implicit val encE = Encoders.product[Extra]
  implicit val encP = Encoders.product[Person]
  val p = Seq(Person())
  
  val ds = spark.createDataset(p)
  ds.show
  
  ds.printSchema
  
  
  val uri =  new URI(&quot;/Users/me/testSaving/test&quot;)
  ds.repartition(10)
      .write.mode(SaveMode.Append)
      .partitionBy(&quot;date&quot;, &quot;dt&quot;)
      .parquet(uri.toString)
  </code></pre>
  <p>When I try to load it without filtering, the dataset loads without problem,</p>
  <pre><code>val loadedDS = spark.read.format(&quot;parquet&quot;)
                        .schema(spark.emptyDataset[Person].schema)
                        .option(&quot;basePath&quot;, uri.toString)
                        .load(uri.toString)
  </code></pre>
  <p>But when I load with filtering there is many errors:</p>
  <pre><code>    val loadedDS = spark.read.format(&quot;parquet&quot;)
                        .schema(spark.emptyDataset[Person].schema)
                        .option(&quot;basePath&quot;, uri.toString)
                        .load(uri.toString)
                        .filter({
                        val ts = unix_timestamp(to_timestamp(col(&quot;dt&quot;), &quot;yyyy-MM-dd HH:mm:ss&quot;))
                        lit(Instant.MIN.getEpochSecond) &lt;= ts and ts &lt; lit(Instant.MAX.getEpochSecond)}).as[Person]
  </code></pre>
  <p>Knowing that this part of the code was working very well before adding the dt field in the Person class</p>
  <p>Thank you, Merci, Danke, Gracias,谢谢你</p>