cloud-fan commented on a change in pull request #29804:
URL: https://github.com/apache/spark/pull/29804#discussion_r496651792



##########
File path: 
sql/core/src/test/scala/org/apache/spark/sql/sources/BucketedReadSuite.scala
##########
@@ -1012,4 +1014,182 @@ abstract class BucketedReadSuite extends QueryTest with 
SQLTestUtils {
       }
     }
   }
+
+  private def checkDisableBucketedScan(
+    query: String,
+    expectedNumScanWithAutoScanEnabled: Int,
+    expectedNumScanWithAutoScanDisabled: Int): Unit = {
+
+    def checkNumBucketedScan(query: String, expectedNumBucketedScan: Int): 
Unit = {
+      val plan = sql(query).queryExecution.executedPlan
+      val bucketedScan = plan.collect { case s: FileSourceScanExec if 
s.bucketedScan => s }
+      assert(bucketedScan.length == expectedNumBucketedScan)
+    }
+
+    withSQLConf(SQLConf.AUTO_BUCKETED_SCAN_ENABLED.key -> "true") {
+      checkNumBucketedScan(query, expectedNumScanWithAutoScanEnabled)
+      val result = sql(query).collect()
+
+      withSQLConf(SQLConf.AUTO_BUCKETED_SCAN_ENABLED.key -> "false") {
+        checkNumBucketedScan(query, expectedNumScanWithAutoScanDisabled)
+        checkAnswer(sql(query), result)
+      }
+    }
+  }
+
+  test("SPARK-32859: disable unnecessary bucketed table scan - basic test") {

Review comment:
       Can we move the new tests to a new suite? They are more about bucket 
scan planning, instead of bucketed read.




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

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to