wangyum commented on a change in pull request #25375: [SPARK-28642][SQL] Hide 
credentials in SHOW CREATE TABLE
URL: https://github.com/apache/spark/pull/25375#discussion_r317434198
 
 

 ##########
 File path: sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala
 ##########
 @@ -1029,6 +1030,32 @@ class JDBCSuite extends QueryTest
     }
   }
 
+  test("Hide credentials in show create table") {
+    val password = "testPass"
+    val tableName = "tab1"
+    withTable(tableName) {
+      sql(
+        s"""
+           |CREATE TABLE $tableName
+           |USING org.apache.spark.sql.jdbc
+           |OPTIONS (
+           | url '$urlWithUserAndPass',
+           | dbtable 'TEST.PEOPLE',
+           | user 'testUser',
+           | password '$password')
+         """.stripMargin)
+
+      val show = ShowCreateTableCommand(TableIdentifier(tableName))
+      
spark.sessionState.executePlan(show).executedPlan.executeCollect().foreach { r 
=>
+        assert(!r.toString.contains(password))
 
 Review comment:
   https://github.com/apache/spark/pull/25579

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to