Пример #1
0
 @SuppressWarnings("rawtypes")
 @Override
 public Closeable createOutputStream(String hdfsPath, HdfsConfiguration configuration) {
   try {
     Closeable rout;
     HdfsInfo hdfsInfo = HdfsInfoFactory.newHdfsInfo(hdfsPath);
     Class<? extends WritableComparable> keyWritableClass =
         configuration.getKeyType().getWritableClass();
     Class<? extends WritableComparable> valueWritableClass =
         configuration.getValueType().getWritableClass();
     rout =
         new BloomMapFile.Writer(
             hdfsInfo.getConf(),
             new Path(hdfsPath),
             org.apache.hadoop.io.MapFile.Writer.keyClass(keyWritableClass),
             org.apache.hadoop.io.MapFile.Writer.valueClass(valueWritableClass),
             org.apache.hadoop.io.MapFile.Writer.compression(
                 configuration.getCompressionType(),
                 configuration.getCompressionCodec().getCodec()),
             org.apache.hadoop.io.MapFile.Writer.progressable(
                 new Progressable() {
                   @Override
                   public void progress() {}
                 }));
     return rout;
   } catch (IOException ex) {
     throw new RuntimeCamelException(ex);
   }
 }
Пример #2
0
 @Override
 public Closeable createOutputStream(String hdfsPath, HdfsConfiguration configuration) {
   try {
     Closeable rout;
     HdfsInfo hdfsInfo = HdfsInfoFactory.newHdfsInfo(hdfsPath);
     Class<?> keyWritableClass = configuration.getKeyType().getWritableClass();
     Class<?> valueWritableClass = configuration.getValueType().getWritableClass();
     rout =
         SequenceFile.createWriter(
             hdfsInfo.getConf(),
             Writer.file(hdfsInfo.getPath()),
             Writer.keyClass(keyWritableClass),
             Writer.valueClass(valueWritableClass),
             Writer.bufferSize(configuration.getBufferSize()),
             Writer.replication(configuration.getReplication()),
             Writer.blockSize(configuration.getBlockSize()),
             Writer.compression(
                 configuration.getCompressionType(),
                 configuration.getCompressionCodec().getCodec()),
             Writer.progressable(
                 new Progressable() {
                   @Override
                   public void progress() {}
                 }),
             Writer.metadata(new SequenceFile.Metadata()));
     return rout;
   } catch (IOException ex) {
     throw new RuntimeCamelException(ex);
   }
 }