You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by li...@apache.org on 2019/08/26 06:12:49 UTC
[spark] branch master updated: [SPARK-28642][SQL][TEST][FOLLOW-UP]
Test spark.sql.redaction.options.regex with and without default values
This is an automated email from the ASF dual-hosted git repository.
lixiao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new c353a84 [SPARK-28642][SQL][TEST][FOLLOW-UP] Test spark.sql.redaction.options.regex with and without default values
c353a84 is described below
commit c353a84d1a991797f255ec312e5935438727536c
Author: Yuming Wang <yu...@ebay.com>
AuthorDate: Sun Aug 25 23:12:16 2019 -0700
[SPARK-28642][SQL][TEST][FOLLOW-UP] Test spark.sql.redaction.options.regex with and without default values
### What changes were proposed in this pull request?
Test `spark.sql.redaction.options.regex` with and without default values.
### Why are the changes needed?
Normally, we do not rely on the default value of `spark.sql.redaction.options.regex`.
### Does this PR introduce any user-facing change?
No
### How was this patch tested?
N/A
Closes #25579 from wangyum/SPARK-28642-f1.
Authored-by: Yuming Wang <yu...@ebay.com>
Signed-off-by: Xiao Li <ga...@gmail.com>
---
.../scala/org/apache/spark/sql/jdbc/JDBCSuite.scala | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala
index 72a5645..7fe00ae 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala
@@ -1031,8 +1031,10 @@ class JDBCSuite extends QueryTest
}
test("Hide credentials in show create table") {
+ val userName = "testUser"
val password = "testPass"
val tableName = "tab1"
+ val dbTable = "TEST.PEOPLE"
withTable(tableName) {
sql(
s"""
@@ -1040,18 +1042,30 @@ class JDBCSuite extends QueryTest
|USING org.apache.spark.sql.jdbc
|OPTIONS (
| url '$urlWithUserAndPass',
- | dbtable 'TEST.PEOPLE',
- | user 'testUser',
+ | dbtable '$dbTable',
+ | user '$userName',
| password '$password')
""".stripMargin)
val show = ShowCreateTableCommand(TableIdentifier(tableName))
spark.sessionState.executePlan(show).executedPlan.executeCollect().foreach { r =>
assert(!r.toString.contains(password))
+ assert(r.toString.contains(dbTable))
+ assert(r.toString.contains(userName))
}
sql(s"SHOW CREATE TABLE $tableName").collect().foreach { r =>
- assert(!r.toString().contains(password))
+ assert(!r.toString.contains(password))
+ assert(r.toString.contains(dbTable))
+ assert(r.toString.contains(userName))
+ }
+
+ withSQLConf(SQLConf.SQL_OPTIONS_REDACTION_PATTERN.key -> "(?i)dbtable|user") {
+ spark.sessionState.executePlan(show).executedPlan.executeCollect().foreach { r =>
+ assert(!r.toString.contains(password))
+ assert(!r.toString.contains(dbTable))
+ assert(!r.toString.contains(userName))
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org