diff --git a/utils/local-engine/Common/common.cpp b/utils/local-engine/Common/common.cpp index 62d82cdfb35b..b98937878a8e 100644 --- a/utils/local-engine/Common/common.cpp +++ b/utils/local-engine/Common/common.cpp @@ -45,6 +45,7 @@ void registerAllFunctions() } constexpr auto CH_BACKEND_CONF_PREFIX = "spark.gluten.sql.columnar.backend.ch"; constexpr auto CH_RUNTIME_CONF = "runtime_conf"; +constexpr auto CH_RUNTIME_SETTINGS = "local_engine.settings"; constexpr auto LOCAL_FILE_CACHE_DIR = "local_cache_root"; constexpr size_t LOCAL_FILE_CACHE_CAPACITY = 10l * (1<<30); @@ -129,11 +130,10 @@ static std::map getBackendConf(const std::string & pla void initCHRuntimeConfig(const std::map & conf) {} -void initLocalCacheForRemoteFiles(const std::map & backend_conf, Poco::AutoPtr context_conf) +void initLocalCacheForRemoteFiles(Poco::AutoPtr context_conf) { - std::string conf_prefix = std::string(CH_BACKEND_CONF_PREFIX); - auto conf_iter = backend_conf.find(conf_prefix + ".enable_local_cache"); - if (conf_iter == backend_conf.end() || conf_iter->second != "true") + std::string enable_path = std::string(CH_RUNTIME_SETTINGS) + ".use_local_cache_for_remote_storage"; + if (!context_conf->has(enable_path) || (context_conf->getString(enable_path) != "true" && context_conf->getString(enable_path) != "1")) return; local_engine::registerHDFSMetadata(DB::RemoteFileMetadataFactory::instance()); @@ -209,7 +209,7 @@ void init(const std::string & plan) /// Initialize settings auto settings = Settings(); - std::string settings_path = "local_engine.settings"; + std::string settings_path = CH_RUNTIME_SETTINGS; Poco::Util::AbstractConfiguration::Keys config_keys; config->keys(settings_path, config_keys); for (const std::string & key : config_keys) @@ -235,7 +235,7 @@ void init(const std::string & plan) } registerAllFunctions(); - initLocalCacheForRemoteFiles(ch_backend_conf, config); + initLocalCacheForRemoteFiles(config); LOG_INFO(&Poco::Logger::get("ClickHouseBackend"), "Register all functions."); #if USE_EMBEDDED_COMPILER