Bug Loading data for second time in Electron app
martidinho8 opened this issue · 0 comments
martidinho8 commented
Hi All,
I used this package in combination with electron in vue.js. There is however a problem in loading the data in for the second time.
When I run this function in vuejs(in the methods);
async try_run_data() {
var parquet = require("../../node_modules/parquetjs-lite/parquet");
console.log(1);
let reader = await parquet.ParquetReader.openFile(
"./src/assets/data/parquet.snappy"
);
//console.log(reader)
console.log(2);
// create a new cursor
let cursor = reader.getCursor();
// read all records from the file and print them
let record = null;
// while (record = await cursor.next()) {
// var a = record
// }
// console.log(a)
let count = 0;
let check = [];
while ((record = await cursor.next())) {
count++;
// newobj[] = {};
// check.append(record)
check.push(record);
// console.log(record)
// var a = {record}
if (count == Infinity) {
break;
}
}
reader.close();
console.log(3);
console.context().log(check);
var a = [];
var b = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []];
for (let i = 0; i < check.length; i++) {
a.push(check[i]["__index_level_0__"]);
b[0].push(check[i]["000"]);
b[1].push(check[i]["001"]);
b[2].push(check[i]["002"]);
b[3].push(check[i]["003"]);
b[4].push(check[i]["004"]);
b[5].push(check[i]["005"]);
b[6].push(check[i]["006"]);
b[7].push(check[i]["007"]);
b[8].push(check[i]["008"]);
b[9].push(check[i]["009"]);
b[10].push(check[i]["010"]);
b[11].push(check[i]["011"]);
b[12].push(check[i]["012"]);
b[13].push(check[i]["013"]);
b[14].push(check[i]["014"]);
b[15].push(check[i]["015"]);
}
console.context().log(a);
console.context().log(b);
},
I get the console logs 1 to 3 and the console log of the data set I read in via parquet. However after restarting the electron app. I get a problem, the function only runs console.log(1). Meaning it does not run into:
let reader = await parquet.ParquetReader.openFile(
"./src/assets/data/parquet.snappy"
);
Is this a bug or a code mistake?
Note; I also changed in vue the await functions into promises. This also did not give the result I looked for :-(