Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw exception if Hive thinks it's running in local mode #140

Merged
merged 2 commits into from
Aug 29, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/main/scala/shark/execution/FileSinkOperator.scala
Expand Up @@ -24,6 +24,7 @@ import org.apache.hadoop.fs.Path
import org.apache.hadoop.hive.conf.HiveConf
import org.apache.hadoop.hive.ql.exec.{FileSinkOperator => HiveFileSinkOperator}
import org.apache.hadoop.hive.ql.exec.JobCloseFeedBack
import org.apache.hadoop.hive.shims.ShimLoader
import org.apache.hadoop.mapred.TaskID
import org.apache.hadoop.mapred.TaskAttemptID
import org.apache.hadoop.mapred.SparkHadoopWriter
Expand Down Expand Up @@ -119,6 +120,16 @@ class FileSinkOperator extends TerminalOperator with Serializable {
val inputRdd = if (parentOperators.size == 1) executeParents().head._2 else null
val rdd = preprocessRdd(inputRdd)

val hiveIslocal = ShimLoader.getHadoopShims.isLocalMode(hconf)
if (!rdd.context.isLocal && hiveIslocal) {
val intro = "Hive Hadoop shims detected local mode even though Shark is not running locally.\n"
val jtCheck = "mapred.job.tracker should be specified and not 'local'. Value: %s.\n".format(
hconf.get("mapred.job.tracker"))
val fnCheck = "mapreduce.framework.name should be specified and not 'local'. Value: %s.\n".format(
hconf.get("mapreduce.framework.name"))
throw new Exception(intro + jtCheck + fnCheck)
}

parentOperators.head match {
case op: LimitOperator =>
// If there is a limit operator, let's only run one partition at a time to avoid
Expand Down