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



##########
File path: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveScriptTransformationSuite.scala
##########
@@ -36,6 +38,15 @@ class HiveScriptTransformationSuite extends 
BaseScriptTransformationSuite with T
 
   import ScriptTransformationIOSchema._
 
+  protected override def getTestResourcePath(fileName: String): String = {
+    val url = 
Thread.currentThread().getContextClassLoader.getResource(fileName)
+    // Copy to avoid URISyntaxException during accessing the resources in 
`sql/core`
+    val file = File.createTempFile("script-transformation-test", ".py")
+    file.deleteOnExit()
+    FileUtils.copyURLToFile(url, file)
+    file.getAbsolutePath

Review comment:
       > Seems can, we this method fro SQLTestUtils, and 
   
   How about adding a method for that in `SparkFunSuite`?
   ```
     // helper function
     protected final def getTestResourceFile(file: String): File = {
       new File(getClass.getClassLoader.getResource(file).getFile)
     }
   
     protected final def getTestResourcePath(file: String): String = {
       getTestResourceFile(file).getCanonicalPath
     }
   
     protected final def <<New Method> ...
   ```




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