Guest User

Untitled

a guest
Jul 18th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. const readParquet = async (fileKey) => {
  2.  
  3. const filePath = 'parquet-test-file.plain'; // 'snappy';
  4.  
  5. console.log('----- reading file : ', filePath);
  6. let reader = await parquet.ParquetReader.openFile(filePath);
  7. console.log('---- ParquetReader initialized....');
  8.  
  9. // create a new cursor
  10. let cursor = reader.getCursor();
  11.  
  12. // read all records from the file and print them
  13. if (cursor) {
  14. console.log('---- cursor initialized....');
  15.  
  16. let record = await cursor.next() ; // this line throws exception
  17. while (record) {
  18. console.log(record);
  19. record = await cursor.next();
  20. }
  21. }
  22.  
  23. await reader.close();
  24. console.log('----- done with reading parquet file....');
  25.  
  26. return;
  27. };
  28.  
  29. let dt = readParquet(fileKeys.dataFileKey);
  30. dt
  31. .then((value) => console.log('--------SUCCESS', value))
  32. .catch((error) => {
  33. console.log('-------FAILURE ', error); // Random error
  34. console.log(error.stack);
  35. })
Add Comment
Please, Sign In to add comment