cloud-fan commented on code in PR #42099:
URL: https://github.com/apache/spark/pull/42099#discussion_r1270668141
##########
sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2Suite.scala:
##########
@@ -388,6 +388,28 @@ class DataSourceV2Suite extends QueryTest with
SharedSparkSession with AdaptiveS
assert(df.queryExecution.executedPlan.collect { case e: Exchange => e
}.isEmpty)
}
+ test("SPARK-44505: should not call planInputPartitions() on explain") {
+ val df = spark.read.format(classOf[ScanDefinedColumnarSupport].getName)
+ .option("columnar", "PARTITION_DEFINED").load()
+ // Default mode will throw an exception on explain.
+ var ex = intercept[IllegalArgumentException](df.explain())
+ assert(ex.getMessage == "planInputPartitions must not be called")
+
+ val dfScan = spark.read.format(classOf[ScanDefinedColumnarSupport].getName)
+ .option("columnar", "SUPPORTED").load()
+ dfScan.explain()
+ // Will fail during regular execution.
+ ex = intercept[IllegalArgumentException](dfScan.count())
+ assert(ex.getMessage == "planInputPartitions must not be called")
+
+ val dfScanUnsupported =
spark.read.format(classOf[ScanDefinedColumnarSupport].getName)
+ .option("columnar", "SUPPORTED").load()
Review Comment:
```suggestion
.option("columnar", "UNSUPPORTED").load()
```
--
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]