Search in sources :

Example 1 with HCatWriter

use of org.apache.hive.hcatalog.data.transfer.HCatWriter in project hive by apache.

the class DataWriterMaster method runsInMaster.

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;
}
Also used : WriterContext(org.apache.hive.hcatalog.data.transfer.WriterContext) HCatWriter(org.apache.hive.hcatalog.data.transfer.HCatWriter) WriteEntity(org.apache.hive.hcatalog.data.transfer.WriteEntity)

Example 2 with HCatWriter

use of org.apache.hive.hcatalog.data.transfer.HCatWriter in project hive by apache.

the class TestReaderWriter method runsInSlave.

private void runsInSlave(WriterContext context) throws HCatException {
    HCatWriter writer = DataTransferFactory.getHCatWriter(context);
    writer.write(new HCatRecordItr());
}
Also used : HCatWriter(org.apache.hive.hcatalog.data.transfer.HCatWriter)

Example 3 with HCatWriter

use of org.apache.hive.hcatalog.data.transfer.HCatWriter in project hive by apache.

the class TestReaderWriter method runsInMaster.

private WriterContext runsInMaster(Map<String, String> config) throws Exception {
    WriteEntity.Builder builder = new WriteEntity.Builder();
    WriteEntity entity = builder.withTable("mytbl").build();
    HCatWriter writer = DataTransferFactory.getHCatWriter(entity, config);
    WriterContext info = writer.prepareWrite();
    return info;
}
Also used : WriterContext(org.apache.hive.hcatalog.data.transfer.WriterContext) HCatWriter(org.apache.hive.hcatalog.data.transfer.HCatWriter) WriteEntity(org.apache.hive.hcatalog.data.transfer.WriteEntity)

Example 4 with HCatWriter

use of org.apache.hive.hcatalog.data.transfer.HCatWriter in project hive by apache.

the class DataWriterMaster method commit.

private static void commit(Map<String, String> config, boolean status, WriterContext cntxt) throws HCatException {
    WriteEntity.Builder builder = new WriteEntity.Builder();
    WriteEntity entity = builder.withTable(config.get("table")).build();
    HCatWriter writer = DataTransferFactory.getHCatWriter(entity, config);
    if (status) {
        writer.commit(cntxt);
    } else {
        writer.abort(cntxt);
    }
}
Also used : HCatWriter(org.apache.hive.hcatalog.data.transfer.HCatWriter) WriteEntity(org.apache.hive.hcatalog.data.transfer.WriteEntity)

Example 5 with HCatWriter

use of org.apache.hive.hcatalog.data.transfer.HCatWriter in project hive by apache.

the class DataWriterSlave method main.

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]));
}
Also used : WriterContext(org.apache.hive.hcatalog.data.transfer.WriterContext) HCatWriter(org.apache.hive.hcatalog.data.transfer.HCatWriter) FileInputStream(java.io.FileInputStream) ObjectInputStream(java.io.ObjectInputStream)

Aggregations

HCatWriter (org.apache.hive.hcatalog.data.transfer.HCatWriter)6 WriteEntity (org.apache.hive.hcatalog.data.transfer.WriteEntity)4 WriterContext (org.apache.hive.hcatalog.data.transfer.WriterContext)3 FileInputStream (java.io.FileInputStream)1 ObjectInputStream (java.io.ObjectInputStream)1