HyukjinKwon commented on a change in pull request #29588:
URL: https://github.com/apache/spark/pull/29588#discussion_r479876763
##########
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 = {
Review comment:
What about we just define a method such as:
```scala
def withScriptFile(script: String)(f: File => Unit) = {
val path = Utils.createTempDir()
path.delete()
Files.write(path, script.getBytes(StandardCharsets.UTF_8))
try f(path) finally Utils.deleteRecursively(path)
}
```
at `BaseScriptTransformationSuite`, and call like:
```scala
withScriptFile(
"""
|import sys
|for line in sys.stdin:
| (a, b, c, d, e) = line.split('\t')
| sys.stdout.write('\t'.join([a, b, c, d, e]))
| sys.stdout.flush()
""".stripMargin) { file =>
// test with `file`.
}
```
----------------------------------------------------------------
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]