Package org.apache.hive.hcatalog.data.transfer

Examples of org.apache.hive.hcatalog.data.transfer.WriterContext


    } catch (IOException e) {
      throw new HCatException(ErrorType.ERROR_NOT_INITIALIZED, e);
    } catch (InterruptedException e) {
      throw new HCatException(ErrorType.ERROR_NOT_INITIALIZED, e);
    }
    WriterContext cntxt = new WriterContext();
    cntxt.setConf(job.getConfiguration());
    return cntxt;
  }
View Full Code Here


    while (itr.hasNext()) {
      Entry<String, String> kv = itr.next();
      map.put(kv.getKey(), kv.getValue());
    }

    WriterContext cntxt = runsInMaster(map);

    File writeCntxtFile = File.createTempFile("hcat-write", "temp");
    writeCntxtFile.deleteOnExit();

    // Serialize context.
View Full Code Here

  private WriterContext runsInMaster(Map<String, String> config) throws HCatException {

    WriteEntity.Builder builder = new WriteEntity.Builder();
    WriteEntity entity = builder.withTable("mytbl").build();
    HCatWriter writer = DataTransferFactory.getHCatWriter(entity, config);
    WriterContext info = writer.prepareWrite();
    return info;
  }
View Full Code Here

    while (itr.hasNext()) {
      Entry<String, String> kv = itr.next();
      map.put(kv.getKey(), kv.getValue());
    }

    WriterContext cntxt = runsInMaster(map);

    File writeCntxtFile = File.createTempFile("hcat-write", "temp");
    writeCntxtFile.deleteOnExit();

    // Serialize context.
View Full Code Here

  private WriterContext runsInMaster(Map<String, String> config) throws HCatException {

    WriteEntity.Builder builder = new WriteEntity.Builder();
    WriteEntity entity = builder.withTable("mytbl").build();
    HCatWriter writer = DataTransferFactory.getHCatWriter(entity, config);
    WriterContext info = writer.prepareWrite();
    return info;
  }
View Full Code Here

public class DataWriterSlave {

  public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException {

    ObjectInputStream ois = new ObjectInputStream(new FileInputStream(args[0]));
    WriterContext cntxt = (WriterContext) ois.readObject();
    ois.close();

    HCatWriter writer = DataTransferFactory.getHCatWriter(cntxt);
    writer.write(new HCatRecordItr(args[1]));
View Full Code Here

    }

    if (args.length == 3 && "commit".equalsIgnoreCase(args[2])) {
      // Then, master commits if everything goes well.
      ObjectInputStream ois = new ObjectInputStream(new FileInputStream(new File(args[1])));
      WriterContext cntxt = (WriterContext) ois.readObject();
      commit(config, true, cntxt);
      System.exit(0);
    }
    // This piece of code runs in master node and gets necessary context.
    WriterContext cntxt = runsInMaster(config);


    // Master node will serialize writercontext and will make it available at slaves.
    File f = new File(args[1]);
    f.delete();
View Full Code Here

  private static WriterContext runsInMaster(Map<String, String> config) throws HCatException {

    WriteEntity.Builder builder = new WriteEntity.Builder();
    WriteEntity entity = builder.withTable(config.get("table")).build();
    HCatWriter writer = DataTransferFactory.getHCatWriter(entity, config);
    WriterContext info = writer.prepareWrite();
    return info;
  }
View Full Code Here

TOP

Related Classes of org.apache.hive.hcatalog.data.transfer.WriterContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.