Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9940#discussion_r50167182
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFilterSuite.scala
 ---
    @@ -330,9 +331,56 @@ class ParquetFilterSuite extends QueryTest with 
ParquetTest with SharedSQLContex
     
             // If the "c = 1" filter gets pushed down, this query will throw 
an exception which
             // Parquet emits. This is a Parquet issue (PARQUET-389).
    +        val df = sqlContext.read.parquet(pathOne, pathTwo).filter("c = 
1").selectExpr("c", "b", "a")
             checkAnswer(
    -          sqlContext.read.parquet(pathOne, pathTwo).filter("c = 
1").selectExpr("c", "b", "a"),
    +          df,
               (1 to 1).map(i => Row(i, i.toString, null)))
    +
    +        // The fields "a" and "c" only exist in one Parquet file.
    +        df.schema.fields.foreach { f =>
    +          if (f.name == "a" || f.name == "c") {
    +            assert(f.metadata.contains("optional"))
    +          }
    +        }
    +
    +        val pathThree = s"${dir.getCanonicalPath}/table3"
    +        df.write.parquet(pathThree)
    +
    +        // We will remove the temporary metadata when writing Parquet file.
    +        sqlContext.read.parquet(pathThree).schema.fields.foreach { f =>
    +          assert(!f.metadata.contains("optional"))
    +        }
    --- End diff --
    
    ```scala
    
assert(sqlContext.read.parquet(pathThree).schema.forall(_.metadata.contains("optional")))
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to