This is an automated email from the ASF dual-hosted git repository.
fchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new f9a142750 [KYUUBI #4135] [TEST] Refine
`GoldenFileUtils::baseResourcePath`
f9a142750 is described below
commit f9a1427500e90e4ea904b157b4734a28c5987e12
Author: Fu Chen <[email protected]>
AuthorDate: Wed Jan 11 14:02:19 2023 +0800
[KYUUBI #4135] [TEST] Refine `GoldenFileUtils::baseResourcePath`
### _Why are the changes needed?_
before this PR, an exception is thrown when we run `TPCHQuerySuite` on the
idea
```
Caused by: java.nio.file.NoSuchFileException:
/Users/fchen/Project/bigdata/incubator-kyuubi/src/main/resources/kyuubi/tpch/q3.output.schema
at
sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
at
sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
...
```
### _How was this patch tested?_
Pass Github Action.
Closes #4135 from cfmcgrady/connector-common.
Closes #4135
93894be3a [Fu Chen] refine
Authored-by: Fu Chen <[email protected]>
Signed-off-by: Fu Chen <[email protected]>
---
.../org/apache/kyuubi/spark/connector/common/GoldenFileUtils.scala | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git
a/extensions/spark/kyuubi-spark-connector-common/src/test/scala/org/apache/kyuubi/spark/connector/common/GoldenFileUtils.scala
b/extensions/spark/kyuubi-spark-connector-common/src/test/scala/org/apache/kyuubi/spark/connector/common/GoldenFileUtils.scala
index a4bb33ac7..db86efc13 100644
---
a/extensions/spark/kyuubi-spark-connector-common/src/test/scala/org/apache/kyuubi/spark/connector/common/GoldenFileUtils.scala
+++
b/extensions/spark/kyuubi-spark-connector-common/src/test/scala/org/apache/kyuubi/spark/connector/common/GoldenFileUtils.scala
@@ -43,7 +43,11 @@ object GoldenFileUtils {
private val regenerateGoldenFiles: Boolean =
sys.env.get("KYUUBI_UPDATE").contains("1")
private val baseResourcePath: Path =
- Paths.get("src", "main", "resources")
+ Paths.get(
+
Option(Thread.currentThread().getContextClassLoader).getOrElse(getClass.getClassLoader)
+ .getResource(".")
+ .getPath,
+ Seq("..", "..", "..", "src", "main", "resources"): _*)
private def fileToString(file: Path): String = {
new String(Files.readAllBytes(file), StandardCharsets.UTF_8)