Github user zhzhan commented on a diff in the pull request:
https://github.com/apache/spark/pull/5526#discussion_r29385127
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/sources/DataSourceStrategy.scala
---
@@ -53,6 +53,25 @@ private[sql] object DataSourceStrategy extends Strategy {
filters,
(a, _) => t.buildScan(a)) :: Nil
+ case PhysicalOperation(projectList, filters, l @ LogicalRelation(t:
FSBasedRelation)) =>
+ val selectedPartitions = prunePartitions(filters, t.partitionSpec)
+ val inputPaths = selectedPartitions.map(_.path).toArray
+
+ // Don't push down predicates that reference partition columns
+ val pushedFilters = {
+ val partitionColumnNames =
t.partitionSpec.partitionColumns.map(_.name).toSet
+ filters.filter { f =>
+ val referencedColumnNames = f.references.map(_.name).toSet
+ referencedColumnNames.intersect(partitionColumnNames).isEmpty
+ }
+ }
+
+ pruneFilterProject(
+ l,
+ projectList,
+ pushedFilters,
+ (a, f) => t.buildScan(a, f, inputPaths)) :: Nil
--- End diff --
Trying to understand the logic. How does the value in partition get
populated to each row?
---
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]