Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ private[hive] class HiveClientImpl(
// Since HIVE-18238(Hive 3.0.0), the Driver.close function's return type changed
// and the CommandProcessorFactory.clean function removed.
driver.getClass.getMethod("close").invoke(driver)
if (version != hive.v3_0 && version != hive.v3_1 && version != hive.v4_0) {
if (version < hive.v3_0) {
CommandProcessorFactory.clean(conf)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package org.apache.spark.sql.hive

import org.apache.spark.util.Utils

/** Support for interacting with different versions of the HiveMetastoreClient */
package object client {
private[hive] sealed abstract class HiveVersion(
Expand Down Expand Up @@ -115,8 +117,14 @@ package object client {
exclusions =
"org.apache.curator:*" ::
"org.apache.hive:hive-service-rpc" ::
"org.apache.tez:tez-api" ::
"org.apache.zookeeper:zookeeper" :: Nil)
"org.apache.zookeeper:zookeeper" :: Nil ++
{
if (!Utils.isTesting) {
Seq("org.apache.tez:tez-api")
} else {
Seq.empty
}
})

val allSupportedHiveVersions: Set[HiveVersion] =
Set(v2_0, v2_1, v2_2, v2_3, v3_0, v3_1, v4_0, v4_1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,13 @@ class HiveClientSuite(version: String) extends HiveVersionSuite(version) {
}
}

test("read table written by Hive") {
withTable("test_tbl") {
client.runSqlHive("CREATE TABLE test_tbl AS SELECT 1")
assert(versionSpark.sql("SELECT * from test_tbl").collect() === Array(Row(1)))
}
}

///////////////////////////////////////////////////////////////////////////
// Miscellaneous API
///////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ private[client] abstract class HiveVersionSuite(version: String) extends SparkFu
hadoopConf.set("datanucleus.autoStartMechanismMode", "ignored")
hadoopConf.set("hive.metastore.schema.verification", "false")
// Since Hive 3.0, HIVE-19310 skipped `ensureDbInit` if `hive.in.test=false`.
if (version == "3.0" || version == "3.1" || version == "4.0") {
val ver = IsolatedClientLoader.hiveVersion(version)
if (hive.v3_0 <= ver) {
hadoopConf.set("hive.in.test", "true")
hadoopConf.set("hive.query.reexecution.enabled", "false")
}
Expand Down