Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/19470#discussion_r144457932
--- Diff:
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala
---
@@ -2050,4 +2050,80 @@ class SQLQuerySuite extends QueryTest with
SQLTestUtils with TestHiveSingleton {
}
}
}
+
+ test("SPARK-18355 Use Spark schema to read ORC table instead of ORC file
schema") {
+ val client =
spark.sharedState.externalCatalog.asInstanceOf[HiveExternalCatalog].client
+
+ Seq("true", "false").foreach { value =>
+ withSQLConf(HiveUtils.CONVERT_METASTORE_ORC.key -> value) {
+ withTempDatabase { db =>
+ client.runSqlHive(
+ s"""
+ |CREATE TABLE $db.t(
+ | click_id string,
+ | search_id string,
+ | uid bigint)
+ |PARTITIONED BY (
+ | ts string,
+ | hour string)
+ |STORED AS ORC
+ """.stripMargin)
+
+ client.runSqlHive(
+ s"""
+ |INSERT INTO TABLE $db.t
+ |PARTITION (ts = '98765', hour = '01')
+ |VALUES (12, 2, 12345)
+ """.stripMargin
+ )
+
+ checkAnswer(
+ sql(s"SELECT * FROM $db.t"),
--- End diff --
please list all columns here instead of `*`, to make the test more clear
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]