diff --git a/presto-native-execution/presto_cpp/main/PrestoServer.cpp b/presto-native-execution/presto_cpp/main/PrestoServer.cpp index 2d352808a61f9..0cd9b5f62084b 100644 --- a/presto-native-execution/presto_cpp/main/PrestoServer.cpp +++ b/presto-native-execution/presto_cpp/main/PrestoServer.cpp @@ -152,8 +152,9 @@ void PrestoServer::run() { fmt::format("{}/config.properties", configDirectoryPath_)); nodeConfig->initialize( fmt::format("{}/node.properties", configDirectoryPath_)); + // velox.properties is optional. baseVeloxQueryConfig->initialize( - fmt::format("{}/velox.properties", configDirectoryPath_)); + fmt::format("{}/velox.properties", configDirectoryPath_), true); if (systemConfig->enableRuntimeMetricsCollection()) { enableRuntimeMetricReporting(); diff --git a/presto-native-execution/presto_cpp/main/common/Configs.cpp b/presto-native-execution/presto_cpp/main/common/Configs.cpp index 2ea962e840402..5af87297e6cbf 100644 --- a/presto-native-execution/presto_cpp/main/common/Configs.cpp +++ b/presto-native-execution/presto_cpp/main/common/Configs.cpp @@ -47,9 +47,14 @@ std::string bool2String(bool value) { ConfigBase::ConfigBase() : config_(std::make_unique()) {} -void ConfigBase::initialize(const std::string& filePath) { - // See if we want to create a mutable config. - auto values = util::readConfig(fs::path(filePath)); +void ConfigBase::initialize(const std::string& filePath, bool optionalConfig) { + auto path = fs::path(filePath); + std::unordered_map values; + if (!optionalConfig || fs::exists(path)) { + // See if we want to create a mutable config. + values = util::readConfig(path); + } + filePath_ = filePath; checkRegisteredProperties(values); updateLoadedValues(values); diff --git a/presto-native-execution/presto_cpp/main/common/Configs.h b/presto-native-execution/presto_cpp/main/common/Configs.h index 74f6bbd93148c..41c5082d35fc3 100644 --- a/presto-native-execution/presto_cpp/main/common/Configs.h +++ b/presto-native-execution/presto_cpp/main/common/Configs.h @@ -29,7 +29,8 @@ class ConfigBase { /// Reads configuration properties from the specified file. Must be called /// before calling any of the getters below. /// @param filePath Path to configuration file. - void initialize(const std::string& filePath); + /// @param optionalConfig Specify if the configuration file is optional. + void initialize(const std::string& filePath, bool optionalConfig = false); /// Allows individual config to manipulate just-loaded-from-file key-value map /// before it is used to initialize the config.