public static boolean insideMRJob(JobConf job) {
    return job != null
           && (HiveConf.getVar(job, HiveConf.ConfVars.PLAN) != null)
           && (!HiveConf.getVar(job, HiveConf.ConfVars.PLAN).isEmpty());
  }
Determine if we're being executed from within an MR job or as part
of a select * statement.  The signals for this varies between Hive versions.
@param job that contains things that are or are not set in a job
@return Are we in a job or not?
serde/src/java/org/apache/hadoop/hive/serde2/avro/AvroSerdeUtils.java