maropu commented on a change in pull request #32536:
URL: https://github.com/apache/spark/pull/32536#discussion_r633210020



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
##########
@@ -1434,15 +1432,7 @@ object CodeGenerator extends Logging {
    */
   private def updateAndGetCompilationStats(evaluator: ClassBodyEvaluator): 
ByteCodeStats = {
     // First retrieve the generated classes.
-    val classes = {
-      val scField = classOf[ClassBodyEvaluator].getDeclaredField("sc")
-      scField.setAccessible(true)
-      val compiler = scField.get(evaluator).asInstanceOf[SimpleCompiler]
-      val loader = compiler.getClassLoader.asInstanceOf[ByteArrayClassLoader]
-      val classesField = loader.getClass.getDeclaredField("classes")
-      classesField.setAccessible(true)
-      classesField.get(loader).asInstanceOf[JavaMap[String, 
Array[Byte]]].asScala
-    }
+    val classes = evaluator.getBytecodes.asScala

Review comment:
       > @maropu If we want to do some code checking, maybe we can enhanced the 
case metrics are recorded on compile in CodeGenerationSuite as follows:
   
   Ah, I see. Thank for the explanation, @LuciferYang. IMO its better to 
improve the test as you suggested. Could you?




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