Github user liancheng commented on a diff in the pull request: https://github.com/apache/spark/pull/9940#discussion_r50166678 --- 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")) + } + } --- End diff -- I'd prefer the following version. If `a` or `c` doesn't even exist in `df.schema`, the current version still passes. ```scala assert(df.schema("a").metadata.contains("optional")) assert(df.schema("c").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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org