Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hotfix][Hive]Fix hive load hive_site_path and hdfs_site_path too late #7017

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.seatunnel.api.configuration.Option;
import org.apache.seatunnel.api.configuration.Options;
import org.apache.seatunnel.api.configuration.ReadonlyConfig;
import org.apache.seatunnel.connectors.seatunnel.file.config.BaseSinkConfig;
import org.apache.seatunnel.connectors.seatunnel.hive.config.HiveConfig;

import org.apache.commons.lang3.StringUtils;
Expand All @@ -31,6 +32,7 @@
import com.google.common.collect.ImmutableList;
import lombok.extern.slf4j.Slf4j;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
Expand Down Expand Up @@ -80,6 +82,32 @@ protected Configuration loadHiveBaseHadoopConfig(ReadonlyConfig readonlyConfig)
}
});
}
readonlyConfig
.getOptional(BaseSinkConfig.HDFS_SITE_PATH)
.ifPresent(
hdfsSitePath -> {
try {
configuration.addResource(new File(hdfsSitePath).toURI().toURL());
} catch (IOException e) {
log.warn(
"Error adding Hadoop resource {}, resource was not added",
hdfsSitePath,
e);
}
});
readonlyConfig
.getOptional(HiveConfig.HIVE_SITE_PATH)
.ifPresent(
hiveSitePath -> {
try {
configuration.addResource(new File(hiveSitePath).toURI().toURL());
} catch (IOException e) {
log.warn(
"Error adding Hadoop resource {}, resource was not added",
hiveSitePath,
e);
}
});
// Try to load from hadoopConf
Optional<Map<String, String>> hadoopConf =
readonlyConfig.getOptional(HiveConfig.HADOOP_CONF);
Expand Down
Loading