Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/16804#discussion_r99625665
--- Diff:
sql/hive/src/test/scala/org/apache/spark/sql/hive/orc/OrcSourceSuite.scala ---
@@ -162,6 +162,28 @@ abstract class OrcSuite extends QueryTest with
TestHiveSingleton with BeforeAndA
hiveClient.runSqlHive("DROP TABLE IF EXISTS orc_varchar")
}
}
+
+ test("read varchar column from orc tables created by hive") {
+ try {
--- End diff --
how about
```
val hiveClient =
spark.sharedState.externalCatalog.asInstanceOf[HiveExternalCatalog].client
try {
hiveClient.runSqlHive("CREATE TABLE hive_orc(a VARCHAR(10)) STORED
AS orc LOCATION xxx")
hiveClient.runSqlHive("INSERT INTO TABLE orc_varchar SELECT 'a' FROM
(SELECT 1) t")
sql("CREATE EXTERNAL TABLE spark_orc ...")
checkAnswer...
} finally {
sql("DROP TABLE IF EXISTS ...")
...
}
```
then we don't need to create the orc file manually.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]