File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/plans Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,13 @@ trait PlanTestBase extends PredicateHelper with SQLHelper { self: Suite =>
8484 }
8585 }
8686
87+ private def rewriteNameFromAttrNullability (plan : LogicalPlan ): LogicalPlan = {
88+ plan.transformAllExpressions {
89+ case a @ AttributeReference (name, _, false , _) =>
90+ a.copy(name = s " * $name" )(exprId = a.exprId, qualifier = a.qualifier)
91+ }
92+ }
93+
8794 /**
8895 * Normalizes plans:
8996 * - Filter the filter conditions that appear in a plan. For instance,
@@ -138,7 +145,9 @@ trait PlanTestBase extends PredicateHelper with SQLHelper { self: Suite =>
138145 fail(
139146 s """
140147 |== FAIL: Plans do not match ===
141- | ${sideBySide(normalized1.treeString, normalized2.treeString).mkString(" \n " )}
148+ | ${sideBySide(
149+ rewriteNameFromAttrNullability(normalized1).treeString,
150+ rewriteNameFromAttrNullability(normalized2).treeString).mkString(" \n " )}
142151 """ .stripMargin)
143152 }
144153 }
@@ -156,7 +165,9 @@ trait PlanTestBase extends PredicateHelper with SQLHelper { self: Suite =>
156165 fail(
157166 s """
158167 |== FAIL: Plans do not match ===
159- | ${sideBySide(normalized1.treeString, normalized2.treeString).mkString(" \n " )}
168+ | ${sideBySide(
169+ rewriteNameFromAttrNullability(normalized1).treeString,
170+ rewriteNameFromAttrNullability(normalized2).treeString).mkString(" \n " )}
160171 """ .stripMargin)
161172 }
162173 }
You can’t perform that action at this time.
0 commit comments