Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions java/core/src/java/org/apache/orc/impl/PhysicalFsWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class PhysicalFsWriter implements PhysicalWriter {
// a protobuf outStream around streamFactory
private CodedOutputStream codedCompressStream;

private final Path path;
private Path path;
private final HadoopShims shims;
private final long blockSize;
private final int maxPadding;
Expand Down Expand Up @@ -91,7 +91,18 @@ public PhysicalFsWriter(FileSystem fs,
OrcFile.WriterOptions opts,
WriterEncryptionVariant[] encryption
) throws IOException {
this(fs.create(path, opts.getOverwrite(), HDFS_BUFFER_SIZE,
fs.getDefaultReplication(path), opts.getBlockSize()), opts, encryption);
this.path = path;
LOG.info("ORC writer created for path: {} with stripeSize: {} blockSize: {}" +
" compression: {}", path, opts.getStripeSize(), blockSize, compress);
}

public PhysicalFsWriter(FSDataOutputStream outputStream,
OrcFile.WriterOptions opts,
WriterEncryptionVariant[] encryption
) throws IOException {
this.rawWriter = outputStream;
long defaultStripeSize = opts.getStripeSize();
this.addBlockPadding = opts.getBlockPadding();
if (opts.isEnforceBufferSize()) {
Expand All @@ -109,10 +120,6 @@ public PhysicalFsWriter(FileSystem fs,
this.compressionStrategy = opts.getCompressionStrategy();
this.maxPadding = (int) (opts.getPaddingTolerance() * defaultStripeSize);
this.blockSize = opts.getBlockSize();
LOG.info("ORC writer created for path: {} with stripeSize: {} blockSize: {}" +
" compression: {}", path, defaultStripeSize, blockSize, compress);
rawWriter = fs.create(path, opts.getOverwrite(), HDFS_BUFFER_SIZE,
fs.getDefaultReplication(path), blockSize);
blockOffset = 0;
unencrypted = new VariantTracker(opts.getSchema(), compress);
writeVariableLengthBlocks = opts.getWriteVariableLengthBlocks();
Expand Down Expand Up @@ -763,6 +770,10 @@ public void writeStatistics(StreamName name,

@Override
public String toString() {
return path.toString();
if (path != null) {
return path.toString();
} else {
return ByteString.EMPTY.toString();
}
}
}