HyukjinKwon commented on a change in pull request #23582: [SPARK-26661][SQL]
Show actual class name of the writing command in CTAS explain
URL: https://github.com/apache/spark/pull/23582#discussion_r248984540
##########
File path:
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveExplainSuite.scala
##########
@@ -182,4 +183,27 @@ class HiveExplainSuite extends QueryTest with
SQLTestUtils with TestHiveSingleto
assert(output.toString.contains(s"Scan hive default.$tableName"))
}
}
+
+ test("SPARK-26661: Show actual class name of the writing command in CTAS
explain") {
+ Seq(true, false).foreach { convertCTAS =>
+
+ withSQLConf(
+ HiveUtils.CONVERT_METASTORE_CTAS.key -> convertCTAS.toString,
+ HiveUtils.CONVERT_METASTORE_PARQUET.key -> convertCTAS.toString) {
+
+ val tableName = "tab1"
Review comment:
I would do:
```scala
val keyword = if (convertCTAS) {
Utils.getSimpleName(classOf[InsertIntoHadoopFsRelationCommand])
} else {
Utils.getSimpleName(classOf[InsertIntoHiveTable])
}
val df = sql("EXPLAIN CREATE TABLE tab1 STORED AS PARQUET AS SELECT
* FROM range(2)")
checkKeywordsExist(df, keyword)
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]