Github user ash211 commented on a diff in the pull request: https://github.com/apache/spark/pull/15835#discussion_r87703118 --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetQuerySuite.scala --- @@ -703,6 +705,81 @@ class ParquetQuerySuite extends QueryTest with ParquetTest with SharedSQLContext } } } + + test("SPARK-17059: Allow FileFormat to specify partition pruning strategy") { + withSQLConf(ParquetOutputFormat.ENABLE_JOB_SUMMARY -> "true") { + withTempPath { path => + spark.sparkContext.parallelize(Seq(1, 2, 3), 3) + .toDF("x").write.parquet(path.getCanonicalPath) + + val zeroPartitions = spark.read.parquet(path.getCanonicalPath).where("x = 0") + assert(zeroPartitions.rdd.partitions.length == 0) + + val onePartition = spark.read.parquet(path.getCanonicalPath).where("x = 1") + assert(onePartition.rdd.partitions.length == 1) + } + } + } + + test("Do not filter out parquet file when missing in _metadata file") { + withSQLConf(ParquetOutputFormat.ENABLE_JOB_SUMMARY -> "true") { + withTempPath { path => + spark.sparkContext.parallelize(Seq(1, 2, 3), 3) + .toDF("x").write.parquet(path.getCanonicalPath) + spark.sparkContext.parallelize(Seq(4)) + .toDF("x").write.mode(SaveMode.Append).parquet(path.getCanonicalPath) --- End diff -- do you need to turn off `ParquetOutputFormat.ENABLE_JOB_SUMMARY` to prevent the `_metadata` file from being updated on the second write, or is it normally not updated in `SaveMode.Append` ? I would've expected the second write here to update the `_metadata` file in which case the test name wouldn't match the behavior. But if the second write _doesn't_ update `_metadata` then the file has 3 out of 4 file partitions in it, matching the test name.
--- 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