-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #3823: Reading Parquet from s3
- Loading branch information
Showing
10 changed files
with
163 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
extended/src/main/java/apoc/export/parquet/ParquetBufferedWriter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package apoc.export.parquet; | ||
|
||
import org.apache.parquet.io.OutputFile; | ||
import org.apache.parquet.io.PositionOutputStream; | ||
|
||
import java.io.IOException; | ||
import java.io.OutputStream; | ||
|
||
public record ParquetBufferedWriter(OutputStream out) implements OutputFile { | ||
|
||
@Override | ||
public PositionOutputStream create(long blockSizeHint) { | ||
return createPositionOutputstream(); | ||
} | ||
|
||
@Override | ||
public PositionOutputStream createOrOverwrite(long blockSizeHint) { | ||
return createPositionOutputstream(); | ||
} | ||
|
||
private PositionOutputStream createPositionOutputstream() { | ||
return new PositionOutputStream() { | ||
|
||
int pos = 0; | ||
|
||
@Override | ||
public long getPos() { | ||
return pos; | ||
} | ||
|
||
@Override | ||
public void flush() throws IOException { | ||
out.flush(); | ||
} | ||
|
||
@Override | ||
public void close() throws IOException { | ||
out.close(); | ||
} | ||
|
||
@Override | ||
public void write(int b) throws IOException { | ||
out.write(b); | ||
pos++; | ||
} | ||
|
||
@Override | ||
public void write(byte[] b, int off, int len) throws IOException { | ||
out.write(b, off, len); | ||
pos += len; | ||
} | ||
}; | ||
} | ||
|
||
@Override | ||
public boolean supportsBlockSize() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public long defaultBlockSize() { | ||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.