Skip to content

Commit

Permalink
[MINOR][TESTS] Replace getResource with getWorkspaceFilePath to e…
Browse files Browse the repository at this point in the history
…nable `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:
  <img width="1269" alt="image" src="https://github.com/apache/spark/assets/15246973/be0c770b-3381-4ca9-9485-728bf4d23943">

- After:
  <img width="871" alt="image" src="https://github.com/apache/spark/assets/15246973/ac1b0dad-9ed0-441f-ad69-bca826207a55">

### 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 apache#47194 from panbingkun/minor_HiveUDFSuite.

Authored-by: panbingkun <panbingkun@baidu.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
  • Loading branch information
panbingkun authored and HyukjinKwon committed Jul 3, 2024
1 parent d410e06 commit bb59267
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit bb59267

Please sign in to comment.