Skip to content
Closed
Changes from all commits
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
Fix
  • Loading branch information
maropu committed Jul 20, 2019
commit 0ae5dadafed72d65566585c059c7f767db36bb2f
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ trait PlanTestBase extends PredicateHelper with SQLHelper { self: Suite =>
}
}

private def rewriteNameFromAttrNullability(plan: LogicalPlan): LogicalPlan = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this function is used only at decoration, it's safe to have this.

plan.transformAllExpressions {
case a @ AttributeReference(name, _, false, _) =>
a.copy(name = s"*$name")(exprId = a.exprId, qualifier = a.qualifier)
}
}

/**
* Normalizes plans:
* - Filter the filter conditions that appear in a plan. For instance,
Expand Down Expand Up @@ -138,7 +145,9 @@ trait PlanTestBase extends PredicateHelper with SQLHelper { self: Suite =>
fail(
s"""
|== FAIL: Plans do not match ===
|${sideBySide(normalized1.treeString, normalized2.treeString).mkString("\n")}
|${sideBySide(
rewriteNameFromAttrNullability(normalized1).treeString,
rewriteNameFromAttrNullability(normalized2).treeString).mkString("\n")}
""".stripMargin)
}
}
Expand All @@ -156,7 +165,9 @@ trait PlanTestBase extends PredicateHelper with SQLHelper { self: Suite =>
fail(
s"""
|== FAIL: Plans do not match ===
|${sideBySide(normalized1.treeString, normalized2.treeString).mkString("\n")}
|${sideBySide(
rewriteNameFromAttrNullability(normalized1).treeString,
rewriteNameFromAttrNullability(normalized2).treeString).mkString("\n")}
""".stripMargin)
}
}
Expand Down