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

    https://github.com/apache/spark/pull/13701#discussion_r73728732
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFilterSuite.scala
 ---
    @@ -368,73 +378,75 @@ class ParquetFilterSuite extends QueryTest with 
ParquetTest with SharedSQLContex
     
       test("SPARK-11103: Filter applied on merged Parquet schema with new 
column fails") {
         import testImplicits._
    -
    -    withSQLConf(SQLConf.PARQUET_FILTER_PUSHDOWN_ENABLED.key -> "true",
    -      SQLConf.PARQUET_SCHEMA_MERGING_ENABLED.key -> "true") {
    -      withTempPath { dir =>
    -        val pathOne = s"${dir.getCanonicalPath}/table1"
    -        (1 to 3).map(i => (i, i.toString)).toDF("a", 
"b").write.parquet(pathOne)
    -        val pathTwo = s"${dir.getCanonicalPath}/table2"
    -        (1 to 3).map(i => (i, i.toString)).toDF("c", 
"b").write.parquet(pathTwo)
    -
    -        // 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 = spark.read.parquet(pathOne, pathTwo).filter("c = 
1").selectExpr("c", "b", "a")
    -        checkAnswer(
    -          df,
    -          Row(1, "1", null))
    -
    -        // The fields "a" and "c" only exist in one Parquet file.
    -        
assert(df.schema("a").metadata.getBoolean(StructType.metadataKeyForOptionalField))
    -        
assert(df.schema("c").metadata.getBoolean(StructType.metadataKeyForOptionalField))
    -
    -        val pathThree = s"${dir.getCanonicalPath}/table3"
    -        df.write.parquet(pathThree)
    -
    -        // We will remove the temporary metadata when writing Parquet file.
    -        val schema = spark.read.parquet(pathThree).schema
    -        
assert(schema.forall(!_.metadata.contains(StructType.metadataKeyForOptionalField)))
    -
    -        val pathFour = s"${dir.getCanonicalPath}/table4"
    -        val dfStruct = sparkContext.parallelize(Seq((1, 1))).toDF("a", "b")
    -        dfStruct.select(struct("a").as("s")).write.parquet(pathFour)
    -
    -        val pathFive = s"${dir.getCanonicalPath}/table5"
    -        val dfStruct2 = sparkContext.parallelize(Seq((1, 1))).toDF("c", 
"b")
    -        dfStruct2.select(struct("c").as("s")).write.parquet(pathFive)
    -
    -        // If the "s.c = 1" filter gets pushed down, this query will throw 
an exception which
    -        // Parquet emits.
    -        val dfStruct3 = spark.read.parquet(pathFour, pathFive).filter("s.c 
= 1")
    -          .selectExpr("s")
    -        checkAnswer(dfStruct3, Row(Row(null, 1)))
    -
    -        // The fields "s.a" and "s.c" only exist in one Parquet file.
    -        val field = dfStruct3.schema("s").dataType.asInstanceOf[StructType]
    -        
assert(field("a").metadata.getBoolean(StructType.metadataKeyForOptionalField))
    -        
assert(field("c").metadata.getBoolean(StructType.metadataKeyForOptionalField))
    -
    -        val pathSix = s"${dir.getCanonicalPath}/table6"
    -        dfStruct3.write.parquet(pathSix)
    -
    -        // We will remove the temporary metadata when writing Parquet file.
    -        val forPathSix = spark.read.parquet(pathSix).schema
    -        
assert(forPathSix.forall(!_.metadata.contains(StructType.metadataKeyForOptionalField)))
    -
    -        // sanity test: make sure optional metadata field is not wrongly 
set.
    -        val pathSeven = s"${dir.getCanonicalPath}/table7"
    -        (1 to 3).map(i => (i, i.toString)).toDF("a", 
"b").write.parquet(pathSeven)
    -        val pathEight = s"${dir.getCanonicalPath}/table8"
    -        (4 to 6).map(i => (i, i.toString)).toDF("a", 
"b").write.parquet(pathEight)
    -
    -        val df2 = spark.read.parquet(pathSeven, pathEight).filter("a = 
1").selectExpr("a", "b")
    -        checkAnswer(
    -          df2,
    -          Row(1, "1"))
    -
    -        // The fields "a" and "b" exist in both two Parquet files. No 
metadata is set.
    -        
assert(!df2.schema("a").metadata.contains(StructType.metadataKeyForOptionalField))
    -        
assert(!df2.schema("b").metadata.contains(StructType.metadataKeyForOptionalField))
    +    Seq("true", "false").map { vectorized =>
    --- End diff --
    
    Is this change related?


---
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