diff --git a/cpp/core/config/GlutenConfig.cc b/cpp/core/config/GlutenConfig.cc index caa17f92b4ab..0adf0bf060b4 100644 --- a/cpp/core/config/GlutenConfig.cc +++ b/cpp/core/config/GlutenConfig.cc @@ -16,12 +16,11 @@ */ #include - +#include +#include #include "compute/ProtobufUtils.h" #include "config.pb.h" #include "jni/JniError.h" -#include -#include namespace gluten { @@ -29,35 +28,36 @@ const std::string REDACTED_VALUE = "*********(redacted)"; const std::string REGEX_REDACT_KEY = "spark.gluten.redaction.regex"; std::unordered_map - parseConfMap(JNIEnv* env, const uint8_t* planData, const int32_t planDataLength) { - std::unordered_map sparkConfs; - ConfigMap pConfigMap; - gluten::parseProtobuf(planData, planDataLength, &pConfigMap); - for (const auto& pair : pConfigMap.configs()) { - sparkConfs.emplace(pair.first, pair.second); +parseConfMap(JNIEnv* env, const uint8_t* planData, const int32_t planDataLength) { + std::unordered_map sparkConfs; + ConfigMap pConfigMap; + gluten::parseProtobuf(planData, planDataLength, &pConfigMap); + for (const auto& pair : pConfigMap.configs()) { + sparkConfs.emplace(pair.first, pair.second); } + return sparkConfs; } std::optional getRedactionRegex(const std::unordered_map& conf) { - auto it = conf.find(REGEX_REDACT_KEY); - if (it != conf.end()) { - return std::regex(it->second); - } - return std::nullopt; + auto it = conf.find(REGEX_REDACT_KEY); + if (it != conf.end()) { + return std::regex(it->second); + } + return std::nullopt; } std::string printConfig(const std::unordered_map& conf) { std::ostringstream oss; oss << std::endl; - auto redactionRegex = getRedactionRegex(conf); + auto redactionRegex = getRedactionRegex(conf); for (const auto& [k, v] : conf) { if (redactionRegex && std::regex_match(k, *redactionRegex)) { - oss << " [" << k << ", " << REDACTED_VALUE << "]\n"; + oss << " [" << k << ", " << REDACTED_VALUE << "]\n"; } else { - oss << " [" << k << ", " << v << "]\n"; + oss << " [" << k << ", " << v << "]\n"; } } return oss.str();