GitHub user xuanyuanking opened a pull request: https://github.com/apache/spark/pull/14957
[SPARK-4502][SQL]Support parquet nested struct pruning and add releva⦠## What changes were proposed in this pull request? Like the description in [SPARK-4502](https://issues.apache.org/jira/browse/SPARK-4502), we have the same problem in Baidu and our user's parquet file has complex nested parquet struct(400+ fields and 4 layer nested) so this problem brings unnecessary data read and time spend. This pr fixed the problem and main fix ideas list as follows: 1. Add booleanConf `spark.sql.parquet.nestColumnPruning`, when itâs closed, same logical with before 2. In `FileSourceStrategy`, traverse `projects[NamedExpression]` and generate a map which key is attributeName, value is a Seq[String] of corresponding nested fields. For example: [âpeopleâ -> (âpeople.ageâ, âpeople.addr.cityâ)] 3. Replace the attributeName in origin requiredColumns. For example: origin requiredColumns is [âpeopleâ, âconsumeâ], replace it to [âpeople.ageâ, âpeople.addr.cityâ, âconsumeâ] 4. Merge structType of fields in same structType and merge filter attributes For example: the json format of struct type [âpeople.addr.cityâ, âpeople.addr.zip_codeâ] will merge to [âpeople.addr.[city,zip_code]â] 5. `StructType.apply` read the columns contains â.â Recursively ## How was this patch tested? add new test in `ParquetQuerySuite` You can merge this pull request into a Git repository by running: $ git pull https://github.com/xuanyuanking/spark SPARK-4502 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/14957.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #14957 ---- commit 7eaa4287a5c112a192cca388863324ffd855203e Author: liyuanjian <liyuanj...@baidu.com> Date: 2016-09-05T08:27:02Z [SPARK-4502][SQL]Support parquet nested struct pruning and add relevant tests ---- --- 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