zhaohehuhu commented on code in PR #5852:
URL: https://github.com/apache/kyuubi/pull/5852#discussion_r1554828163
##########
extensions/spark/kyuubi-extension-spark-3-5/src/test/scala/org/apache/spark/sql/WatchDogSuiteBase.scala:
##########
@@ -607,4 +608,37 @@ trait WatchDogSuiteBase extends
KyuubiSparkSQLExtensionTest {
assert(e.getMessage == "Script transformation is not allowed")
}
}
+
+ test("watchdog with scan maxFileSize -- data source v2") {
+ val df =
spark.read.format(classOf[ReportStatisticsAndPartitionAwareDataSource].getName).load()
+ df.createOrReplaceTempView("test")
+ val logical = df.queryExecution.optimizedPlan.collect {
+ case d: DataSourceV2ScanRelation => d
+ }.head
+ val tableSize = logical.computeStats().sizeInBytes.toLong
+ withSQLConf(KyuubiSQLConf.WATCHDOG_MAX_FILE_SIZE.key ->
tableSize.toString) {
+ sql("SELECT * FROM test").queryExecution.sparkPlan
+ }
+ withSQLConf(KyuubiSQLConf.WATCHDOG_MAX_FILE_SIZE.key -> (tableSize /
2).toString) {
+ intercept[MaxFileSizeExceedException](
+ sql("SELECT * FROM test").queryExecution.sparkPlan)
+ }
+
+ val nonPartDf =
spark.read.format(classOf[ReportStatisticsDataSource].getName).load()
+ nonPartDf.createOrReplaceTempView("test_non_part")
+ val nonPartLogical = nonPartDf.queryExecution.optimizedPlan.collect {
+ case d: DataSourceV2ScanRelation => d
+ }.head
+ val nonPartTableSize = nonPartLogical.computeStats().sizeInBytes.toLong
+
+ withSQLConf(KyuubiSQLConf.WATCHDOG_MAX_FILE_SIZE.key ->
nonPartTableSize.toString) {
+ sql("SELECT * FROM test_non_part").queryExecution.sparkPlan
+ }
+
+ withSQLConf(KyuubiSQLConf.WATCHDOG_MAX_FILE_SIZE.key -> (nonPartTableSize
/ 2).toString) {
+ intercept[MaxFileSizeExceedException](
+ sql("SELECT * FROM test_non_part").queryExecution.sparkPlan)
+ }
+
Review Comment:
Thanks.
--
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]