You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "MaxGekk (via GitHub)" <gi...@apache.org> on 2024/01/02 08:27:36 UTC

Re: [PR] [SPARK-46544][SQL] Support v2 DESCRIBE TABLE EXTENDED with table stats [spark]

MaxGekk commented on code in PR #44535:
URL: https://github.com/apache/spark/pull/44535#discussion_r1439234100


##########
sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/DescribeTableSuite.scala:
##########
@@ -196,4 +199,20 @@ class DescribeTableSuite extends command.DescribeTableSuiteBase
           Row("comment", "column_comment")))
     }
   }
+
+  test("describe extended table with stats") {
+    withNamespaceAndTable("ns", "tbl") { tbl =>
+      sql(
+        s"""
+           |CREATE TABLE $tbl
+           |(key INT, col STRING)
+           |$defaultUsing""".stripMargin)
+
+      sql(s"INSERT INTO $tbl values (1, 'aaa'), (2, 'bbb'), (3, 'ccc'), (null, 'ddd')")
+      val descriptionDf = sql(s"DESCRIBE TABLE EXTENDED $tbl")
+      val stats = descriptionDf.filter("col_name == 'Statistics'").select("data_type")
+        .collectAsList().get(0).toString
+      Assertions.assertTrue("""\[\d+\s+bytes,\s+4\s+rows]""".r.matches(stats))

Review Comment:
   ```suggestion
         assert("""\[\d+\s+bytes,\s+4\s+rows]""".r.matches(stats))
   ```



##########
sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/DescribeTableSuite.scala:
##########
@@ -17,6 +17,8 @@
 
 package org.apache.spark.sql.execution.command.v2
 
+import org.junit.jupiter.api.Assertions

Review Comment:
   Why cannot you use `assert` from scalatest?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org