Example usage for org.apache.hadoop.io ArrayPrimitiveWritable ArrayPrimitiveWritable

List of usage examples for org.apache.hadoop.io ArrayPrimitiveWritable ArrayPrimitiveWritable

Introduction

In this page you can find the example usage for org.apache.hadoop.io ArrayPrimitiveWritable ArrayPrimitiveWritable.

Prototype

public ArrayPrimitiveWritable(Object value) 

Source Link

Document

Wrap an existing array of primitives

Usage

From source file:org.apache.kylin.engine.mr.steps.UHCDictionaryReducer.java

License:Apache License

private void outputDict(TblColRef col, Dictionary<String> dict) throws IOException, InterruptedException {
    // output written to baseDir/colName/colName.rldict-r-00000 (etc)
    String dictFileName = col.getIdentity() + "/" + col.getName() + DICT_FILE_POSTFIX;

    try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
            DataOutputStream outputStream = new DataOutputStream(baos);) {
        outputStream.writeUTF(dict.getClass().getName());
        dict.write(outputStream);//from w  w w .  j ava2 s  . co  m

        mos.write(BatchConstants.CFG_OUTPUT_DICT, NullWritable.get(),
                new ArrayPrimitiveWritable(baos.toByteArray()), dictFileName);
    }
    mos.close();
}