Copilot commented on code in PR #6135:
URL: https://github.com/apache/texera/pull/6135#discussion_r3524362374
##########
common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/source/scan/csv/CSVScanSourceOpExecSpec.scala:
##########
@@ -107,4 +112,99 @@ class CSVScanSourceOpExecSpec extends AnyFlatSpec {
assert(msg.toLowerCase.contains("max columns"))
assert(msg.toLowerCase.contains("exceeded"))
}
+
+ //
---------------------------------------------------------------------------
+ // Instance-side scan loop: open() -> produceTuple() -> close() over temp
CSVs.
+ //
---------------------------------------------------------------------------
+
+ private var tempFiles: List[Path] = Nil
+
+ override def afterAll(): Unit = {
+ tempFiles.foreach(Files.deleteIfExists)
+ super.afterAll()
+ }
+
+ /** Writes `content` to a fresh temp .csv and returns its path (tracked for
cleanup). */
+ private def writeTempCsv(content: String): Path = {
+ val path = Files.createTempFile("csv-scan-exec-spec", ".csv")
+ Files.write(path, content.getBytes("UTF-8"))
Review Comment:
Use the Charset overload instead of `getBytes("UTF-8")` to avoid
stringly-typed charset lookup and the (theoretical)
UnsupportedEncodingException path. This keeps the temp-file writer consistent
with other tests in this module that use `StandardCharsets.UTF_8`.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]