ZJONSSON / parquetjs

fully asynchronous, pure JavaScript implementation of the Parquet file format
MIT License
34 stars 61 forks source link

cursor.buffer.readInt32LE is not a function #71

Open Rodriguevb opened 3 years ago

Rodriguevb commented 3 years ago

I use NuxtJS and I would like to read a parquet file from a URL. I get an error when I read the records using the cursor.next() method. The file seems to be of the right format because I can download it via the url and read it via this website: https://parquet-viewer-online.com

I forgot a dependency?

async readParquetFile(url) {
    const parquet = require('parquetjs-lite');
    const request = require('request');
    let reader = await parquet.ParquetReader.openUrl(request, url)
    let cursor = reader.getCursor();
    let record = null;
    while (record = await cursor.next()) {   // error TypeError: cursor.buffer.readInt32LE is not a function
        console.log(record);
    }
}
TypeError: cursor.buffer.readInt32LE is not a function
    at decodeValues_INT32 (plain.js?8f9a:42)
    at Object.exports.decodeValues (plain.js?8f9a:251)
    at decodeValues (reader.js?245a:614)
    at decodeDataPage (reader.js?245a:832)
    at decodePage (reader.js?245a:670)
    at decodePages (reader.js?245a:713)
    at eval (reader.js?245a:577)
    at async ParquetEnvelopeReader.readRowGroup (reader.js?245a:535)
    at async ParquetCursor.next (reader.js?245a:60)

I use NuxtJs with these dependencies in package.json

"dependencies": {
    "@nuxtjs/axios": "latest",
    "@nuxtjs/pwa": "latest",
    "fs": "latest",
    "net": "latest",
    "tls": "latest",
    "nuxt": "latest",
    "parquetjs-lite": "latest",
    "request": "latest"
},

and with this build in nuxt.config.js

build: {
    extend(config, {}) {
        config.node = {
            fs: 'empty',
        }
    }
},