Examples of ReaderContext


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

public class DataReaderSlave {

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

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

    String[] inpSlitsToRead = args[1].split(",");
    List<InputSplit> splits = cntxt.getSplits();

    for (int i = 0; i < inpSlitsToRead.length; i++) {
      InputSplit split = splits.get(Integer.parseInt(inpSlitsToRead[i]));
      HCatReader reader = DataTransferFactory.getHCatReader(split, cntxt.getConf());
      Iterator<HCatRecord> itr = reader.read();
      File f = new File(args[2] + "-" + i);
      f.delete();
      BufferedWriter outFile = new BufferedWriter(new FileWriter(f));
      while (itr.hasNext()) {
View Full Code Here

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

    for (Entry<Object, Object> kv : externalConfigs.entrySet()) {
      config.put((String) kv.getKey(), (String) kv.getValue());
    }

    // This piece of code runs in master node and gets necessary context.
    ReaderContext context = runsInMaster(config);

    ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(new File(args[1])));
    oos.writeObject(context);
    oos.flush();
    oos.close();
View Full Code Here

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

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

    ReadEntity.Builder builder = new ReadEntity.Builder();
    ReadEntity entity = builder.withTable(config.get("table")).build();
    HCatReader reader = DataTransferFactory.getHCatReader(entity, config);
    ReaderContext cntxt = reader.prepareRead();
    return cntxt;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.