Github user kevinyu98 commented on a diff in the pull request: https://github.com/apache/spark/pull/10388#discussion_r48230905 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala --- @@ -88,16 +88,27 @@ private[sql] object DataSourceStrategy extends Strategy with Logging { s"Selected $selected partitions out of $total, pruned $percentPruned% partitions." } + // need to add projections from combineFilters in + val combineFilter = combineFilters.reduceLeftOption(expressions.And) + val combinedProjects = combineFilter.map(_.references.toSet.union(projects.toSet).toSeq) + .getOrElse(projects) val scan = buildPartitionedTableScan( l, - projects, + combinedProjects, pushedFilters, t.partitionSpec.partitionColumns, selectedPartitions) - combineFilters - .reduceLeftOption(expressions.And) - .map(execution.Filter(_, scan)).getOrElse(scan) :: Nil + // Add a Projection to guarantee the original projection: + // this is because "combinedProjects" may be different from the + // original "projects", in elements or their ordering --- End diff -- Thanks for the suggestion. Thought the == is 'shallow' compare, but it is 'deep' equality checking. Will make the changes.
--- 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