Skip to content

Commit

Permalink
Fix improper initial magic number placement in Parquet writing, there…
Browse files Browse the repository at this point in the history
…by also "fixing" dictionary offset 0 issue (#2820)
  • Loading branch information
rcaudy committed Sep 8, 2022
1 parent 1a40f8b commit f1d8922
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.SeekableByteChannel;
import java.util.ArrayList;
Expand Down Expand Up @@ -54,6 +55,7 @@ public ParquetFileWriter(
this.allocator = allocator;
this.extraMetaData = new HashMap<>(extraMetaData);
writeChannel = channelsProvider.getWriteChannel(filePath, false); // TODO add support for appending
writeChannel.write(ByteBuffer.wrap(ParquetFileReader.MAGIC));
this.type = type;
this.channelsProvider = channelsProvider;
this.compressor = DeephavenCodecFactory.getInstance().getByName(codecName);
Expand All @@ -78,7 +80,6 @@ public RowGroupWriter addRowGroup(final long size) {

public void close() throws IOException {
try (final OutputStream os = Channels.newOutputStream(writeChannel)) {
os.write(ParquetFileReader.MAGIC);
serializeOffsetIndexes(offsetIndexes, blocks, os);
ParquetMetadata footer =
new ParquetMetadata(new FileMetaData(type, extraMetaData, Version.FULL_VERSION), blocks);
Expand Down

0 comments on commit f1d8922

Please sign in to comment.