org.apache.orc.impl.WriterImpl Java Examples

The following examples show how to use org.apache.orc.impl.WriterImpl. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DremioORCRecordUtils.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
private DefaultDataReader(BufferAllocator allocator, DataReaderProperties properties, boolean useDirectMemory) {
  this.fs = properties.getFileSystem();
  this.path = properties.getPath();
  this.useZeroCopy = properties.getZeroCopy();
  this.codec = WriterImpl.createCodec(properties.getCompression());
  this.bufferSize = properties.getBufferSize();
  this.typeCount = properties.getTypeCount();
  this.pool = new DremioORCRecordUtils.ByteBufferAllocatorPool(allocator);
  this.allocator = allocator;
  this.useDirectMemory = useDirectMemory;
}
 
Example #2
Source File: OrcNoHiveBulkWriterFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public BulkWriter<RowData> create(FSDataOutputStream out) throws IOException {
	OrcFile.WriterOptions opts = OrcFile.writerOptions(new Properties(), conf);
	TypeDescription description = TypeDescription.fromString(schema);
	opts.setSchema(description);
	opts.physicalWriter(new PhysicalWriterImpl(out, opts));
	WriterImpl writer = new WriterImpl(null, new Path("."), opts);

	VectorizedRowBatch rowBatch = description.createRowBatch();
	return new BulkWriter<RowData>() {
		@Override
		public void addElement(RowData row) throws IOException {
			int rowId = rowBatch.size++;
			for (int i = 0; i < row.getArity(); ++i) {
				setColumn(rowId, rowBatch.cols[i], fieldTypes[i], row, i);
			}
			if (rowBatch.size == rowBatch.getMaxSize()) {
				writer.addRowBatch(rowBatch);
				rowBatch.reset();
			}
		}

		@Override
		public void flush() throws IOException {
			if (rowBatch.size != 0) {
				writer.addRowBatch(rowBatch);
				rowBatch.reset();
			}
		}

		@Override
		public void finish() throws IOException {
			flush();
			writer.close();
		}
	};
}
 
Example #3
Source File: OrcBulkWriterFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public BulkWriter<T> create(FSDataOutputStream out) throws IOException {
	OrcFile.WriterOptions opts = getWriterOptions();
	opts.physicalWriter(new PhysicalWriterImpl(out, opts));

	return new OrcBulkWriter<>(vectorizer, new WriterImpl(null, FIXED_PATH, opts));
}