Yohahaha commented on code in PR #2314:
URL: https://github.com/apache/fluss/pull/2314#discussion_r2684563982


##########
fluss-spark/fluss-spark-ut/src/test/scala/org/apache/fluss/spark/SparkCatalogTest.scala:
##########
@@ -190,4 +190,55 @@ class FlussCatalogTest extends FlussSparkTestBase {
     admin.dropDatabase(dbName, true, true).get()
     checkAnswer(sql("SHOW DATABASES"), Row(DEFAULT_DATABASE) :: Nil)
   }
+
+  test("show partitions") {
+    withTable("t") {
+      sql(s"CREATE TABLE t (id int, name string, pt1 string, pt2 int) 
PARTITIONED BY (pt1, pt2)")
+      sql(s"INSERT INTO t values(1, 'a', 'a', 1), (2, 'b', 'a', 2), (3, 'c', 
'c', 3)")
+
+      var expect = Seq(Row("pt1=a/pt2=1"), Row("pt1=a/pt2=2"), 
Row("pt1=c/pt2=3"))
+      checkAnswer(sql(s"SHOW PARTITIONS t"), expect)
+      expect = Seq(Row("pt1=a/pt2=1"), Row("pt1=a/pt2=2"))
+      checkAnswer(sql(s"SHOW PARTITIONS t PARTITION (pt1 = 'a')"), expect)
+    }
+  }
+
+  test("add partition") {
+    withTable("t") {
+      sql("CREATE TABLE t (id int, name string, pt1 string, pt2 int) 
PARTITIONED BY (pt1, pt2)")
+
+      // add from sparksql
+      sql(s"ALTER TABLE t ADD PARTITION (pt1 = 'b', pt2 = 1)")
+      var expect = Seq(Row("pt1=b/pt2=1"))
+      checkAnswer(sql(s"SHOW PARTITIONS t"), expect)
+      sql(s"ALTER TABLE t ADD IF NOT EXISTS PARTITION (pt1 = 'b', pt2 = 1)")
+      checkAnswer(sql(s"SHOW PARTITIONS t"), expect)

Review Comment:
   from fluss or sparksql?



-- 
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]

Reply via email to