You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by we...@apache.org on 2022/05/31 15:39:18 UTC
[spark] branch master updated: [SPARK-39343][SQL] DescribeTableExec should redact properties
This is an automated email from the ASF dual-hosted git repository.
wenchen 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 ef9e3f937cc [SPARK-39343][SQL] DescribeTableExec should redact properties
ef9e3f937cc is described below
commit ef9e3f937cc221efa5eb38ae1916a969c86c8786
Author: Angerszhuuuu <an...@gmail.com>
AuthorDate: Tue May 31 23:38:57 2022 +0800
[SPARK-39343][SQL] DescribeTableExec should redact properties
### What changes were proposed in this pull request?
DescribeTableExec should redact properties
### Why are the changes needed?
DescribeTableExec should redact properties
### Does this PR introduce _any_ user-facing change?
When user use `DESCRIBE TABLE EXTENDED` in v2 catalog, sensitive properties will be redacted.
### How was this patch tested?
Added UT
Closes #36731 from AngersZhuuuu/SPARK-39343.
Authored-by: Angerszhuuuu <an...@gmail.com>
Signed-off-by: Wenchen Fan <we...@databricks.com>
---
.../apache/spark/sql/execution/datasources/v2/DescribeTableExec.scala | 2 +-
.../scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DescribeTableExec.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DescribeTableExec.scala
index c20189efc91..6cca0a77222 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DescribeTableExec.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DescribeTableExec.scala
@@ -51,7 +51,7 @@ case class DescribeTableExec(
}
})
val properties =
- table.properties.asScala.toList
+ conf.redactOptions(table.properties.asScala.toMap).toList
.filter(kv => !CatalogV2Util.TABLE_RESERVED_PROPERTIES.contains(kv._1))
.sortBy(_._1).map {
case (key, value) => key + "=" + value
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala
index 8499083c271..6302dbb4f0c 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala
@@ -123,7 +123,7 @@ class DataSourceV2SQLSuite
spark.sql("CREATE TABLE testcat.table_name (id bigint, data string)" +
" USING foo" +
" PARTITIONED BY (id)" +
- " TBLPROPERTIES ('bar'='baz')" +
+ " TBLPROPERTIES ('bar'='baz', 'password' = 'password')" +
" COMMENT 'this is a test table'" +
" LOCATION 'file:/tmp/testcat/table_name'")
val descriptionDf = spark.sql("DESCRIBE TABLE EXTENDED testcat.table_name")
@@ -151,7 +151,7 @@ class DataSourceV2SQLSuite
Array("Location", "file:/tmp/testcat/table_name", ""),
Array("Provider", "foo", ""),
Array(TableCatalog.PROP_OWNER.capitalize, defaultUser, ""),
- Array("Table Properties", "[bar=baz]", "")))
+ Array("Table Properties", "[bar=baz,password=*********(redacted)]", "")))
}
test("Describe column for v2 catalog") {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org