Skip to content

Commit acab1e8

Browse files
PARQUET-2449: Limit local buffer to be similar to Hadoop writing (#1299)
1 parent b04edf4 commit acab1e8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

parquet-common/src/main/java/org/apache/parquet/io/LocalOutputFile.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
*/
3131
public class LocalOutputFile implements OutputFile {
3232

33+
private static final int BUFFER_SIZE_DEFAULT = 4096;
34+
3335
private class LocalPositionOutputStream extends PositionOutputStream {
3436

3537
private final BufferedOutputStream stream;
@@ -80,24 +82,24 @@ public LocalOutputFile(Path file) {
8082
}
8183

8284
@Override
83-
public PositionOutputStream create(long buffer) throws IOException {
84-
return new LocalPositionOutputStream((int) buffer, StandardOpenOption.CREATE_NEW);
85+
public PositionOutputStream create(long blockSize) throws IOException {
86+
return new LocalPositionOutputStream(BUFFER_SIZE_DEFAULT, StandardOpenOption.CREATE_NEW);
8587
}
8688

8789
@Override
88-
public PositionOutputStream createOrOverwrite(long buffer) throws IOException {
90+
public PositionOutputStream createOrOverwrite(long blockSize) throws IOException {
8991
return new LocalPositionOutputStream(
90-
(int) buffer, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
92+
BUFFER_SIZE_DEFAULT, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
9193
}
9294

9395
@Override
9496
public boolean supportsBlockSize() {
95-
return true;
97+
return false;
9698
}
9799

98100
@Override
99101
public long defaultBlockSize() {
100-
return 512;
102+
return -1;
101103
}
102104

103105
@Override

0 commit comments

Comments
 (0)