Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address comment.
  • Loading branch information
viirya committed Jan 7, 2019
commit 6dbd753d679b3bdc7e88999019727cbb37e2bc33
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,11 @@ private[sql] object ParquetSchemaPruning extends Rule[LogicalPlan] {
plan
}

// `PhysicalOperation` pattern returns relation operator's outputs if there is no
// projects on it. In this case, we don't need to do schema pruning.
private def directOutput(projects: Seq[NamedExpression], plan: LogicalPlan): Boolean = {
projects.length == plan.output.length && projects.zip(plan.output).forall {
case (l, r) => l.name == r.name && l.dataType.sameType(r.dataType)
}
}

private def apply0(plan: LogicalPlan): LogicalPlan =
plan transformDown {
case op @ PhysicalOperation(projects, filters,
l @ LogicalRelation(hadoopFsRelation: HadoopFsRelation, _, _, _))
if canPruneRelation(hadoopFsRelation) && !directOutput(projects, l) =>
if canPruneRelation(hadoopFsRelation) =>
val (normalizedProjects, normalizedFilters) =
normalizeAttributeRefNames(l, projects, filters)
val requestedRootFields = identifyRootFields(normalizedProjects, normalizedFilters)
Expand Down