aboutsummaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMarcelo Vanzin <vanzin@cloudera.com>2015-08-12 10:38:30 -0700
committerMichael Armbrust <michael@databricks.com>2015-08-12 10:38:30 -0700
commit57ec27dd7784ce15a2ece8a6c8ac7bd5fd25aea2 (patch)
tree13b82bd67b73ea3b1b6a0793098704de27776fc3 /sql
parente0110792ef71ebfd3727b970346a2e13695990a4 (diff)
downloadspark-57ec27dd7784ce15a2ece8a6c8ac7bd5fd25aea2.tar.gz
spark-57ec27dd7784ce15a2ece8a6c8ac7bd5fd25aea2.tar.bz2
spark-57ec27dd7784ce15a2ece8a6c8ac7bd5fd25aea2.zip
[SPARK-9804] [HIVE] Use correct value for isSrcLocal parameter.
If the correct parameter is not provided, Hive will run into an error because it calls methods that are specific to the local filesystem to copy the data. Author: Marcelo Vanzin <vanzin@cloudera.com> Closes #8086 from vanzin/SPARK-9804.
Diffstat (limited to 'sql')
-rw-r--r--sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala13
1 files changed, 10 insertions, 3 deletions
diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala
index 6e826ce552..8fc8935b1d 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala
@@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit
import scala.collection.JavaConversions._
-import org.apache.hadoop.fs.Path
+import org.apache.hadoop.fs.{FileSystem, Path}
import org.apache.hadoop.hive.conf.HiveConf
import org.apache.hadoop.hive.ql.Driver
import org.apache.hadoop.hive.ql.metadata.{Hive, Partition, Table}
@@ -429,7 +429,7 @@ private[client] class Shim_v0_14 extends Shim_v0_13 {
isSkewedStoreAsSubdir: Boolean): Unit = {
loadPartitionMethod.invoke(hive, loadPath, tableName, partSpec, replace: JBoolean,
holdDDLTime: JBoolean, inheritTableSpecs: JBoolean, isSkewedStoreAsSubdir: JBoolean,
- JBoolean.TRUE, JBoolean.FALSE)
+ isSrcLocal(loadPath, hive.getConf()): JBoolean, JBoolean.FALSE)
}
override def loadTable(
@@ -439,7 +439,7 @@ private[client] class Shim_v0_14 extends Shim_v0_13 {
replace: Boolean,
holdDDLTime: Boolean): Unit = {
loadTableMethod.invoke(hive, loadPath, tableName, replace: JBoolean, holdDDLTime: JBoolean,
- JBoolean.TRUE, JBoolean.FALSE, JBoolean.FALSE)
+ isSrcLocal(loadPath, hive.getConf()): JBoolean, JBoolean.FALSE, JBoolean.FALSE)
}
override def loadDynamicPartitions(
@@ -461,6 +461,13 @@ private[client] class Shim_v0_14 extends Shim_v0_13 {
HiveConf.ConfVars.METASTORE_CLIENT_CONNECT_RETRY_DELAY,
TimeUnit.MILLISECONDS).asInstanceOf[Long]
}
+
+ protected def isSrcLocal(path: Path, conf: HiveConf): Boolean = {
+ val localFs = FileSystem.getLocal(conf)
+ val pathFs = FileSystem.get(path.toUri(), conf)
+ localFs.getUri() == pathFs.getUri()
+ }
+
}
private[client] class Shim_v1_0 extends Shim_v0_14 {