From 81a6edf3679662b5289a55e7ecccdf3f815c67a8 Mon Sep 17 00:00:00 2001 From: "Jalpreet Singh Nanda (:imjalpreet)" Date: Wed, 11 Jun 2025 06:27:05 +0530 Subject: [PATCH] Fix an issue while accessing Symlink tables Introduction of WrapperJobConf and CopyOnFirstWriteConfiguration lead to issues while accessing Symlink tables since the actual configuration object is wrapped inside a configuration object --- .../facebook/presto/hive/StoragePartitionLoader.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/StoragePartitionLoader.java b/presto-hive/src/main/java/com/facebook/presto/hive/StoragePartitionLoader.java index 110b7cb415505..86f737110506d 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/StoragePartitionLoader.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/StoragePartitionLoader.java @@ -184,7 +184,17 @@ private ListenableFuture handleSymlinkTextInputFormat(ExtendedFileSystem fs, // the splits must be generated using the file system for the target path // get the configuration for the target path -- it may be a different hdfs instance ExtendedFileSystem targetFilesystem = hdfsEnvironment.getFileSystem(hdfsContext, targetPath); - JobConf targetJob = toJobConf(targetFilesystem.getConf()); + + Configuration targetConfiguration = targetFilesystem.getConf(); + if (targetConfiguration instanceof HiveCachingHdfsConfiguration.CachingJobConf) { + targetConfiguration = ((HiveCachingHdfsConfiguration.CachingJobConf) targetConfiguration).getConfig(); + } + if (targetConfiguration instanceof CopyOnFirstWriteConfiguration) { + targetConfiguration = ((CopyOnFirstWriteConfiguration) targetConfiguration).getConfig(); + } + + JobConf targetJob = toJobConf(targetConfiguration); + targetJob.setInputFormat(TextInputFormat.class); targetInputFormat.configure(targetJob); targetJob.set(SPLIT_MINSIZE, Long.toString(getMaxSplitSize(session).toBytes()));