gora-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lewismc <...@git.apache.org>
Subject [GitHub] gora pull request #135: Goraexplorer needed changes
Date Thu, 04 Oct 2018 05:50:02 GMT
Github user lewismc commented on a diff in the pull request:

    https://github.com/apache/gora/pull/135#discussion_r222543239
  
    --- Diff: gora-pig/src/main/java/org/apache/gora/pig/mapreduce/PigGoraOutputFormat.java
---
    @@ -0,0 +1,86 @@
    +package org.apache.gora.pig.mapreduce;
    +
    +import java.io.IOException;
    +
    +import org.apache.gora.mapreduce.GoraRecordWriter;
    +import org.apache.gora.mapreduce.NullOutputCommitter;
    +import org.apache.gora.persistency.Persistent;
    +import org.apache.gora.pig.StorageConfiguration;
    +import org.apache.gora.store.DataStore;
    +import org.apache.gora.store.DataStoreFactory;
    +import org.apache.hadoop.conf.Configurable;
    +import org.apache.hadoop.conf.Configuration;
    +import org.apache.hadoop.mapreduce.JobContext;
    +import org.apache.hadoop.mapreduce.OutputCommitter;
    +import org.apache.hadoop.mapreduce.OutputFormat;
    +import org.apache.hadoop.mapreduce.RecordWriter;
    +import org.apache.hadoop.mapreduce.TaskAttemptContext;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +public class PigGoraOutputFormat<K, T extends Persistent> extends OutputFormat<K,
T> implements Configurable {
    +  
    +  public static final Logger LOG = LoggerFactory.getLogger(PigGoraOutputFormat.class);
    +
    +  protected Configuration conf ;
    +  
    +  /**
    +   * The GoraStorage configuration setted at constructor (converted from json to bean)
    +   */
    +  protected StorageConfiguration storageConfiguration ;
    +  
    +  protected DataStore<K,T> dataStore ;
    +  
    +  @Override
    +  @SuppressWarnings({ "unchecked", "rawtypes" })
    +  public RecordWriter<K, T> getRecordWriter(TaskAttemptContext context)
    +      throws IOException, InterruptedException {
    +
    +    if ( this.dataStore == null ) {
    +      this.dataStore = DataStoreFactory.getDataStore(
    +          this.storageConfiguration.getKeyClass(),
    +          this.storageConfiguration.getPersistentClass(),
    +          this.storageConfiguration.getGoraPropertiesAsProperties(),
    +          this.conf
    +          ) ;      
    +    }
    +    
    +    return new GoraRecordWriter(this.dataStore, context);
    +  }
    +
    +
    +  @Override
    +  public void checkOutputSpecs(JobContext context) throws IOException, InterruptedException
{
    +    // Nothing
    --- End diff --
    
    throw unsupported exception?


---

Mime
View raw message