从NPM文档中的以下示例 (https://www.npmjs.com/package/parquets),我该如何将生成的parquet文件直接写入minio,避免先将parquet文件写入磁盘,再执行第二个操作将文件移动到minio。
下面的示例在调用close()时立即将文件写入磁盘。
下面的示例在调用close()时立即将文件写入磁盘。
// advanced fruits table
let schema = new ParquetSchema({
name: { type: 'UTF8' },
colours: { type: 'UTF8', repeated: true },
stock: {
repeated: true,
fields: {
price: { type: 'DOUBLE' },
quantity: { type: 'INT64' },
}
}
});
// the above schema allows us to store the following rows:
let writer = await ParquetWriter.openFile(schema, 'fruits.parquet');
await writer.appendRow({
name: 'banana',
colours: ['yellow'],
stock: [
{ price: 2.45, quantity: 16 },
{ price: 2.60, quantity: 420 }
]
});
await writer.appendRow({
name: 'apple',
colours: ['red', 'green'],
stock: [
{ price: 1.20, quantity: 42 },
{ price: 1.30, quantity: 230 }
]
});
await writer.close();