Yohahaha commented on code in PR #6793:
URL: https://github.com/apache/incubator-gluten/pull/6793#discussion_r1718255021


##########
shims/common/src/main/scala/org/apache/gluten/GlutenConfig.scala:
##########
@@ -673,7 +674,8 @@ object GlutenConfig {
       // gcs config
       SPARK_GCS_STORAGE_ROOT_URL,
       SPARK_GCS_AUTH_TYPE,
-      SPARK_GCS_AUTH_SERVICE_ACCOUNT_JSON_KEYFILE
+      SPARK_GCS_AUTH_SERVICE_ACCOUNT_JSON_KEYFILE,
+      GLUTEN_REGEX_LOG_REDACTION

Review Comment:
   > For example: Spark typically uses something like 
(?i)secret\|password\|token\|access[.]key, but this fails in C++ regex library 
because (?i) is not supported and users need to represent the regex in a 
different manner.
   
   could we overwrite Spark's default pattern with a valid regex patten in 
native?



##########
cpp/core/config/GlutenConfig.cc:
##########
@@ -16,12 +16,28 @@
  */
 
 #include <jni.h>
-
+#include <optional>
+#include <regex>
 #include "compute/ProtobufUtils.h"
 #include "config.pb.h"
 #include "jni/JniError.h"
 
+namespace {
+
+const std::string REGEX_REDACT_KEY = "spark.gluten.redaction.regex";

Review Comment:
   and follow others naming.



##########
cpp/core/config/GlutenConfig.cc:
##########
@@ -16,12 +16,28 @@
  */
 
 #include <jni.h>
-
+#include <optional>
+#include <regex>
 #include "compute/ProtobufUtils.h"
 #include "config.pb.h"
 #include "jni/JniError.h"
 
+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);
+  if (it != conf.end()) {
+    return std::regex(it->second);
+  }
+  return std::nullopt;
+}
+} // namespace
+
 namespace gluten {
+
+const std::string REDACTED_VALUE = "*********(redacted)";

Review Comment:
   ditto.



##########
cpp/core/config/GlutenConfig.cc:
##########
@@ -16,12 +16,28 @@
  */
 
 #include <jni.h>
-
+#include <optional>
+#include <regex>
 #include "compute/ProtobufUtils.h"
 #include "config.pb.h"
 #include "jni/JniError.h"
 
+namespace {
+
+const std::string REGEX_REDACT_KEY = "spark.gluten.redaction.regex";

Review Comment:
   move config key definition to GlutenConfig.h



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to