cloud-fan commented on a change in pull request #30097:
URL: https://github.com/apache/spark/pull/30097#discussion_r511780792



##########
File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/SubstituteUnresolvedOrdinalsSuite.scala
##########
@@ -36,31 +37,40 @@ class SubstituteUnresolvedOrdinalsSuite extends 
AnalysisTest {
     // Tests order by ordinal, apply single rule.
     val plan = testRelation2.orderBy(Literal(1).asc, Literal(2).asc)
     comparePlans(
-      new SubstituteUnresolvedOrdinals(conf).apply(plan),
+      SubstituteUnresolvedOrdinals.apply(plan),
       testRelation2.orderBy(UnresolvedOrdinal(1).asc, 
UnresolvedOrdinal(2).asc))
 
     // Tests order by ordinal, do full analysis
     checkAnalysis(plan, testRelation2.orderBy(a.asc, b.asc))
 
     // order by ordinal can be turned off by config
+    var newPlan: LogicalPlan = null
+    withSQLConf(SQLConf.ORDER_BY_ORDINAL.key -> "false") {
+      newPlan = SubstituteUnresolvedOrdinals.apply(plan)
+    }
+
     comparePlans(
-      new SubstituteUnresolvedOrdinals(conf.copy(SQLConf.ORDER_BY_ORDINAL -> 
false)).apply(plan),
+      newPlan,
       testRelation2.orderBy(Literal(1).asc, Literal(2).asc))
   }
 
   test("group by ordinal") {
     // Tests group by ordinal, apply single rule.
     val plan2 = testRelation2.groupBy(Literal(1), Literal(2))('a, 'b)
     comparePlans(
-      new SubstituteUnresolvedOrdinals(conf).apply(plan2),
+      SubstituteUnresolvedOrdinals.apply(plan2),
       testRelation2.groupBy(UnresolvedOrdinal(1), UnresolvedOrdinal(2))('a, 
'b))
 
     // Tests group by ordinal, do full analysis
     checkAnalysis(plan2, testRelation2.groupBy(a, b)(a, b))
 
     // group by ordinal can be turned off by config
+    var newPlan2: LogicalPlan = null
+    withSQLConf(SQLConf.GROUP_BY_ORDINAL.key -> "false") {
+      newPlan2 = SubstituteUnresolvedOrdinals.apply(plan2)
+    }
     comparePlans(
-      new SubstituteUnresolvedOrdinals(conf.copy(SQLConf.GROUP_BY_ORDINAL -> 
false)).apply(plan2),

Review comment:
       ditto




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to