cloud-fan commented on a change in pull request #32482: URL: https://github.com/apache/spark/pull/32482#discussion_r629894847
########## File path: sql/core/src/test/scala/org/apache/spark/sql/CachedTableSuite.scala ########## @@ -1554,4 +1554,66 @@ class CachedTableSuite extends QueryTest with SQLTestUtils assert(!spark.catalog.isCached(viewName)) } } + + test("SPARK-35332: Make cache plan disable configs configurable - check AQE") { + withSQLConf(SQLConf.SHUFFLE_PARTITIONS.key -> "2", + SQLConf.COALESCE_PARTITIONS_MIN_PARTITION_NUM.key -> "1", + SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true") { + + withTempView("t1", "t2", "t3") { + withCache("t1", "t2", "t3") { + sql(s"SET ${SQLConf.CAN_CHANGE_CACHED_PLAN_OUTPUT_PARTITIONING.key} = false") + sql("CACHE TABLE t1 as SELECT /*+ REPARTITION */ * FROM values(1) as t(c)") + assert(spark.table("t1").rdd.partitions.length == 2) + + sql(s"SET ${SQLConf.CAN_CHANGE_CACHED_PLAN_OUTPUT_PARTITIONING.key} = true") + assert(spark.table("t1").rdd.partitions.length == 2) + sql("CACHE TABLE t2 as SELECT /*+ REPARTITION */ * FROM values(2) as t(c)") + assert(spark.table("t2").rdd.partitions.length == 1) + + sql(s"SET ${SQLConf.CAN_CHANGE_CACHED_PLAN_OUTPUT_PARTITIONING.key} = false") + assert(spark.table("t1").rdd.partitions.length == 2) + assert(spark.table("t2").rdd.partitions.length == 1) + sql("CACHE TABLE t3 as SELECT /*+ REPARTITION */ * FROM values(3) as t(c)") + assert(spark.table("t3").rdd.partitions.length == 2) + + sql(s"RESET ${SQLConf.CAN_CHANGE_CACHED_PLAN_OUTPUT_PARTITIONING.key}") + } + } + } + } + + test("SPARK-35332: Make cache plan disable configs configurable - check bucket scan") { + withTable("t1", "t2", "t3") { + Seq(1, 2, 3).foreach { i => + spark.range(1, 2) + .write + .format("parquet") + .bucketBy(2, "id") + .saveAsTable(s"t$i") + } + + withCache("t1", "t2", "t3") { + withSQLConf(SQLConf.BUCKETING_ENABLED.key -> "true", + SQLConf.FILES_MIN_PARTITION_NUM.key -> "1") { + sql(s"SET ${SQLConf.CAN_CHANGE_CACHED_PLAN_OUTPUT_PARTITIONING.key} = false") Review comment: ditto -- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org