MaxGekk commented on code in PR #56587:
URL: https://github.com/apache/spark/pull/56587#discussion_r3459687224
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/ShowTablesSuite.scala:
##########
@@ -50,6 +50,18 @@ class ShowTablesSuite extends command.ShowTablesSuiteBase
with CommandSuiteBase
}
}
+ test("show table extended formats table properties") {
+ withNamespaceAndTable("ns", "tbl") { t =>
+ sql(s"CREATE TABLE $t (id bigint) $defaultUsing " +
+ "TBLPROPERTIES ('p1'='v1', 'p2'='v2')")
+
+ val information = sql(s"SHOW TABLE EXTENDED IN $catalog.ns LIKE 'tbl'")
+ .collect()(0)(3).toString
+
+ assert(information.split("\n").contains("Table Properties: [p1=v1,
p2=v2]"))
Review Comment:
The new test pins the non-empty formatting, but nothing covers the
empty-skip branch that commit `b1ff04d` introduced — an all-reserved /
no-user-property table should now *omit* the `Table Properties` line. The base
suite masks `Table Properties:` lines wholesale
(`ShowTablesSuiteBase.scala:424`), so a regression to the raw guard that
reprints `Table Properties: []` would be masked to `<table properties>` and
pass the general assertion — silently invisible. Suggest a companion case in
the same style:
```scala
test("show table extended omits empty table properties") {
withNamespaceAndTable("ns", "tbl") { t =>
sql(s"CREATE TABLE $t (id bigint) $defaultUsing")
val information = sql(s"SHOW TABLE EXTENDED IN $catalog.ns LIKE 'tbl'")
.collect()(0)(3).toString
assert(!information.split("\n").exists(_.startsWith("Table Properties")))
}
}
```
A v2 in-memory table created without `TBLPROPERTIES` carries only reserved
keys (e.g. `provider`), which `TABLE_RESERVED_PROPERTIES` filters out — so
`displayedTableProperties` is empty and the line is omitted. Before `b1ff04d`
the raw guard printed `Table Properties: []` and this would fail.
--
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]