dongjoon-hyun commented on a change in pull request #31764:
URL: https://github.com/apache/spark/pull/31764#discussion_r589085537



##########
File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/plans/PlanTest.scala
##########
@@ -51,6 +51,15 @@ trait CodegenInterpretedPlanTest extends PlanTest {
       super.test(testName + " (interpreted path)", testTags: _*)(testFun)(pos)
     }
   }
+
+  protected def testFallback(
+      testName: String,
+      testTags: Tag*)(testFun: => Any)(implicit pos: source.Position): Unit = {
+    val codegenMode = CodegenObjectFactoryMode.FALLBACK.toString
+    withSQLConf(SQLConf.CODEGEN_FACTORY_MODE.key -> codegenMode) {
+      super.test(testName, testTags: _*)(testFun)(pos)
+    }

Review comment:
       Hi, @viirya . I tried to revise, but it seems strange to me.
   
   > test runs the test code twice, one for codegen and one for interpreted. It 
is for test coverage.
   > If testFallback only runs for fallback mode, then it might only runs 
codegen and skips interpreted mode if codegen successes. So the test coverage 
is less, I think.
   
   `testFallback` is not aiming to replace `test` in [line 
41](https://github.com/apache/spark/pull/31764/files#diff-803f946128579a789870dc0bc6f58602db77476f8c04968a72c56efa783c12a1R41).
 Instead, `testFallback` is added because `PlanTest` bans all derived classes 
to test `FALLBACK` mode. Before this PR, there is no way to test `FALLBACK` 
mode.
   
   As we know, `CODEGEN_FACTORY_MODE` has three modes: `FALLBACK`, 
`CODEGEN_ONLY`, `NO_CODEGEN`.
   As we guess in the name, `testFallback`, this test is specifically for 
`FALLBACK` mode and is added for some test cases which works only at `FALLBACK` 
mode as @rednaxelafx described.
   
   So, `testFallback` doesn't aim to mean (1) `CODEGEN_ONLY` should fails and 
(2) `NO_CODEGEN` should passed. If you want to test this (both (1) and (2)), we 
should make another test function like `testCodegenFailNoCodegenPass`.
   
   




----------------------------------------------------------------
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