i7xh commented on a change in pull request #1085:
URL: https://github.com/apache/incubator-kyuubi/pull/1085#discussion_r711451568



##########
File path: 
dev/kyuubi-extension-spark-3-1/src/test/scala/org/apache/spark/sql/KyuubiExtensionSuite.scala
##########
@@ -1303,4 +1303,96 @@ class KyuubiExtensionSuite extends 
KyuubiSparkSQLExtensionTest {
       }
     }
   }
+
+  test("test watchdog with query forceMaxOutputRows") {
+
+    withSQLConf(KyuubiSQLConf.WATCHDOG_FORCED_MAXOUTPUTROWS.key -> "10") {
+
+      assert(sql("SELECT * FROM VALUES(1, 'a'),(2, 'b') AS t(c1, c2)")
+        .queryExecution.analyzed.isInstanceOf[GlobalLimit])
+
+      assert(sql("SELECT * FROM VALUES(1, 'a'),(2, 'b') AS t(c1, c2) LIMIT 1")
+        .queryExecution.analyzed.asInstanceOf[GlobalLimit].maxRows.contains(1))
+
+      assert(sql("SELECT * FROM VALUES(1, 'a'),(2, 'b') AS t(c1, c2) LIMIT 11")
+        
.queryExecution.analyzed.asInstanceOf[GlobalLimit].maxRows.contains(10))
+
+      assert(!sql("SELECT count(*) FROM VALUES(1, 'a'),(2, 'b') AS t(c1, c2)")
+        .queryExecution.analyzed.isInstanceOf[GlobalLimit])
+
+      assert(sql(
+        """
+          |SELECT c1, COUNT(*)
+          |FROM VALUES(1, 'a'), (2, 'b') AS t(c1, c2)
+          |GROUP BY c1
+          |""".stripMargin).queryExecution.analyzed.isInstanceOf[GlobalLimit])

Review comment:
       > It's flaky with Spark3.2.0 that the issue of some logical plan has not 
overridden maxRows is fixed. see 
[apache/spark#30443](https://github.com/apache/spark/pull/30443).
   > 
   > We can use the test table, see `KyuubiExtensionSuite.setupData`.
   
   _见贤思齐_
   I read the [apache/spark#30443](https://github.com/apache/spark/pull/30443). 
It seems to get more exactly maxRows in Optimizer? I don't understand how 
affect the test case changed, as `VALUES(1, 'a'), (2, 'b') AS t(c1, c2)`?




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