Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnavBalyan committed Aug 18, 2024
1 parent 497d6dc commit 37fc994
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
7 changes: 2 additions & 5 deletions cpp/core/config/GlutenConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@

namespace {

const std::string REGEX_REDACT_KEY = "spark.gluten.redaction.regex";
std::optional<std::regex> getRedactionRegex(const std::unordered_map<std::string, std::string>& conf) {
auto it = conf.find(REGEX_REDACT_KEY);
auto it = conf.find(gluten::kSparkRedactionRegex);
if (it != conf.end()) {
return std::regex(it->second);
}
Expand All @@ -36,8 +35,6 @@ std::optional<std::regex> getRedactionRegex(const std::unordered_map<std::string

namespace gluten {

const std::string REDACTED_VALUE = "*********(redacted)";

std::unordered_map<std::string, std::string>
parseConfMap(JNIEnv* env, const uint8_t* planData, const int32_t planDataLength) {
std::unordered_map<std::string, std::string> sparkConfs;
Expand All @@ -58,7 +55,7 @@ std::string printConfig(const std::unordered_map<std::string, std::string>& conf

for (const auto& [k, v] : conf) {
if (redactionRegex && std::regex_match(k, *redactionRegex)) {
oss << " [" << k << ", " << REDACTED_VALUE << "]\n";
oss << " [" << k << ", " << kSparkRedactionString << "]\n";
} else {
oss << " [" << k << ", " << v << "]\n";
}
Expand Down
3 changes: 3 additions & 0 deletions cpp/core/config/GlutenConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ const std::string kShuffleCompressionCodecBackend = "spark.gluten.sql.columnar.s
const std::string kQatBackendName = "qat";
const std::string kIaaBackendName = "iaa";

const std::string kSparkRedactionRegex = "spark.redaction.regex";
const std::string kSparkRedactionString = "*********(redacted)";

std::unordered_map<std::string, std::string>
parseConfMap(JNIEnv* env, const uint8_t* planData, const int32_t planDataLength);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ object GlutenConfig {
val GLUTEN_ONHEAP_SIZE_KEY = "spark.executor.memory"
val GLUTEN_OFFHEAP_SIZE_KEY = "spark.memory.offHeap.size"
val GLUTEN_OFFHEAP_ENABLED = "spark.memory.offHeap.enabled"
val SPARK_REDACTION_REGEX = "spark.redaction.regex"

// For Soft Affinity Scheduling
// Enable Soft Affinity Scheduling, defalut value is false
Expand Down Expand Up @@ -622,7 +623,6 @@ object GlutenConfig {

val GLUTEN_COST_EVALUATOR_ENABLED = "spark.gluten.sql.adaptive.costEvaluator.enabled"

val GLUTEN_REGEX_LOG_REDACTION = "spark.gluten.redaction.regex"
var ins: GlutenConfig = _

def getConf: GlutenConfig = {
Expand Down Expand Up @@ -675,7 +675,7 @@ object GlutenConfig {
SPARK_GCS_STORAGE_ROOT_URL,
SPARK_GCS_AUTH_TYPE,
SPARK_GCS_AUTH_SERVICE_ACCOUNT_JSON_KEYFILE,
GLUTEN_REGEX_LOG_REDACTION
SPARK_REDACTION_REGEX
)
nativeConfMap.putAll(conf.filter(e => keys.contains(e._1)).asJava)

Expand Down Expand Up @@ -760,7 +760,7 @@ object GlutenConfig {
GLUTEN_OFFHEAP_ENABLED,
SESSION_LOCAL_TIMEZONE.key,
DECIMAL_OPERATIONS_ALLOW_PREC_LOSS.key,
GLUTEN_REGEX_LOG_REDACTION
SPARK_REDACTION_REGEX
)
nativeConfMap.putAll(conf.filter(e => keys.contains(e._1)).asJava)

Expand Down

0 comments on commit 37fc994

Please sign in to comment.