Pergunta

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.

Foi útil?

Solução

We have to use getConfiguration() method to get the configuration from the job object. The configuration object used in creating the job object won't do it.

Outras dicas

I had the same problem, you shuold use:

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

not

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

Because, when you use Job.getInstance(conf), it will copy the conf, you can't use the original conf. Here is the code:

 /** 
 * 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());
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top