Comments (5)
Using the parquets fork which adds an openBuffer method. I've managed to get this working using ParquetReader and ParquetWriter, but not via streaming 😔
If my understanding is correct this means the whole file will be loaded into memory to perform updates. Given my S3 Key partitioning the size of my sqsRecords this may not be an issue in the short term but is not really the solution I was hoping for.
const upload = s3Stream.upload({ Bucket, Key });
const existingRecords = await getS3FileBuffer(Bucket, Key);
const reader = await parquet.ParquetReader.openBuffer(existingRecords);
const writer = await parquet.ParquetWriter.openStream(schema, upload);
let cursor = reader.getCursor();
let rec = null;
while (rec = await cursor.next()) {
writer.appendRow(rec)
}
writer.appendRow({ value: transformRecord(sqsRecord) });
writer.close();
from parquetjs.
Did you find any alternative solution, @designreact? I also plan to save to S3.
from parquetjs.
@paulocoghi , @designreact , did you find any way to upload the file to s3?
from parquetjs.
that seems to work:
import { S3Client } from '@aws-sdk/client-s3';
import { Upload } from '@aws-sdk/lib-storage';
const createUploadStream = (
fileName: string,
): { passStream: stream.PassThrough; parallelUploadS3: Upload } => {
const passStream = new stream.PassThrough();
const uploadKeyName = fileName + '.parquet';
const parallelUploadS3 = new Upload({
client: new S3Client({}),
queueSize: 4,
params: {
Bucket: downloadBucketName,
Key: uploadKeyName,
Body: passStream,
},
});
parallelUploadS3.on('httpUploadProgress', (progress) => {
console.log(`Download part: ${progress.part}`);
});
return { passStream, parallelUploadS3 };
};
export const handler = async (event: DownloadLambdaEvent) => {
console.log('Processing event: ', JSON.stringify(event, null, 2));
try {
const { parallelUploadS3, passStream } = createUploadStream(event.fileName);
https.get(`${DownloadUrlPrefix}${event.fileName}.zip`, (fileStream) => {
fileStream.pipe(unzipper.ParseOne()).pipe(ndjson.parse()).pipe(new parquet.ParquetTransformer(schema, opts)).pipe(passStream);
});
...
from parquetjs.
Does someone know how we would do this for Google Cloud bucket?
from parquetjs.
Related Issues (20)
- Unable to mock module using Jest HOT 1
- ParquetTransformer stream doesn't emit error HOT 1
- Cannot write a parquet file having a comma in one of its headers HOT 1
- Parquet file parsing error HOT 2
- Any way to Read parquet records before appending to file HOT 2
- os.close is not a function HOT 3
- parquet write to s3 is not queryable by Athena HOT 4
- Issue with decodeRunRepeated
- is it a unmaintained Package? HOT 2
- invalid parquet version - parquet-cpp
- How to upload the parquet file to s3? HOT 3
- How to read the latest value?
- Streaming read HOT 1
- How to preview/read head of a compressed parquet file?
- Write multiple rows in bulk
- React native HOT 1
- Cannot use 'in' operator to search error HOT 1
- [NodeJS] RangeError [ERR_OUT_OF_RANGE] when reading a parquet file HOT 4
- invalid parquet version error for parquet files generated via python script HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from parquetjs.