From bb59267abecb6f950aa655c880ce1df75df8b04b Mon Sep 17 00:00:00 2001 From: panbingkun Date: Wed, 3 Jul 2024 18:12:02 +0900 Subject: [PATCH] [MINOR][TESTS] Replace `getResource` with `getWorkspaceFilePath` to enable `HiveUDFSuite` to run successfully in the IDE ### What changes were proposed in this pull request? The pr aims to replace `getResource` with `getWorkspaceFilePath` to enable `HiveUDFSuite#hive struct udf` to run successfully in the IDE. ### Why are the changes needed? - Before: image - After: image ### Does this PR introduce _any_ user-facing change? No, only test. ### How was this patch tested? - Pass GA - Manually test. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #47194 from panbingkun/minor_HiveUDFSuite. Authored-by: panbingkun Signed-off-by: Hyukjin Kwon --- .../org/apache/spark/sql/hive/execution/HiveUDFSuite.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveUDFSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveUDFSuite.scala index 69587a88127ee..d73f2be3b3f50 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveUDFSuite.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveUDFSuite.scala @@ -93,7 +93,8 @@ class HiveUDFSuite extends QueryTest with TestHiveSingleton with SQLTestUtils { """. stripMargin.format(classOf[PairSerDe].getName)) - val location = Utils.getSparkClassLoader.getResource("data/files/testUDF").getFile + val location = getWorkspaceFilePath( + "hive", "src", "test", "resources", "data", "files", "testUDF").toUri.toURL.getFile sql(s""" ALTER TABLE hiveUDFTestTable ADD IF NOT EXISTS PARTITION(partition='testUDF')