Skip to content

Commit

Permalink
Do not print unresolved plan in assertPlan
Browse files Browse the repository at this point in the history
Printing unresolved plan that contains GroupReference will cause problem
in translation. Also it does not provide more information than resolved
plan.
  • Loading branch information
hellium01 authored and highker committed Aug 22, 2019
1 parent 1bd45da commit ef724d2
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,13 @@ public static void assertPlan(Session session, Metadata metadata, StatsCalculato
public static void assertPlan(Session session, Metadata metadata, StatsProvider statsProvider, Plan actual, Lookup lookup, PlanMatchPattern pattern, Function<PlanNode, PlanNode> planSanitizer)
{
MatchResult matches = actual.getRoot().accept(new PlanMatchingVisitor(session, metadata, statsProvider, lookup), pattern);
// TODO (Issue #13231) add back printing unresolved plan once we have no need to translate OriginalExpression to RowExpression
if (!matches.isMatch()) {
String formattedPlan = textLogicalPlan(planSanitizer.apply(actual.getRoot()), actual.getTypes(), metadata.getFunctionManager(), StatsAndCosts.empty(), session, 0);
PlanNode resolvedPlan = resolveGroupReferences(actual.getRoot(), lookup);
String resolvedFormattedPlan = textLogicalPlan(planSanitizer.apply(resolvedPlan), actual.getTypes(), metadata.getFunctionManager(), StatsAndCosts.empty(), session, 0);
throw new AssertionError(format(
"Plan does not match, expected [\n\n%s\n] but found [\n\n%s\n] which resolves to [\n\n%s\n]",
"Plan does not match, expected [\n\n%s\n] but found [\n\n%s\n]",
pattern,
formattedPlan,
resolvedFormattedPlan));
}
}
Expand Down

0 comments on commit ef724d2

Please sign in to comment.