1

I am running a Java program on a remote computer and trying to read the split data using RecordReader object but instead getting:

Exception in thread "main" java.io.IOException: job information not found in JobContext. HCatInputFormat.setInput() not called?

I already have called the following:

 _hcatInputFmt = HCatInputFormat.setInput(_myJob, db,tbl);

and then creating the RecordReader object as:

 _hcatInputFmt.createRecordReader(hSplit, taskContext)

On debugging it fails while searching for the value of the key: HCAT_KEY_JOB_INFO in job configuration object, while trying to create a RecordReader object.

How do I set this value? Any pointers will be helpful.

Thanks.

4

2 回答 2

0

我们必须使用getConfiguration()方法从作业对象中获取配置。用于创建作业对象的配置对象不会这样做。

于 2014-03-07T18:54:31.520 回答
0

我有同样的问题,你应该使用:

    HCatInputFormat.setInput(job, dbName, inputTableName);
    HCatSchema inputschema = HCatBaseInputFormat.getTableSchema(job.getConfiguration());

不是

    HCatInputFormat.setInput(job, dbName, inputTableName);
    HCatSchema inputschema = HCatBaseInputFormat.getTableSchema(getConf());

因为,当你使用时Job.getInstance(conf),它会复制conf,你不能使用原来的conf。这是代码:

 /** 
 * A new configuration with the same settings cloned from another.
 * 
 * @param other the configuration from which to clone settings.
 */
@SuppressWarnings("unchecked")
public Configuration(Configuration other) {
  this.resources = (ArrayList<Resource>) other.resources.clone();
  synchronized(other) {
 if (other.properties != null) {
   this.properties = (Properties)other.properties.clone();
 }

 if (other.overlay!=null) {
   this.overlay = (Properties)other.overlay.clone();
 }

 this.updatingResource = new ConcurrentHashMap<String, String[]>(
     other.updatingResource);
 this.finalParameters = Collections.newSetFromMap(
     new ConcurrentHashMap<String, Boolean>());
 this.finalParameters.addAll(other.finalParameters);
}

 synchronized(Configuration.class) {
  REGISTRY.put(this, null);
}
this.classLoader = other.classLoader;
this.loadDefaults = other.loadDefaults;
setQuietMode(other.getQuietMode());
}
于 2017-11-28T07:28:09.593 回答